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 } }
/** * Outputs the activity object name * * @since 1.2.0 * * @uses bp_get_activity_object_name() */ function bp_activity_object_name() { echo bp_get_activity_object_name(); }
/** * 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'; }
/** * Append the featured image for the activity excerpt. * * @since 1.0.5 * @package GeoDirectory_BuddyPress_Integration * * @param string $excerpt The appended text for the activity excerpt. * @return string The activity excerpt. */ function geodir_buddypress_bp_activity_featured_image($excerpt = '') { $activity_name = bp_get_activity_object_name(); $activity_type = bp_get_activity_type(); $item_id = bp_get_activity_secondary_item_id(); if ($activity_name == 'activity' && $item_id > 0 && $activity_type == 'new_' . get_post_type($item_id) && get_option('geodir_buddypress_show_feature_image')) { $image = wp_get_attachment_image_src(get_post_thumbnail_id($item_id)); if (!empty($image) && !empty($image[0])) { $listing_title = geodir_get_post_meta($item_id, 'post_title', true); $featured_image = '<a class="gdbp-feature-image" href="' . get_permalink($item_id) . '" title="' . esc_attr($listing_title) . '"><img alt="' . esc_attr($listing_title) . '" src="' . $image[0] . '" /></a>'; /** * Filter the new listing featured image in activity. * * @since 1.0.5 * * @param string $featured_image Featured image content. * @param int $item_id Activity item id. * @param string $activity_name Current activity name. * @param string $activity_type Current activity type. */ $featured_image = apply_filters('geodir_buddypress_bp_activity_featured_image', $featured_image, $item_id, $activity_name, $activity_type); echo $featured_image; } } return $excerpt; }
/** * 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; }