• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP bp_get_activity_type函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中bp_get_activity_type函数的典型用法代码示例。如果您正苦于以下问题:PHP bp_get_activity_type函数的具体用法?PHP bp_get_activity_type怎么用?PHP bp_get_activity_type使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了bp_get_activity_type函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: bp_like_post_to_stream

/**
 * bp_like_post_to_stream()
 * 
 * Posts to stream, depending on settings
 * 
 * TODO, Should we be posted that people like comments to the feed? This can get messy..
 * Also no point having 20 posts saying people liked the same status..
 * 
 */
function bp_like_post_to_stream($item_id, $user_id)
{
    if (bp_like_get_settings('post_to_activity_stream') == 1 and bp_get_activity_type() == "profile_updated") {
        //TODO change from 1 to something more meaningful
        $activity = bp_activity_get_specific(array('activity_ids' => $item_id, 'component' => 'buddypress-like'));
        $author_id = $activity['activities'][0]->user_id;
        if ($user_id == $author_id) {
            $action = bp_like_get_text('record_activity_likes_own');
        } elseif ($user_id == 0) {
            $action = bp_like_get_text('record_activity_likes_an');
        } else {
            $action = bp_like_get_text('record_activity_likes_users');
        }
        $liker = bp_core_get_userlink($user_id);
        $author = bp_core_get_userlink($author_id);
        $activity_url = bp_activity_get_permalink($item_id);
        $content = '';
        //content must be defined...
        /* Grab the content and make it into an excerpt of 140 chars if we're allowed */
        if (bp_like_get_settings('show_excerpt') == 1) {
            $content = $activity['activities'][0]->content;
            if (strlen($content) > bp_like_get_settings('excerpt_length')) {
                $content = substr($content, 0, bp_like_get_settings('excerpt_length'));
                $content = strip_tags($content);
                $content = $content . '...';
            }
        }
        /* Filter out the placeholders */
        $action = str_replace('%user%', $liker, $action);
        $action = str_replace('%permalink%', $activity_url, $action);
        $action = str_replace('%author%', $author, $action);
        bp_activity_add(array('action' => $action, 'content' => $content, 'primary_link' => $activity_url, 'component' => 'bp-like', 'type' => 'activity_liked', 'user_id' => $user_id, 'item_id' => $item_id));
    }
}
开发者ID:Grendel61,项目名称:BuddyPress-Like,代码行数:43,代码来源:activity-functions.php


示例2: bebop_twitter_photos

function bebop_twitter_photos($text)
{
    if (bp_get_activity_type() == 'twitter') {
        $text = preg_replace('#http://twitpic.com/([a-z0-9_]+)#i', '<a href="http://twitpic.com/\\1" target="_blank" rel="external"><img width="60" src="http://twitpic.com/show/mini/\\1" /></a>', $text);
        $text = preg_replace('#http://yfrog.com/([a-z0-9_]+)#i', '<a href="http://yfrog.com/\\1" target="_blank" rel="external"><img width="60" src="http://yfrog.com/\\1.th.jpg" /></a>', $text);
        $text = preg_replace('#http://yfrog.us/([a-z0-9_]+)#i', '<a href="http://yfrog.us/\\1" target="_blank" rel="external"><img width="60" src="http://yfrog.us/\\1:frame" /></a>', $text);
    }
    return $text;
}
开发者ID:adisonc,项目名称:MaineLearning,代码行数:9,代码来源:core.php


示例3: activity_loop_link

 function activity_loop_link()
 {
     $act_type = bp_get_activity_type();
     if (empty($this->types_map[$act_type])) {
         return;
     }
     $args = array('type' => $this->types_map[$act_type], 'id' => bp_get_activity_item_id(), 'id2' => bp_get_activity_secondary_item_id(), 'author_id' => bp_get_activity_user_id(), 'is_main_content' => bp_is_single_activity(), 'context' => 'activity-loop', 'custom_class' => 'button');
     $args = apply_filters("bp_moderation_activity_loop_link_args_{$act_type}", $args);
     if ($args) {
         echo $this->generate_link($args);
     }
 }
开发者ID:adisonc,项目名称:MaineLearning,代码行数:12,代码来源:bpModFrontend.php


示例4: bp_reshare_add_reshare_button

function bp_reshare_add_reshare_button()
{
    global $bp;
    if (!is_user_logged_in()) {
        return false;
    }
    $activity_types_resharable = bp_reshare_activity_types();
    if (!in_array(bp_get_activity_type(), $activity_types_resharable)) {
        return false;
    }
    if (bp_reshare_activity_is_hidden()) {
        return false;
    }
    if (bp_reshare_is_user_profile_reshares() && $bp->displayed_user->id != $bp->loggedin_user->id) {
        return false;
    }
    $activity_first_id = bp_get_activity_id();
    if ('reshare_update' == bp_get_activity_type()) {
        $activity_first_id = bp_get_activity_secondary_item_id();
    }
    $rs_count = bp_activity_get_meta($activity_first_id, 'reshared_count');
    $rs_count = !empty($rs_count) ? $rs_count : 0;
    if ($bp->loggedin_user->id == bp_get_activity_user_id() || bp_reshare_user_did_reshared($activity_first_id)) {
        $reshared_class = 'reshared';
    }
    $action_url = wp_nonce_url(bp_get_root_domain() . '/' . bp_get_activity_root_slug() . '/?to_reshare=' . $activity_first_id, '_reshare_update');
    if ($_POST['scope'] == 'reshares' || bp_reshare_is_user_profile_reshares() || bp_is_activity_component() && !bp_displayed_user_id() && $_COOKIE['bp-activity-scope'] == 'reshares') {
        $extra_class = 'unshare';
        $action_url = wp_nonce_url(bp_get_root_domain() . '/' . bp_get_activity_root_slug() . '/?delete_reshare=' . bp_get_activity_id(), '_reshare_delete');
    }
    ?>
	
	<a href="<?php 
    echo $action_url;
    ?>
" class="button bp-primary-action bp-agu-reshare" id="bp-agu-reshare-<?php 
    bp_activity_id();
    ?>
" rel="<?php 
    echo $activity_first_id;
    ?>
"><span class="bp-agu-reshare-img <?php 
    echo $reshared_class . ' ' . $extra_class;
    ?>
"></span><span class="rs-count"><?php 
    echo $rs_count;
    ?>
</span></a>
	<?php 
}
开发者ID:KristianI,项目名称:bp-reshare,代码行数:50,代码来源:bp-reshare-screens.php


示例5: bplike_activity_update_button

function bplike_activity_update_button()
{
    $liked_count = 0;
    if (is_user_logged_in() && bp_get_activity_type() !== 'activity_liked') {
        if (bp_activity_get_meta(bp_get_activity_id(), 'liked_count', true)) {
            $users_who_like = array_keys(bp_activity_get_meta(bp_get_activity_id(), 'liked_count', true));
            $liked_count = count($users_who_like);
        }
        if (!bp_like_is_liked(bp_get_activity_id(), 'activity_update', get_current_user_id())) {
            ?>
            <a href="#" class="button bp-primary-action like" id="like-activity-<?php 
            echo bp_get_activity_id();
            ?>
" title="<?php 
            echo bp_like_get_text('like_this_item');
            ?>
">
                <?php 
            echo bp_like_get_text('like');
            if ($liked_count) {
                echo ' <span>' . $liked_count . '</span>';
            }
            ?>
            </a>
        <?php 
        } else {
            ?>
            <a href="#" class="button bp-primary-action unlike" id="unlike-activity-<?php 
            echo bp_get_activity_id();
            ?>
" title="<?php 
            echo bp_like_get_text('unlike_this_item');
            ?>
">
                <?php 
            echo bp_like_get_text('unlike');
            if ($liked_count) {
                echo '<span>' . $liked_count . '</span>';
            }
            ?>
            </a>
            <?php 
        }
        // Checking if there are users who like item.
        if (isset($users_who_like)) {
            view_who_likes(bp_get_activity_id(), 'activity_update');
        }
    }
}
开发者ID:cherbst,项目名称:BuddyPress-Like,代码行数:49,代码来源:activity-update.php


示例6: bp_like_button

/**
 * bp_like_button()
 *
 * Outputs the 'Like/Unlike' button.
 * 
 * TODO: Need to find/make function for getting activity type.
 * Also idea to get all registered types on site, and alert admin of unspoorted types,
 * and ask them to report them to myself.
 *
 */
function bp_like_button($id = '', $type = '')
{
    /* Set the type if not already set, and check whether we are outputting the button on a blogpost or not. */
    if (!$type && !is_single()) {
        $type = 'activity';
    } elseif (!$type && is_single()) {
        $type = 'blogpost';
    }
    if ($type == 'activity') {
        bplike_activity_button();
    } elseif ($type == 'blogpost') {
        bplike_blog_button();
        bp_get_activity_type();
    }
}
开发者ID:pausaura,项目名称:agora_nodes,代码行数:25,代码来源:button-functions.php


示例7: my_bp_activity_entry_content

function my_bp_activity_entry_content()
{
    if (bp_get_activity_object_name() == 'blogs' && bp_get_activity_type() == 'new_blog_post') {
        ?>
        <a class="view-post view-group-blog-comment" href="<?php 
        bp_activity_thread_permalink();
        ?>
">View group blog</a>
    <?php 
    }
    if (bp_get_activity_object_name() == 'blogs' && bp_get_activity_type() == 'new_blog_comment') {
        ?>
        <a class="view-post view-group-blog-comment" href="<?php 
        bp_activity_thread_permalink();
        ?>
">View group blog</a>
    <?php 
    }
    if (bp_get_activity_object_name() == 'activity' && bp_get_activity_type() == 'activity_update') {
        ?>
        <a class="view-post view-group-activity" href="<?php 
        bp_activity_thread_permalink();
        ?>
">View status update</a>
    <?php 
    }
    if (bp_get_activity_object_name() == 'groups' && bp_get_activity_type() == 'new_forum_topic') {
        ?>
        <a class="view-thread view-group-discussion-topic" href="<?php 
        bp_activity_thread_permalink();
        ?>
">View group discussion</a>
    <?php 
    }
    if (bp_get_activity_object_name() == 'groups' && bp_get_activity_type() == 'new_forum_post') {
        ?>
        <a class="view-post view-group-discussion-post" href="<?php 
        bp_activity_thread_permalink();
        ?>
">View group discussion</a>
    <?php 
    }
}
开发者ID:adisonc,项目名称:MaineLearning,代码行数:43,代码来源:functions.php


示例8: activity_content

 /**
  * Filter the activity stream item markup for Likes.
  *
  * @global unknown $activities_template
  * @return string
  * @since 1.3
  */
 public function activity_content($content)
 {
     global $activities_template;
     // Only handle Like activity items.
     if ('bpl_like' != bp_get_activity_object_name() || 'bpl_like' != bp_get_activity_type()) {
         return $content;
     }
     // Get the post
     // @todo handle a missing post better
     $post = get_post(bp_get_activity_item_id());
     if (is_null($post)) {
         return $content;
     }
     // Get number of Likes that this post has
     $extra_people = BPLabs_Like::get_likes_total();
     if ($extra_people) {
         $extra_content = '<p><img src="http://0.gravatar.com/avatar/81ec16063d89b162d55efe72165c105f?s=32&d=identicon&r=G" width="20" height="20" /> <img src="http://1.gravatar.com/avatar/9cf7c4541a582729a5fc7ae484786c0c?s=32&d=identicon&r=G" width="20" height="20" /> <img src="http://0.gravatar.com/avatar/e81cd075a6c9c29f712a691320e52dfd?s=32&d=identicon&r=G" width="20" height="20" /></p>';
         $extra_people = sprintf(__('and %s others', 'bpl'), number_format_i18n($extra_people - 1));
     } else {
         $extra_content = '';
         $extra_people = '';
     }
     // Build the content
     $content = '<p>' . sprintf(__('<a href="%1$s">%2$s</a> %3$s liked the article, <a href="%4$s">%5$s</a>.', 'bpl'), esc_attr(bp_get_activity_user_link()), $activities_template->activity->display_name, $extra_people, esc_attr(get_permalink($post->ID)), apply_filters('the_title', $post->post_title, $post->ID)) . '</p>';
     $content .= $extra_content;
     // Don't truncate the activity content
     remove_filter('bp_get_activity_content_body', 'bp_activity_truncate_entry', 5);
     return $content;
 }
开发者ID:rmccue,项目名称:BP-Labs,代码行数:36,代码来源:class-bplabs-like.php


示例9: build_html

    function build_html()
    {
        // Store everything in an output buffer
        ob_start();
        ?>
	
		<div class="widget showcase-widget">
			<header class="widget-header">
				<h3 class="widget-title">Recent Discussion</h3>
			</header>
			<ul class="recent-discussion-list">		
	
			<?php 
        // Iterate topics
        while (bp_activities()) {
            bp_the_activity();
            // Get the activity user
            $user = new Apoc_User(bp_get_activity_user_id(), 'directory', 40);
            // Get the activity type
            $type = bp_get_activity_type();
            // Format activity based on context
            switch ($type) {
                case 'bbp_topic_create':
                    $topic_id = bp_get_activity_item_id();
                    $link = '<a href="' . bbp_get_topic_permalink($topic_id) . '" title="Read topic" target="_blank">' . bbp_get_topic_title($topic_id) . '</a>';
                    $verb = 'created topic';
                    break;
                case 'bbp_reply_create':
                    $reply_id = bp_get_activity_secondary_item_id();
                    $link = '<a href="' . bbp_get_topic_last_reply_url($reply_id) . '" title="Read reply" target="_blank">' . bbp_get_topic_title($reply_id) . '</a>';
                    $verb = 'replied to';
                    break;
                case 'new_blog_comment':
                    $comment_id = bp_get_activity_secondary_item_id();
                    $comment = get_comment($comment_id);
                    $link = '<a href="' . get_comment_link($comment_id) . '" title="Read reply" target="_blank">' . get_the_title($comment->comment_post_ID) . '</a>';
                    $verb = 'commented on';
                    break;
            }
            // Get the activity time
            $time = bp_core_time_since(bp_get_activity_date_recorded());
            // Output the HTML
            ?>
				<li class="recent-discussion double-border">			
					<?php 
            echo $user->avatar;
            ?>
					<div class="recent-discussion-content">
						<span class="recent-discussion-title"><?php 
            echo $user->link . ' ' . $verb . ' ' . $link;
            ?>
</span>
						<span class="recent-discussion-time"><?php 
            echo $time;
            ?>
					</div>
				</li>
			
			<?php 
        }
        ?>
			</ul>
		</div><?php 
        // Get the contents of the buffer
        $html = ob_get_contents();
        ob_end_clean();
        // Return the html to the class
        return $html;
    }
开发者ID:tamriel-foundry,项目名称:apoc2,代码行数:69,代码来源:widgets.php


示例10: GetBuddyPressRating

 private function GetBuddyPressRating($ver, $horAlign = true)
 {
     RWLogger::LogEnterence('GetBuddyPressRating');
     global $activities_template;
     // Set current activity-comment to current activity update (recursive comments).
     $this->current_comment = $activities_template->activity;
     $rclass = str_replace('_', '-', bp_get_activity_type());
     $is_forum_topic = $rclass === 'new-forum-topic';
     if ($is_forum_topic && !$this->IsBBPressInstalled()) {
         return false;
     }
     if (!in_array($rclass, array('forum-post', 'forum-reply', 'new-forum-post', 'user-forum-post', 'user', 'activity-update', 'user-activity-update', 'activity-comment', 'user-activity-comment'))) {
         // If unknown activity type, change it to activity update.
         $rclass = 'activity-update';
     }
     if ($is_forum_topic) {
         $rclass = 'new-forum-post';
     }
     // Check if item rating is top positioned.
     if (!isset($this->activity_align[$rclass]) || $ver !== $this->activity_align[$rclass]->ver) {
         return false;
     }
     // Get item id.
     $item_id = 'activity-update' === $rclass || 'activity-comment' === $rclass ? bp_get_activity_id() : bp_get_activity_secondary_item_id();
     if ($is_forum_topic) {
         // If forum topic, then we must extract post id
         // from forum posts table, because secondary_item_id holds
         // topic id.
         if (function_exists('bb_get_first_post')) {
             $post = bb_get_first_post($item_id);
         } else {
             // Extract post id straight from the BB DB.
             global $bb_table_prefix;
             // Load bbPress config file.
             @(include_once WP_RW__BBP_CONFIG_LOCATION);
             // Failed loading config file.
             if (!defined('BBDB_NAME')) {
                 return false;
             }
             $connection = null;
             if (!($connection = mysql_connect(BBDB_HOST, BBDB_USER, BBDB_PASSWORD, true))) {
                 return false;
             }
             if (!mysql_selectdb(BBDB_NAME, $connection)) {
                 return false;
             }
             $results = mysql_query("SELECT * FROM {$bb_table_prefix}posts WHERE topic_id={$item_id} AND post_position=1", $connection);
             $post = mysql_fetch_object($results);
         }
         if (!isset($post->post_id) && empty($post->post_id)) {
             return false;
         }
         $item_id = $post->post_id;
     }
     // If the item is post, queue rating with post title.
     $title = 'new-blog-post' === $rclass ? get_the_title($item_id) : bp_get_activity_content_body();
     // $activities_template->activity->content;
     $options = array();
     $owner_id = bp_get_activity_user_id();
     // Add accumulator id if user accumulated rating.
     if ($this->IsUserAccumulatedRating()) {
         $options['uarid'] = $this->_getUserRatingGuid($owner_id);
     }
     return $this->EmbedRatingIfVisible($item_id, $owner_id, strip_tags($title), bp_activity_get_permalink(bp_get_activity_id()), $rclass, false, $horAlign ? $this->activity_align[$rclass]->hor : false, false, $options, false);
 }
开发者ID:robertoAg,项目名称:wordpress_humor,代码行数:65,代码来源:rating-widget.php


示例11: add_activity_spam_button

 /**
  * Adds a "mark as spam" button to each activity item for site admins.
  *
  * This function is intended to be used inside the activity stream loop.
  *
  * @since BuddyPress (1.6)
  */
 public function add_activity_spam_button()
 {
     if (!bp_activity_user_can_mark_spam()) {
         return;
     }
     // By default, only handle activity updates and activity comments.
     if (!in_array(bp_get_activity_type(), BP_Akismet::get_activity_types())) {
         return;
     }
     bp_button(array('block_self' => false, 'component' => 'activity', 'id' => 'activity_make_spam_' . bp_get_activity_id(), 'link_class' => 'bp-secondary-action spam-activity confirm button item-button', 'link_href' => wp_nonce_url(bp_get_root_domain() . '/' . bp_get_activity_slug() . '/spam/' . bp_get_activity_id() . '/', 'bp_activity_akismet_spam_' . bp_get_activity_id()), 'link_text' => __('Spam', 'buddypress'), 'wrapper' => false));
 }
开发者ID:pyropictures,项目名称:wordpress-plugins,代码行数:18,代码来源:bp-activity-akismet.php


示例12: unpin_activity

    /**
     *
     */
    function unpin_activity()
    {
        global $wpdb;
        $nonce = isset($_REQUEST['nonces']) ? sanitize_text_field($_REQUEST['nonces']) : 0;
        if (!wp_verify_nonce($nonce, 'pin-activity-nonce')) {
            exit(__('Not permitted', RW_Sticky_Activity::$textdomain));
        }
        $activityID = isset($_REQUEST['id']) && is_numeric($_REQUEST['id']) ? $_REQUEST['id'] : '';
        if ($activityID != '') {
            bp_activity_update_meta($activityID, 'rw_sticky_activity', 0);
        }
        $meta_query_args = array('relation' => 'AND', array('key' => 'rw_sticky_activity', 'value' => '1', 'compare' => '='));
        if (function_exists('bb_bp_activity_url_filter')) {
            // deactivate BuddyBoss Wall activity url preview
            remove_action('bp_get_activity_content_body', 'bb_bp_activity_url_filter');
        }
        add_filter('bp_activity_excerpt_length', function () {
            return 99999;
        });
        if (bp_has_activities(array('meta_query' => $meta_query_args))) {
            ?>
            <?php 
            while (bp_activities()) {
                bp_the_activity();
                ?>
                <div class="buddypress-sa">
                    <div id="factivity-stream">
                        <div class="activity-list">
                            <div class="activity-content" style="margin-left: 0px;">
                                <?php 
                $nonce = wp_create_nonce('pin-activity-nonce');
                $title = __('Unpin activity', RW_Sticky_Activity::$textdomain);
                $class = "sa-button-unpin  pinned";
                ?>
                                <a href="" class="fa fa-map-marker icon-button sa-button <?php 
                echo $class;
                ?>
" title="<?php 
                echo $title;
                ?>
" data-post-nonces="<?php 
                echo $nonce;
                ?>
" data-post-id="<?php 
                echo bp_get_activity_id();
                ?>
"></a>
                                <?php 
                if (bp_activity_has_content() && bp_get_activity_type() != 'bbp_topic_create' && bp_get_activity_type() != 'bbp_reply_create') {
                    ?>
                                    <div class="activity-inner">
                                        <?php 
                    bp_activity_content_body();
                    ?>
                                    </div>
                                <?php 
                }
                ?>
                                <?php 
                if (bp_get_activity_type() == 'bp_doc_edited') {
                    ?>
                                    <div class="activity-inner"><p>
                                            <?php 
                    $doc = get_post(url_to_postid(bp_get_activity_feed_item_link()));
                    echo __('Doc: ', RW_Sticky_Activity::$textdomain);
                    echo "<a href='" . get_permalink($doc->ID) . "'>";
                    echo $doc->post_title;
                    echo "</a>";
                    ?>
</p>
                                    </div>
                                    <?php 
                }
                // New forum topic created
                if (bp_get_activity_type() == 'bbp_topic_create') {
                    // url_to_postid fails on permalinks like http://gruppen.domain.tld/groups/frank-testgruppe/forum/topic/neues-thema/ !!!
                    ?>
                                    <div class="activity-inner"><p>
                                            <?php 
                    $link = bp_get_activity_feed_item_link();
                    $guid = substr($link, strpos($link, "/forum/topic") + 6);
                    $topicid = $wpdb->get_var($wpdb->prepare("SELECT ID FROM {$wpdb->posts} WHERE guid like '%%%s%%'", $guid));
                    $topic = get_post($topicid);
                    echo __('Forum new topic: ', RW_Sticky_Activity::$textdomain);
                    echo "<a href='" . get_permalink($topic->ID) . "'> ";
                    echo $topic->post_title;
                    echo "</a><br>";
                    ?>
</p>
                                    </div>
                                    <?php 
                }
                // New forum reply
                if (bp_get_activity_type() == 'bbp_reply_create') {
                    // url_to_postid fails on permalinks like http://gruppen.domain.tld/groups/frank-testgruppe/forum/topic/neues-thema/ !!!
                    ?>
                                    <div class="activity-inner"><p>
//.........这里部分代码省略.........
开发者ID:rpi-virtuell,项目名称:rw-sticky-activity,代码行数:101,代码来源:RW_Sticky_Activity_Core.php


示例13: _likebtn_bp_get_entity_name

function _likebtn_bp_get_entity_name()
{
    $activity_type = bp_get_activity_type();
    switch ($activity_type) {
        case 'bbp_topic_create':
            return LIKEBTN_ENTITY_BP_ACTIVITY_TOPIC;
        case 'new_blog_post':
            // Post
            return LIKEBTN_ENTITY_BP_ACTIVITY_POST;
        case 'new_member':
            return LIKEBTN_ENTITY_BP_ACTIVITY_UPDATE;
        default:
            return LIKEBTN_ENTITY_BP_ACTIVITY_UPDATE;
    }
}
开发者ID:Omuze,项目名称:barakat,代码行数:15,代码来源:likebtn_like_button.php


示例14: bp_activity_can_comment

/**
 * Determine if a comment can be made on an activity item.
 *
 * @since 1.2.0
 *
 * @global object $activities_template {@link BP_Activity_Template}
 *
 * @return bool $can_comment True if item can receive comments.
 */
function bp_activity_can_comment()
{
    global $activities_template;
    $bp = buddypress();
    // Determine ability to comment based on activity type name.
    $activity_type = bp_get_activity_type();
    // Get the 'comment-reply' support for the current activity type.
    $can_comment = bp_activity_type_supports($activity_type, 'comment-reply');
    // Neutralize activity_comment.
    if ('activity_comment' === $activity_type) {
        $can_comment = false;
    }
    /**
     * Filters whether a comment can be made on an activity item.
     *
     * @since 1.5.0
     * @since 2.5.0 Use $activity_type instead of $activity_name for the second parameter.
     *
     * @param bool   $can_comment     Status on if activity can be commented on.
     * @param string $activity_type   Current activity type being checked on.
     */
    return apply_filters('bp_activity_can_comment', $can_comment, $activity_type);
}
开发者ID:CompositeUK,项目名称:clone.BuddyPress,代码行数:32,代码来源:bp-activity-template.php


示例15: bp_follow_activity_get_type

/**
 * Get the follow type associated with an activity item.
 *
 * If no custom follow type is set, falls back to the generic 'activity' type.
 *
 * @param  int $activity_id The activity ID to check.
 * @return string
 */
function bp_follow_activity_get_type($activity_id = 0)
{
    // If in activity loop, use already-queried activity action
    if (!empty($GLOBALS['activities_template']->in_the_loop)) {
        $action = bp_activity_get_action(bp_get_activity_object_name(), bp_get_activity_type());
        // Manually query for the activity action of a given activity item
    } else {
        // Do not do anything if empty
        if (empty($activity_id)) {
            return false;
        }
        $activity = new BP_Activity_Activity($activity_id);
        if (empty($activity->type)) {
            return false;
        }
        $action = bp_activity_get_action($activity->component, $activity->type);
    }
    return isset($action['follow_type']) ? $action['follow_type'] : 'activity';
}
开发者ID:wesavetheworld,项目名称:buddypress-followers,代码行数:27,代码来源:activity-functions.php


示例16: buddyreshare_maybe_replace_delete_link

/**
 * Replaces the activity delete link in case of a reshare type
 *
 * @package BP Reshare
 * @since    1.0
 * 
 * @param  string $delete_link        
 * @uses   bp_get_activity_type() to get activity type
 * @uses   wp_nonce_url() for security reason
 * @uses   bp_get_root_domain() to get the blog's url
 * @uses   bp_get_activity_root_slug() to get the activity slug
 * @uses   buddyreshare_get_component_slug() to get the component's slug
 * @uses   bp_get_activity_id() to get the activity id
 * @return string $delete_link
 */
function buddyreshare_maybe_replace_delete_link($delete_link = '')
{
    if (bp_get_activity_type() == 'reshare_update') {
        $action_url = wp_nonce_url(bp_get_root_domain() . '/' . bp_get_activity_root_slug() . '/' . buddyreshare_get_component_slug() . '/delete/' . bp_get_activity_id() . '/', 'buddyreshare_delete');
        $delete_link = '<a href="' . $action_url . '" class="button item-button bp-secondary-action delete-reshare confirm" rel="nofollow">' . __('Delete', 'bp-reshare') . '</a>';
    }
    return $delete_link;
}
开发者ID:socialray,项目名称:surfied-2-0,代码行数:23,代码来源:filters.php


示例17: swa_activity_entry


//.........这里部分代码省略.........
" class="fav" title="<?php 
            _e('Mark as Favorite', 'swa');
            ?>
"><?php 
            _e('Favorite', 'swa');
            ?>
</a>
		<?php 
        } else {
            ?>
                    <a href="<?php 
            bp_activity_unfavorite_link();
            ?>
" class="unfav" title="<?php 
            _e('Remove Favorite', 'swa');
            ?>
"><?php 
            _e('Remove Favorite', 'swa');
            ?>
</a>
		<?php 
        }
        ?>
            <?php 
    }
    ?>
            <?php 
    do_action('bp_activity_entry_meta');
    ?>
        </div>
	<div class="clear" ></div>
    </div>
    <?php 
    if ('activity_comment' == bp_get_activity_type()) {
        ?>
	<div class="swa-activity-inreplyto">
            <strong><?php 
        _e('In reply to', 'swa');
        ?>
</strong> - <?php 
        bp_activity_parent_content();
        ?>
 &middot;
            <a href="<?php 
        bp_activity_thread_permalink();
        ?>
" class="view" title="<?php 
        _e('View Thread / Permalink', 'swa');
        ?>
"><?php 
        _e('View', 'swa');
        ?>
</a>
	</div>
    <?php 
    }
    ?>
    <?php 
    if (bp_activity_can_comment()) {
        ?>
        <div class="swa-activity-comments">
        	<?php 
        bp_activity_comments();
        ?>
            <?php 
        if (is_user_logged_in()) {
开发者ID:picassentviu,项目名称:AMMPro,代码行数:67,代码来源:bp-sitewide-activity.php


示例18: bp_reshare_check_for_parent_type

function bp_reshare_check_for_parent_type($can_comment)
{
    global $activities_template;
    if ($activities_template->disable_blogforum_replies == 0) {
        return $can_comment;
    }
    if ('reshare_update' != bp_get_activity_type()) {
        return $can_comment;
    } else {
        if (!(int) bp_get_option('bp-reshare-disable-blogforum-comments') || '' == bp_get_option('bp-reshare-disable-blogforum-comments')) {
            return $can_comment;
        }
        /*
         	the activity is a reshare, 
        	Admin wants to disable comments for blogs and forums
        	we now need to check for parent type
        */
        $activity_first_id = bp_get_activity_secondary_item_id();
        $parent_activity = bp_activity_get_specific('activity_ids=' . $activity_first_id);
        if (in_array($parent_activity['activities'][0]->type, array('new_blog_post', 'new_blog_comment', 'new_forum_topic', 'new_forum_post'))) {
            return false;
        } else {
            return $can_comment;
        }
    }
}
开发者ID:KristianI,项目名称:bp-reshare,代码行数:26,代码来源:bp-reshare-filters.php


示例19: bp_get_activity_action_name

/**
 * Returns the activity type
 *
 * Just a wrapper for bp_get_activity_type()
 *
 * @since 1.2.0
 * @deprecated 1.5.0
 *
 * @todo Properly deprecate in favor of bp_get_activity_type()
 *
 * @uses bp_get_activity_type()
 *
 * @return string The activity type
 */
function bp_get_activity_action_name()
{
    return bp_get_activity_type();
}
开发者ID:nxtclass,项目名称:NXTClass,代码行数:18,代码来源:bp-activity-template.php


示例20: GetBuddyPressRating

 private function GetBuddyPressRating($ver, $horAlign = true)
 {
     if (RWLogger::IsOn()) {
         $params = func_get_args();
         RWLogger::LogEnterence("GetBuddyPressRating", $params);
     }
     global $activities_template;
     // Set current activity-comment to current activity update (recursive comments).
     $this->current_comment = $activities_template->activity;
     $rclass = str_replace("_", "-", bp_get_activity_type());
     $is_forum_topic = $rclass === "new-forum-topic";
     if ($is_forum_topic && !$this->IsBBPressInstalled()) {
         return false;
     }
     if ($is_forum_topic) {
         $rclass = "new-forum-post";
     }
     // Check if item rating is top positioned.
     if (!isset($this->activity_align[$rclass]) || $ver !== $this->activity_align[$rclass]->ver) {
         return false;
     }
     // Get item id.
     $item_id = "activity-update" === $rclass || "activity-comment" === $rclass ? bp_get_activity_id() : bp_get_activity_secondary_item_id();
     if ($is_forum_topic) {
         // If forum topic, then we must extract post id
         // from forum posts table, because secondary_item_id holds
         // topic id.
         if (function_exists("bb_get_first_post")) {
             $post = bb_get_first_post($item_id);
         } else {
             // Extract post id straight from the BB DB.
             global $bb_table_prefix;
             // Load bbPress config file.
             @(include_once WP_RW__BBP_CONFIG_LOCATION);
             // Failed loading config file.
             if (!defined("BBDB_NAME")) {
                 return false;
             }
             $connection = null;
             if (!($connection = mysql_connect(BBDB_HOST, BBDB_USER, BBDB_PASSWORD, true))) {
                 return false;
             }
             if (!mysql_selectdb(BBDB_NAME, $connection)) {
                 return false;
             }
             $results = mysql_query("SELECT * FROM {$bb_table_prefix}posts WHERE topic_id={$item_id} AND post_position=1", $connection);
             $post = mysql_fetch_object($results);
         }
         if (!isset($post->post_id) && empty($post->post_id)) {
             return false;
         }
         $item_id = $post->post_id;
     }
     // If the item is post, queue rating with post title.
     $title = "new-blog-post" === $rclass ? get_the_title($item_id) : bp_get_activity_content_body();
     // $activities_template->activity->content;
     $options = array();
     $owner_id = bp_get_activity_user_id();
     // Add accumulator id if user accumulated rating.
     if ($this->IsUserAccumulatedRating()) {
         $options['uarid'] = $this->_getUserRatingGuid($owner_id);
     }
     return $this->EmbedRatingIfVisible($item_id, $owner_id, strip_tags($title), bp_activity_get_permalink(bp_get_activity_id()), $rclass, false, $horAlign ? $this->activity_align[$rclass]->hor : false, false, $options, false);
     /*
             // Queue activity rating.
             $this->QueueRatingData($urid, strip_tags($title), bp_activity_get_permalink($activities_template->activity->id), $rclass);
     
             // Return rating html container.
             return '<div class="rw-ui-container rw-class-' . $rclass . ' rw-urid-' . $urid . '"></div>';*/
 }
开发者ID:panser,项目名称:wandromaha,代码行数:70,代码来源:rating-widget.php



注:本文中的bp_get_activity_type函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP bp_get_activity_user_id函数代码示例发布时间:2022-05-24
下一篇:
PHP bp_get_activity_thread_permalink函数代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap