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); } }
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; }
/** * Limit the display of post type synced comments. * * @since 2.5.0 * * When viewing the synced comments in stream mode, this prevents comments to * be displayed twice, and avoids a Javascript error as the form to add replies * is not available. * * @param int $retval The comment count for the activity. * @return int The comment count, or 0 to hide activity comment replies. */ function bp_blogs_post_type_comments_avoid_duplicates($retval) { /** * Only limit the display when Post type comments are synced with * activity comments. */ if (bp_disable_blogforum_comments()) { return $retval; } if ('activity_comment' !== bp_get_activity_type()) { return $retval; } // Check the parent activity $parent_activity = new BP_Activity_Activity(bp_get_activity_item_id()); if (isset($parent_activity->type) && bp_activity_post_type_get_tracking_arg($parent_activity->type, 'post_type')) { $retval = 0; } return $retval; }
/** * Outputs the activity item id * * @since 1.2.0 * * @uses bp_get_activity_item_id() */ function bp_activity_item_id() { echo bp_get_activity_item_id(); }
</type> <title><?php bp_activity_feed_item_title(); ?> </title> <link><![CDATA[ <?php echo bp_activity_thread_permalink(); ?> ]]></link> <wpPubDate><?php echo mysql2date('D, d M Y H:i:s O', bp_activity_feed_item_date(), false); ?> </wpPubDate> <pubDate><?php echo bebop_feed_date_recorded(bp_get_activity_item_id()); ?> </pubDate> <description><![CDATA[ <?php echo strip_tags(bp_get_activity_feed_item_description(), '<a>'); ?> ]]></description> <?php do_action('bp_activity_personal_feed_item'); ?> </item> <?php } } else { echo 'no "' . bebop_feed_type() . '" data found.';
function activity_correct_ids($args) { $args['id'] = bp_get_activity_id(); $args['id2'] = bp_get_activity_item_id(); return $args; }
/** * 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; }