$output = ''; $params = array('max' => $number, 'object' => $show); $output .= '<div class="wpb_wrapper">'; $output .= '<div class="activity kleo-activity-streams">'; if (is_user_logged_in() && $post_form == 'yes') { ob_start(); bp_get_template_part('activity/post-form'); $output .= ob_get_clean(); } if (bp_has_activities($params)) { $output .= '<ul id="activity-stream" class="activity-list item-list">'; while (bp_activities()) { bp_the_activity(); $output .= '<li class="' . bp_get_activity_css_class() . '" id="activity-' . bp_get_activity_id() . '">'; $output .= '<div class="activity-avatar rounded">'; $output .= '<a class="kleo-activity-avatar" title="' . __('View Profile', 'kleo_framework') . '" href="' . bp_get_activity_user_link() . '">'; $output .= bp_get_activity_avatar(); $output .= '</a>'; $output .= '</div>'; // activity content $output .= '<div class="activity-content">'; $output .= '<div class="activity-header">'; $output .= bp_get_activity_action(); $output .= '</div>'; $output .= '<div class="activity-inner">'; if (bp_activity_has_content()) { $output .= bp_get_activity_content_body(); } $output .= '</div>'; $output .= '<div class="activity-meta">'; if (bp_get_activity_type() == 'activity_comment') {
function add_stream_facebooklike_button() { $permalink = bp_get_activity_thread_permalink(); if (preg_match('#/p/(\\d+)/?#i', $permalink, $matches)) { $permalink = bp_get_activity_user_link() . bp_get_activity_slug() . '/' . $matches[1] . '/'; } if (is_user_logged_in()) { ?> <div style="margin: 14px 0px; float:left; width: 100%; clear:both;"> <div class="fb-like" data-href="<?php echo esc_attr($permalink); ?> " data-send="false" data-width="450" data-show-faces="true"></div> </div> <?php } }
/** * Outputs the activity user link * * @since 1.2.0 * * @uses bp_get_activity_user_link() */ function bp_activity_user_link() { echo bp_get_activity_user_link(); }
/** * Do widget framework. * * @param array $instance The settings for the particular instance of the widget. */ public static function framework($instance) { global $gs_counter, $processed_activities; genesis_markup(array('html5' => '<article %s>', 'xhtml' => sprintf('<div class="%s">', implode(' ', get_post_class())), 'context' => 'entry')); $settings = get_option('widget_featured-content'); if (!isset($settings[3]['buddypress-group']) || 1 != $settings[3]['buddypress-group']) { GS_Featured_Content::action('thememixfc_before_post_content', $instance); GS_Featured_Content::action('thememixfc_post_content', $instance); GS_Featured_Content::action('thememixfc_after_post_content', $instance); } else { if (!isset($processed_activities)) { $processed_activities = array(); } $group_id = $settings[3]['buddypress-group-group']; if (bp_has_activities(bp_ajax_querystring('activity') . '&primary_id=' . $group_id)) { while (bp_activities()) { bp_the_activity(); $url = trailingslashit(bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/' . $group->slug . '/'); $fontawesome_position = $settings[3]['fontawesome-position']; $activity_id = bp_get_activity_id(); if (!in_array($activity_id, $processed_activities) && !isset($done)) { // Get image HTML if (isset($settings[3]['show_image']) && 1 == $settings[3]['show_image']) { $size = $settings[3]['image_size']; $image_html = bp_get_activity_avatar('type=' . $size); // Add image link to image HTML if (isset($settings[3]['link_image']) && 1 == $settings[3]['link_image']) { $image_html = '<a href="' . esc_attr(bp_get_activity_user_link()) . '">' . $image_html . '</a>'; } } echo ' <article itemscope="itemscope" itemtype="http://schema.org/Event">'; if (isset($settings[3]['image_position']) && 'before-title' == $settings[3]['image_position']) { echo $image_html; } if ('before_title' == $fontawesome_position) { echo thememixfc_span_fontawesome(); } echo ' <h2 class="entry-title">'; if ('inline_before_title' == $fontawesome_position) { echo thememixfc_span_fontawesome(); } echo ' <a href="' . esc_url($url) . '" title="' . esc_attr($group->name) . '">' . esc_html($group->name) . '</a>'; if ('inline_after_title' == $fontawesome_position) { echo thememixfc_span_fontawesome(); } echo ' </h2>'; if ('after_title' == $fontawesome_position) { echo thememixfc_span_fontawesome(); } if (isset($settings[3]['image_position']) && 'after-title' == $settings[3]['image_position']) { echo $image_html; } if (bp_activity_has_content()) { bp_activity_content_body(); } if (isset($settings[3]['image_position']) && 'after-content' == $settings[3]['image_position']) { echo $image_html; } echo ' </article>'; $processed_activities[] = $activity_id; $done = true; } } } } $gs_counter++; genesis_markup(array('html5' => '</article>', 'xhtml' => '</div>')); }
/** * @deprecated gears_get_activity_stream */ function gears_get_activity_stream() { $output = ''; $output .= '<li class="' . bp_get_activity_css_class() . '" id="activity-' . bp_get_activity_id() . '">'; $output .= '<div class="activity-avatar">'; $output .= '<a class="gears-activity-avatar" title="' . __('View Profile', 'gears') . '" href="' . bp_get_activity_user_link() . '">'; $output .= bp_get_activity_avatar(); $output .= '</a>'; $output .= '</div>'; // activity content $output .= '<div class="activity-content">'; $output .= '<div class="activity-header">'; $output .= bp_get_activity_action(); $output .= '</div>'; $output .= '<div class="activity-inner">'; if (bp_activity_has_content()) { $output .= bp_get_activity_content_body(); } $output .= '</div>'; do_action('bp_activity_entry_content'); $output .= '<div class="activity-meta">'; if (bp_get_activity_type() == 'activity_comment') { $output .= '<a href="' . bp_get_activity_thread_permalink() . '" class="view bp-secondary-action" title="' . __('View Conversation', 'gears') . '">' . __('View Conversation', 'gears') . '</a>'; } if (is_user_logged_in()) { if (bp_activity_can_favorite()) { if (!bp_get_activity_is_favorite()) { $output .= '<a href="' . bp_get_activity_favorite_link() . '" class="fav bp-secondary-action" title="' . esc_attr(__('Mark as Favorite', 'gears')) . '">' . __('Favorite', 'gears') . '</a>'; } else { $output .= '<a href="' . bp_get_activity_unfavorite_link() . '" class="unfav bp-secondary-action" title="' . esc_attr(__('Remove Favorite', 'gears')) . '">' . __('Remove Favorite', 'gears') . '</a>'; } } if (bp_activity_user_can_delete()) { $output .= bp_get_activity_delete_link(); } do_action('bp_activity_entry_meta'); } $output .= '</div>'; if (bp_get_activity_type() == 'activity_comment') { $output .= '<a href="' . bp_get_activity_thread_permalink() . '" class="view bp-secondary-action" title="' . __('View Conversation', 'gears') . '">' . __('View Conversation', 'gears'); } // end bp_get_activity_type() $output .= '</div>'; // end activity content $output .= '</li>'; return $output; }
* each activity. * * @package BuddyPress * @subpackage bp-legacy */ global $bp, $wpdb, $activities_template; if (bp_activity_has_content()) { $bp->avatar->thumb->width = 75; $bp->avatar->thumb->width = 75; $postedBy = false; $skip = false; $activity_id = bp_get_activity_id(); $group_id = $wpdb->get_var("SELECT item_id FROM wp_bp_activity WHERE id={$activity_id}"); $group_id = intval($group_id); if ($group_id === 0 || $bp->current_component == 'groups' || $bp->current_component == 'activity' && $bp->current_action != 'just-me') { $link = bp_get_activity_user_link(); $avatar = bp_get_activity_avatar(); $user_id = $wpdb->get_var("SELECT user_id FROM wp_bp_activity WHERE id={$activity_id}"); $user_data = get_userdata($user_id); $name = $user_data->first_name . ' ' . $user_data->last_name; $img_class = 'round'; } else { $avatar = bp_core_fetch_avatar(array('item_id' => $group_id, 'object' => 'group', 'width' => 75, 'height' => 75)); $link = '/teams/' . $wpdb->get_var("SELECT slug FROM wp_bp_groups WHERE id={$group_id}"); $name = $wpdb->get_var("SELECT name FROM wp_bp_groups WHERE id={$group_id}"); $img_class = ''; } $date = date("F jS, Y", strtotime($activities_template->activity->date_recorded)); $otheruser = false; $regex_url = '/<a\\s[^>]*href=(\\"??)([^\\" >]*?)\\1[^>]*>@(.*)<\\/a>/siU'; $regex_username = '******';
function themefix_buddypress_groups_widget($settings, $key, $group) { global $gs_counter, $processed_activities; if (!isset($processed_activities)) { $processed_activities = array(); } $group_id = $settings[$key]['buddypress-group-group']; $group = groups_get_group(array('group_id' => $group_id)); if (bp_has_activities(bp_ajax_querystring('activity') . '&primary_id=' . $group_id)) { while (bp_activities()) { bp_the_activity(); $url = trailingslashit(bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/' . $group->slug . '/'); $fontawesome_position = $settings[$key]['fontawesome-position']; $activity_id = bp_get_activity_id(); if (!in_array($activity_id, $processed_activities) && !isset($done)) { // Get image HTML if (isset($settings[$key]['show_image']) && 1 == $settings[$key]['show_image']) { $size = $settings[$key]['image_size']; $image_html = bp_get_activity_avatar('type=' . $size); // Add image link to image HTML if (isset($settings[$key]['link_image']) && 1 == $settings[$key]['link_image']) { if ('' == $settings[$key]['gravatar_alignment']) { $alignment = 'alignnone'; } else { $alignment = $settings[$key]['gravatar_alignment']; } $image_html = '<a href="' . esc_attr(bp_get_activity_user_link()) . '"><span class="' . esc_attr($alignment) . '">' . $image_html . '</span></a>'; } } echo ' <article itemscope="itemscope" itemtype="http://schema.org/Event">'; if (isset($settings[$key]['image_position']) && 'before-title' == $settings[$key]['image_position']) { echo $image_html; } if ('before_title' == $fontawesome_position) { thememix_featured_content_span_fontawesome($key); } echo ' <h2 class="entry-title">'; echo ' <a href="' . esc_url($url) . '" title="' . esc_attr($group->name) . '">'; if ('inline_before_title' == $fontawesome_position) { thememix_featured_content_span_fontawesome($key, true); echo ' '; } echo esc_html($group->name); if ('inline_after_title' == $fontawesome_position) { echo ' '; thememix_featured_content_span_fontawesome($key, true); } echo '</a>'; echo ' </h2>'; if ('after_title' == $fontawesome_position) { thememix_featured_content_span_fontawesome($key); } if (isset($settings[$key]['image_position']) && 'after-title' == $settings[$key]['image_position']) { echo $image_html; } if (bp_activity_has_content()) { bp_activity_content_body(); } if (isset($settings[$key]['image_position']) && 'after-content' == $settings[$key]['image_position']) { echo $image_html; } echo ' </article>'; $processed_activities[] = $activity_id; $done = true; } } } }
/** * 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; }