/** * Returns a trimmed activity content string. * Must be used while inside activity loop */ function buddyboss_global_search_activity_intro($character_limit = 50) { $content = ''; if (bp_activity_has_content()) { $content = bp_get_activity_content_body(); if ($content) { $content = wp_strip_all_tags($content, true); $shortened_content = substr($content, 0, $character_limit); if (strlen($content) > $character_limit) { $shortened_content .= '...'; } $content = $shortened_content; } } return apply_filters('buddyboss_global_search_activity_intro', $content); }
function widget($args, $instance) { global $bp; extract( $args ); echo $before_widget; echo $before_title . $widget_name . $after_title; if ( empty( $instance['max_posts'] ) || !$instance['max_posts'] ) $instance['max_posts'] = 10; ?> <?php if ( bp_has_activities( 'action=new_blog_post&max=' . $instance['max_posts'] . '&per_page=' . $instance['max_posts'] ) ) : ?> <ul id="blog-post-list" class="activity-list item-list"> <?php while ( bp_activities() ) : bp_the_activity(); ?> <li> <div class="activity-content" style="margin: 0"> <div class="activity-header"> <?php bp_activity_action() ?> </div> <?php if ( bp_get_activity_content_body() ) : ?> <div class="activity-inner"> <?php bp_activity_content_body() ?> </div> <?php endif; ?> </div> </li> <?php endwhile; ?> </ul> <?php else : ?> <div id="message" class="info"> <p><?php _e( 'Sorry, there were no blog posts found. Why not write one?', 'buddypress' ) ?></p> </div> <?php endif; ?> <?php echo $after_widget; ?> <?php }
/** * get_activity function. * * @access public * @param mixed $filter * @return void */ public function get_activity($filter) { $args = $filter; if (bp_has_activities($args)) { while (bp_activities()) { bp_the_activity(); $activity = array('avatar' => bp_core_fetch_avatar(array('html' => false, 'item_id' => bp_get_activity_id())), 'action' => bp_get_activity_action(), 'content' => bp_get_activity_content_body(), 'activity_id' => bp_get_activity_id(), 'activity_username' => bp_core_get_username(bp_get_activity_user_id()), 'user_id' => bp_get_activity_user_id(), 'comment_count' => bp_activity_get_comment_count(), 'can_comment' => bp_activity_can_comment(), 'can_favorite' => bp_activity_can_favorite(), 'is_favorite' => bp_get_activity_is_favorite(), 'can_delete' => bp_activity_user_can_delete()); $activity = apply_filters('bp_json_prepare_activity', $activity); $activities[] = $activity; } $data = array('activity' => $activities, 'has_more_items' => bp_activity_has_more_items()); $data = apply_filters('bp_json_prepare_activities', $data); } else { return new WP_Error('bp_json_activity', __('No Activity Found.', 'buddypress'), array('status' => 200)); } $response = new WP_REST_Response(); $response->set_data($data); $response = rest_ensure_response($response); return $response; }
if (bp_get_activity_pagination_links()) { ?> <div class="buddystream_album_navigation"> <?php echo bp_get_activity_pagination_links(); ?> </div> <?php } ?> <div class="buddystream_album"> <?php while (bp_activities()) { bp_the_activity(); $content = strip_tags(bp_get_activity_content_body(), "<a><img>"); echo $content; } ?> </div> <?php if (bp_get_activity_pagination_links()) { ?> <div class="buddystream_album_navigation"> <?php echo bp_get_activity_pagination_links(); ?> </div> <?php }
<?php bp_activity_avatar('type=full&width=100&height=100'); ?> </a> </div> <div class="activity-content"> <div class="activity-header"> <?php bp_activity_action(); ?> </div> <?php if (bp_get_activity_content_body()) { ?> <div class="activity-inner"> <?php bp_activity_content_body(); ?> </div> <?php } ?> <?php do_action('bp_activity_entry_content'); ?> <div class="activity-meta">
/** * Display the networkwide posts widget. * * @see WP_Widget::widget() for description of parameters. * * @param array $args Widget arguments. * @param array $instance Widget settings, as saved by the user. */ public function widget($args, $instance) { $title = !empty($instance['title']) ? esc_html($instance['title']) : __('Recent Networkwide Posts', 'buddypress'); if (!empty($instance['link_title'])) { $title = '<a href="' . bp_get_blogs_directory_permalink() . '">' . esc_html($title) . '</a>'; } /** * Filters the Blogs Recent Posts widget title. * * @since BuddyPress (2.2.0) * @since BuddyPress (2.3.0) Added 'instance' and 'id_base' to arguments passed to filter. * * @param string $title The widget title. * @param array $instance The settings for the particular instance of the widget. * @param string $id_base Root ID for all widgets of this type. */ $title = apply_filters('widget_title', $title, $instance, $this->id_base); echo $args['before_widget']; echo $args['before_title'] . $title . $args['after_title']; if (empty($instance['max_posts']) || empty($instance['max_posts'])) { $instance['max_posts'] = 10; } // Override some of the contextually set parameters for bp_has_activities() $args = array('action' => 'new_blog_post', 'max' => $instance['max_posts'], 'per_page' => $instance['max_posts'], 'user_id' => 0, 'scope' => false, 'object' => false, 'primary_id' => false); ?> <?php if (bp_has_activities($args)) { ?> <ul id="blog-post-list" class="activity-list item-list"> <?php while (bp_activities()) { bp_the_activity(); ?> <li> <div class="activity-content" style="margin: 0"> <div class="activity-header"><?php bp_activity_action(); ?> </div> <?php if (bp_get_activity_content_body()) { ?> <div class="activity-inner"><?php bp_activity_content_body(); ?> </div> <?php } ?> </div> </li> <?php } ?> </ul> <?php } else { ?> <div id="message" class="info"> <p><?php _e('Sorry, there were no posts found. Why not write one?', 'buddypress'); ?> </p> </div> <?php } ?> <?php echo $args['after_widget']; ?> <?php }
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') { $output .= '<a href="' . bp_get_activity_thread_permalink() . '" class="view bp-secondary-action" title="' . __('View Conversation', 'buddypress') . '">' . __('View Conversation', 'buddypress') . '</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', 'buddypress')) . '"></a>'; } else { $output .= '<a href="' . bp_get_activity_unfavorite_link() . '" class="unfav bp-secondary-action" title="' . esc_attr(__('Remove Favorite', 'buddypress')) . '"></a>'; } } if (bp_activity_user_can_delete()) {
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); }
<?php if (bp_has_activities(bpgr_user_previous_review_args())) { while (bp_activities()) { bp_the_activity(); ?> <div class="already-rated"> <h5><?php printf(__("You rated %s on %s.", 'bpgr'), bp_get_group_name(), bpgr_get_activity_date_recorded()); ?> </h5> <blockquote> <?php echo bp_get_activity_content_body(); ?> <div class="rest-stars"> <?php echo bpgr_get_review_rating_html(bpgr_get_review_rating()); ?> </div> </blockquote> <p><?php _e("To leave another review, you must delete your existing review.", 'bpgr'); ?> <?php bp_activity_delete_link();
/** * Return the activity content * * @since 1.0.0 * @deprecated 1.5.0 * * @todo properly deprecate this function * * @global object $activities_template {@link BP_Activity_Template} * @uses bp_get_activity_action() * @uses bp_get_activity_content_body() * @uses apply_filters() To call the 'bp_get_activity_content' hook * * @return string The activity content */ function bp_get_activity_content() { global $activities_template; /** * If you want to filter activity update content, please use * the filter 'bp_get_activity_content_body' * * This function is mainly for backwards comptibility. */ $content = bp_get_activity_action() . ' ' . bp_get_activity_content_body(); return apply_filters('bp_get_activity_content', $content); }
function widget($args, $instance) { extract($args); echo $before_widget; echo $before_title . $widget_name . $after_title; if (empty($instance['max_posts']) || !$instance['max_posts']) { $instance['max_posts'] = 10; } ?> <?php /* Override some of the contextually set parameters for bp_has_activities() */ ?> <?php if (bp_has_activities(array('action' => 'new_blog_post', 'max' => $instance['max_posts'], 'per_page' => $instance['max_posts'], 'user_id' => 0, 'scope' => false, 'object' => false, 'primary_id' => false))) { ?> <ul id="blog-post-list" class="activity-list item-list"> <?php while (bp_activities()) { bp_the_activity(); ?> <li> <div class="activity-content" style="margin: 0"> <div class="activity-header"> <?php bp_activity_action(); ?> </div> <?php if (bp_get_activity_content_body()) { ?> <div class="activity-inner"> <?php bp_activity_content_body(); ?> </div> <?php } ?> </div> </li> <?php } ?> </ul> <?php } else { ?> <div id="message" class="info"> <p><?php _e('Sorry, there were no posts found. Why not write one?', 'buddypress'); ?> </p> </div> <?php } ?> <?php echo $after_widget; ?> <?php }
/** * Display the networkwide posts widget. * * @see WP_Widget::widget() for description of parameters. * * @param array $args Widget arguments. * @param array $instance Widget settings, as saved by the user. */ function widget($args, $instance) { $title = !empty($instance['title']) ? esc_html($instance['title']) : __('Recent Networkwide Posts', 'buddypress'); if (!empty($instance['link_title'])) { $title = '<a href="' . trailingslashit(bp_get_root_domain()) . trailingslashit(bp_get_blogs_root_slug()) . '">' . esc_html($title) . '</a>'; } echo $args['before_widget']; echo $args['before_title'] . $title . $args['after_title']; if (empty($instance['max_posts']) || !$instance['max_posts']) { $instance['max_posts'] = 10; } ?> <?php // Override some of the contextually set parameters for bp_has_activities() ?> <?php if (bp_has_activities(array('action' => 'new_blog_post', 'max' => $instance['max_posts'], 'per_page' => $instance['max_posts'], 'user_id' => 0, 'scope' => false, 'object' => false, 'primary_id' => false))) { ?> <ul id="blog-post-list" class="activity-list item-list"> <?php while (bp_activities()) { bp_the_activity(); ?> <li> <div class="activity-content" style="margin: 0"> <div class="activity-header"> <?php bp_activity_action(); ?> </div> <?php if (bp_get_activity_content_body()) { ?> <div class="activity-inner"> <?php bp_activity_content_body(); ?> </div> <?php } ?> </div> </li> <?php } ?> </ul> <?php } else { ?> <div id="message" class="info"> <p><?php _e('Sorry, there were no posts found. Why not write one?', 'buddypress'); ?> </p> </div> <?php } ?> <?php echo $args['after_widget']; ?> <?php }
/** * @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; }
function BuddystreamShareButton() { $buddyStreamExtensions = new BuddyStreamExtensions(); $shares = array(); foreach ($buddyStreamExtensions->getExtensionsConfigs() as $extension) { if (get_site_option("buddystream_" . $extension['name'] . "_share") == "on") { $shares[] = $extension['name']; } } $shares = implode(',', $shares); echo '<a href="' . BP_BUDDYSTREAM_URL . '/extensions/default/templates/ShareBox.php?content=' . urlencode(strip_tags(bp_get_activity_content_body())) . '&link=' . urlencode(bp_get_activity_thread_permalink()) . '&shares=' . $shares . ' " class="bs_lightbox button item-button">Sharebox!</a>'; }
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>';*/ }
function widget($args, $instance) { global $bp; extract($args); $link_title = !empty($instance['link_title']); echo $before_widget; echo $before_title; if ($link_title) { $dir_link = trailingslashit(bp_get_root_domain()) . trailingslashit(bp_get_blogs_root_slug()); $title = '<a href="' . $dir_link . '">' . $instance['title'] . '</a>'; } else { $title = $instance['title']; } echo $title; echo $after_title; if (empty($instance['max_posts']) || !$instance['max_posts']) { $instance['max_posts'] = 10; } // Load more items that we need, because many will be filtered out by privacy $real_max = $instance['max_posts'] * 10; $counter = 0; $query_string = empty($instance['include_groupblog']) ? 'action=new_blog_post' : 'action=new_blog_post,new_groupblog_post'; $query_string .= '&max=' . $real_max . '&per_page=' . $real_max; if (bp_has_activities($query_string)) { ?> <ul id="blog-post-list" class="activity-list item-list"> <?php while (bp_activities()) { bp_the_activity(); ?> <?php if ($counter >= $instance['max_posts']) { break; } ?> <li> <div class="activity-content" style="margin: 0"> <div class="activity-avatar"> <?php bp_activity_avatar(); ?> </div> <div class="activity-header"> <?php bp_activity_action(); ?> </div> <?php if (bp_get_activity_content_body()) { ?> <?php bp_activity_content_body(); ?> <?php } ?> </div> </li> <?php $counter++; ?> <?php } ?> </ul> <p class="cac-more-link"><a href="<?php bp_blogs_directory_permalink(); ?> ">More Blogs</a></p> <?php } else { ?> <div id="message" class="info"> <p><?php _e('Sorry, there were no blog posts found. Why not write one?', 'buddypress'); ?> </p> </div> <?php } ?> <?php echo $after_widget; ?> <?php }