/** * A wrapper for bp_has_activity * checks if the gallery has associated activity * * @param type $args * @return type */ function mpp_gallery_has_activity($args = null) { $default = array('gallery_id' => mpp_get_current_gallery_id()); $args = wp_parse_args($args, $default); extract($args); $args = array('meta_query' => array(array('key' => '_mpp_gallery_id', 'value' => $gallery_id), array('key' => '_mpp_context', 'value' => 'gallery', 'compare' => '=')), 'type' => 'mpp_media_upload'); return bp_has_activities($args); }
function sp_get_bp_activity_author() { global $activities_template, $bp; bp_has_activities(); // echo "AT: "; // print_r_html( $activities_template ); foreach ($activities_template->activities as $activity) { if ($activity->id == $bp->current_action) { return $activity->display_name; } } }
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 }
function swa_post_update() { global $bp; /* Check the nonce */ check_admin_referer('swa_post_update', '_wpnonce_swa_post_update'); if (!is_user_logged_in()) { echo '-1'; return false; } if (empty($_POST['content'])) { echo '-1<div id="message" class="error"><p>' . __('Please enter some content to post.', 'swa') . '</p></div>'; return false; } if (empty($_POST['object']) && function_exists('bp_activity_post_update')) { $activity_id = bp_activity_post_update(array('content' => $_POST['content'])); } elseif ($_POST['object'] == 'groups') { if (!empty($_POST['item_id']) && function_exists('groups_post_update')) { $activity_id = groups_post_update(array('content' => $_POST['content'], 'group_id' => $_POST['item_id'])); } } else { $activity_id = apply_filters('bp_activity_custom_update', $_POST['object'], $_POST['item_id'], $_POST['content']); } if (!$activity_id) { echo '-1<div id="message" class="error"><p>' . __('There was a problem posting your update, please try again.', 'swa') . '</p></div>'; return false; } $show_avatar = $_POST["show_avatar"] ? $_POST["show_avatar"] : "no"; $show_content = $_POST["show_content"] ? $_POST["show_content"] : "no"; if (bp_has_activities('include=' . $activity_id)) { ?> <?php while (bp_activities()) { bp_the_activity(); ?> <?php swa_activity_entry('show_avatar=' . $show_avatar . '&show_activity_content=' . $show_content); ?> <?php } ?> <?php } exit(0); }
/** * @group groupblog */ public function test_follow_blog_and_groupblog() { if (!is_multisite()) { return; } // save the current user and override logged-in user $old_user = get_current_user_id(); $u = $this->factory->user->create(); $this->set_current_user($u); // create some blogs $b = $this->factory->blog->create(array('title' => 'Groupblog', 'user_id' => $u)); $b2 = $this->factory->blog->create(array('title' => 'Test blog 1', 'user_id' => $u)); $b3 = $this->factory->blog->create(array('title' => 'Test blog 2', 'user_id' => $u)); // create a group and connect a blog $g = $this->factory->group->create(array('creator_id' => $u)); groups_update_groupmeta($g, 'groupblog_blog_id', $b); // follow the groupblog $f = bp_follow_start_following(array('leader_id' => $b, 'follower_id' => $u, 'follow_type' => 'blogs')); // follow a regular blog $f2 = bp_follow_start_following(array('leader_id' => $b2, 'follower_id' => $u, 'follow_type' => 'blogs')); // add some activity items $a = $this->factory->activity->create(array('component' => buddypress()->groups->id, 'type' => 'new_groupblog_post', 'user_id' => $u, 'item_id' => $g, 'secondary_item_id' => 1)); $a2 = $this->factory->activity->create(array('component' => buddypress()->blogs->id, 'type' => 'new_blog_post', 'user_id' => $u, 'item_id' => $b3, 'secondary_item_id' => 1)); $a3 = $this->factory->activity->create(array('component' => buddypress()->blogs->id, 'type' => 'new_blog_post', 'user_id' => $u, 'item_id' => $b2, 'secondary_item_id' => 1)); // fake that we're on a user's "Activity > Followed Sites" page add_filter('bp_ajax_querystring', array($this, 'add_activity_scope_filter')); // fake that BP groupblog is installed so groupblog filter will kick in if (!function_exists('bp_groupblog_init')) { function bp_groupblog_init() { } } // run the activity loop global $activities_template; bp_has_activities(bp_ajax_querystring('activity')); // grab the activity IDs from the loop $ids = wp_list_pluck($activities_template->activities, 'id'); // assert! $this->assertEquals(array($a, $a3), $ids); // reset everything $activities_template = null; $this->set_current_user($old_user); remove_filter('bp_ajax_querystring', array($this, 'add_activity_scope_filter')); }
/** * 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; }
function get_activity() { // Depends on both bbPress and BuddyPress if (!class_exists('bbPress') | !class_exists('BuddyPress')) { return false; } // Try to retrieve the widget from the cache $widget = wp_cache_get('recent_discussion', 'apoc'); if ($widget) { $this->html = $widget; $this->cached = true; } else { // Declare valid actions $actions = array('bbp_topic_create', 'bbp_reply_create', 'new_blog_comment'); // Setup query args $args = array('max' => $this->number, 'action' => implode(',', $actions)); // If topics are found, build the HTML if (bp_has_activities($args)) { $this->html = $this->build_html(); // Store the new HTML in the cache with 1 minute expiration wp_cache_set('recent_discussion', $this->html, 'apoc', 60); } } }
/** * Output the RSS feed. */ protected function output() { $this->http_headers(); echo '<?xml version="1.0" encoding="' . get_option('blog_charset') . '"?' . '>'; ?> <rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" <?php /** * Fires at the end of the opening RSS tag for feed output so plugins can add extra attributes. * * @since 1.8.0 */ do_action('bp_activity_feed_rss_attributes'); ?> > <channel> <title><?php echo $this->title; ?> </title> <link><?php echo $this->link; ?> </link> <atom:link href="<?php self_link(); ?> " rel="self" type="application/rss+xml" /> <description><?php echo $this->description; ?> </description> <lastBuildDate><?php echo mysql2date('D, d M Y H:i:s O', bp_activity_get_last_updated(), false); ?> </lastBuildDate> <generator>https://buddypress.org/?v=<?php bp_version(); ?> </generator> <language><?php bloginfo_rss('language'); ?> </language> <ttl><?php echo $this->ttl; ?> </ttl> <sy:updatePeriod><?php echo $this->update_period; ?> </sy:updatePeriod> <sy:updateFrequency><?php echo $this->update_frequency; ?> </sy:updateFrequency> <?php /** * Fires at the end of channel elements list in RSS feed so plugins can add extra channel elements. * * @since 1.8.0 */ do_action('bp_activity_feed_channel_elements'); ?> <?php if (bp_has_activities($this->activity_args)) { ?> <?php while (bp_activities()) { bp_the_activity(); ?> <item> <guid isPermaLink="false"><?php bp_activity_feed_item_guid(); ?> </guid> <title><?php echo stripslashes(bp_get_activity_feed_item_title()); ?> </title> <link><?php bp_activity_thread_permalink(); ?> </link> <pubDate><?php echo mysql2date('D, d M Y H:i:s O', bp_get_activity_feed_item_date(), false); ?> </pubDate> <?php if (bp_get_activity_feed_item_description()) { ?> <content:encoded><![CDATA[<?php $this->feed_content(); ?> ]]></content:encoded> <?php } ?> <?php if (bp_activity_can_comment()) { ?> <slash:comments><?php bp_activity_comment_count(); ?> </slash:comments> <?php } ?> <?php /** * Fires at the end of the individual RSS Item list in RSS feed so plugins can add extra item elements. * * @since 1.8.0 */ do_action('bp_activity_feed_item_elements'); ?> </item> <?php } ?> <?php } ?> </channel> </rss><?php }
function bebop_manage_oers() { if (bp_is_current_component('bebop') && bp_is_current_action('bebop-manager')) { if (isset($_POST['action'])) { global $wpdb; global $bp; $oer_count = 0; $success = false; //Add OER's to the activity stream. if ($_POST['action'] == 'verify') { foreach (array_keys($_POST) as $oer) { if ($oer != 'action') { $data = bebop_tables::fetch_individual_oer_data($oer); //go and fetch data from the activity buffer table. if (!empty($data->id)) { $should_users_verify_content = bebop_tables::get_option_value('bebop_' . $data->type . '_content_user_verification'); if ($should_users_verify_content != 'no') { global $wpdb; if (!bp_has_activities('action=bebop_oer_plugin&item_id=' . $data->id)) { $new_activity_item = array('user_id' => $data->user_id, 'component' => 'bebop_oer_plugin', 'type' => $data->type, 'action' => $data->action, 'content' => $data->content, 'item_id' => $data->id, 'date_recorded' => $data->date_recorded, 'hide_sitewide' => $data->hide_sitewide); if (bp_activity_add($new_activity_item)) { bebop_tables::update_oer_data($data->id, 'status', 'verified'); bebop_tables::update_oer_data($data->id, 'activity_stream_id', $wpdb->insert_id); $oer_count++; } else { bebop_tables::log_error(__('Activity Stream', 'bebop'), __('Could not update the content status.', 'bebop')); } } else { bebop_tables::log_error(__('Activity Stream', 'bebop'), __('This content already exists in the activity stream.', 'bebop')); } } //End if ( $should_users_verify_content != 'no' ) { } } } //End foreach ( array_keys($_POST) as $oer ) { if ($oer_count > 1) { $success = true; $message = __('Resources verified.', 'bebop'); } else { $success = true; $message = __('Resource verified.', 'bebop'); } } else { if ($_POST['action'] == 'delete') { foreach (array_keys($_POST) as $oer) { if ($oer != 'action') { $data = bebop_tables::fetch_individual_oer_data($oer); //go and fetch data from the activity buffer table. if (!empty($data->id)) { //delete the activity, let the filter update the tables. if (!empty($data->activity_stream_id)) { $should_users_verify_content = bebop_tables::get_option_value('bebop_' . $data->type . '_content_user_verification'); if ($should_users_verify_content != 'no') { bp_activity_delete(array('id' => $data->activity_stream_id)); } } bebop_tables::update_oer_data($data->id, 'status', 'deleted'); $oer_count++; } } } //End foreach ( array_keys( $_POST ) as $oer ) { if ($oer_count > 1) { $success = true; $message = __('Resources deleted.', 'bebop'); } else { $success = true; $message = __('Resource deleted.', 'bebop'); } } else { if ($_POST['action'] == 'undelete') { foreach (array_keys($_POST) as $oer) { $exclude_array = array('action', 'submit'); if (!in_array($oer, $exclude_array)) { $data = bebop_tables::fetch_individual_oer_data($oer); //go and fetch data from the activity buffer table. $should_users_verify_content = bebop_tables::get_option_value('bebop_' . $data->type . '_content_user_verification'); if ($should_users_verify_content != 'no') { bebop_tables::update_oer_data($data->id, 'status', 'unverified'); $oer_count++; } } } if ($oer_count > 1) { $success = true; $message = __('Resources undeleted.', 'bebop'); } else { $success = true; $message = __('Resource undeleted.', 'bebop'); } } } } if ($success) { bp_core_add_message($message); } else { bp_core_add_message(__('We couldnt do that for you. Please try again.', 'bebop'), __('error', 'bebop')); } bp_core_redirect($bp->loggedin_user->domain . bp_current_component() . '/' . bp_current_action()); } //End if ( isset( $_POST['action'] ) ) { } //End if ( bp_is_current_component( 'bebop' ) && bp_is_current_action('bebop-manager' ) ) { add_action('wp_enqueue_scripts', 'bebop_oer_js'); //enqueue selectall/none script }
* @subpackage K Elements * @author SeventhQueen <*****@*****.**> * @since K Elements 1.0 */ extract(shortcode_atts(array('show' => false, 'number' => 6, 'show_button' => 'yes', 'button_link' => '/activity', 'button_label' => 'View All Activity', 'post_form' => ''), $atts)); if (function_exists('bp_is_active') && bp_is_active('activity')) { $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">';
* @subpackage BuddyBoss */ ?> <?php do_action('bp_before_activity_loop'); ?> <?php $qs = bp_ajax_querystring('activity'); global $bp; ?> <?php if (bp_has_activities($qs)) { ?> <?php /* Show pagination if JS is not enabled, since the "Load More" link will do nothing */ ?> <noscript> <div class="pagination"> <div class="pag-count"><?php bp_activity_pagination_count(); ?> </div> <div class="pagination-links"><?php bp_activity_pagination_links(); ?> </div>
<?php /* Querystring is set via AJAX in _inc/ajax.php - bp_dtheme_activity_loop() */ ?> <?php do_action( 'bp_before_activity_loop' ) ?> <?php global $bp; if ( bp_is_active("activity")&&bp_has_activities( "action=gallery_new_comment&show_hidden=1&secondary_id=".$bp->gallery->current_gallery->id ) ) : ?> <?php /* Show pagination if JS is not enabled, since the "Load More" link will do nothing */ ?> <noscript> <div class="pagination"> <div class="pag-count"><?php bp_activity_pagination_count() ?></div> <div class="pagination-links"><?php bp_activity_pagination_links() ?></div> </div> </noscript> <?php if ( is_user_logged_in() ) : ?> <?php locate_template( array( 'gallery/single/media/post-form.php'), true ) ?> <?php endif; ?> <?php if ( empty( $_POST['page'] ) ) : ?> <ul id="activity-stream" class="activity-list item-list"> <?php endif; ?> <?php while ( bp_activities() ) : bp_the_activity(); ?> <?php include( locate_template( array( 'activity/entry.php' ), false ) ) ?> <?php endwhile; ?> <?php if ( bp_get_activity_count() == bp_get_activity_per_page() ) : ?> <li class="load-more"> <a href="#more"><?php _e( 'Load More', 'buddypress' ) ?></a> <span class="ajax-loader"></span>
<language><?php echo get_option('rss_language'); ?> </language> <?php do_action('bp_activity_favorites_feed_head'); ?> <?php $favs = bp_activity_get_user_favorites(bp_displayed_user_id()); $fav_ids = implode(',', (array) $favs); ?> <?php if (bp_has_activities('include=' . $fav_ids . '&max=50&display_comments=stream')) { ?> <?php while (bp_activities()) { bp_the_activity(); ?> <item> <guid><?php bp_activity_thread_permalink(); ?> </guid> <title><?php bp_activity_feed_item_title(); ?> </title>
?> </pubDate> <generator>http://buddypress.org/?v=<?php echo BP_VERSION; ?> </generator> <language><?php echo get_option('rss_language'); ?> </language> <?php do_action('bp_activity_friends_feed_head'); ?> <?php if (bp_has_activities('scope=friends&max=50&display_comments=stream')) { ?> <?php while (bp_activities()) { bp_the_activity(); ?> <item> <guid><?php bp_activity_thread_permalink(); ?> </guid> <title><?php bp_activity_feed_item_title(); ?> </title> <link><?php
?> </pubDate> <generator>http://buddypress.org/?v=<?php echo BP_VERSION; ?> </generator> <language><?php echo get_option('rss_language'); ?> </language> <?php do_action('bp_activity_group_feed_head'); ?> <?php if (bp_has_activities('object=' . $bp->groups->id . '&primary_id=' . $bp->groups->current_group->id . '&max=50&display_comments=threaded')) { ?> <?php while (bp_activities()) { bp_the_activity(); ?> <item> <guid><?php bp_activity_thread_permalink(); ?> </guid> <title><?php bp_activity_feed_item_title(); ?> </title> <link><?php
<div class="activity single-group"> <h3><?php _e('Blog Activity', 'groupblog'); ?> </h3> <?php if (bp_has_activities('per_page=5&object=blogs&primary_id=' . get_groupblog_blog_id(bp_get_group_id()))) { ?> <div class="pagination"> <div class="pag-count"><?php bp_activity_pagination_count(); ?> </div> <div class="pagination-links"><?php bp_activity_pagination_links(); ?> </div> </div> <?php if (empty($_POST['page'])) { ?> <ul id="activity-stream" class="activity-list item-list"> <?php } ?> <?php
/** * Integration test for 'date_query' param * * @group date_query * @requires PHP 5.3 */ function test_bp_has_activities_with_date_query() { if (!class_exists('WP_Date_Query')) { return; } $a1 = $this->factory->activity->create(); $a2 = $this->factory->activity->create(array('recorded_time' => '2001-01-01 12:00')); $a3 = $this->factory->activity->create(array('recorded_time' => '2005-01-01 12:00')); global $activities_template; bp_has_activities(array('date_query' => array(array('after' => '1 day ago')))); $ids = wp_list_pluck($activities_template->activities, 'id'); $this->assertEquals($ids, array($a1)); }
?> </pubDate> <generator>http://buddypress.org/?bp-activity-version=<?php echo BP_ACTIVITY_VERSION; ?> </generator> <language><?php echo get_option('rss_language'); ?> </language> <?php do_action('bp_activity_sitewide_feed_head'); ?> <?php if (bp_has_activities('type=sitewide&max=50')) { ?> <?php while (bp_activities()) { bp_the_activity(); ?> <item> <title><![CDATA[<?php bp_activity_feed_item_title(); ?> ]]></title> <link><?php echo bp_activity_feed_item_link(); ?> </link> <pubDate><?php
/** * Output the RSS feed. */ protected function output() { // set up some additional headers if not on a directory page // this is done b/c BP uses pseudo-pages if (!bp_is_directory()) { global $wp_query; $wp_query->is_404 = false; status_header(200); } header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true); echo '<?xml version="1.0" encoding="' . get_option('blog_charset') . '"?' . '>'; ?> <rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" <?php do_action('bp_activity_feed_rss_attributes'); ?> > <channel> <title><?php echo $this->title; ?> </title> <link><?php echo $this->link; ?> </link> <atom:link href="<?php self_link(); ?> " rel="self" type="application/rss+xml" /> <description><?php echo $this->description; ?> </description> <lastBuildDate><?php echo mysql2date('D, d M Y H:i:s O', bp_activity_get_last_updated(), false); ?> </lastBuildDate> <generator>http://buddypress.org/?v=<?php bp_version(); ?> </generator> <language><?php bloginfo_rss('language'); ?> </language> <ttl><?php echo $this->ttl; ?> </ttl> <sy:updatePeriod><?php echo $this->update_period; ?> </sy:updatePeriod> <sy:updateFrequency><?php echo $this->update_frequency; ?> </sy:updateFrequency> <?php do_action('bp_activity_feed_channel_elements'); ?> <?php if (bp_has_activities($this->activity_args)) { ?> <?php while (bp_activities()) { bp_the_activity(); ?> <item> <guid isPermaLink="false"><?php bp_activity_feed_item_guid(); ?> </guid> <title><?php echo stripslashes(bp_get_activity_feed_item_title()); ?> </title> <link><?php bp_activity_thread_permalink(); ?> </link> <pubDate><?php echo mysql2date('D, d M Y H:i:s O', bp_get_activity_feed_item_date(), false); ?> </pubDate> <?php if (bp_get_activity_feed_item_description()) { ?> <content:encoded><![CDATA[<?php $this->feed_content(); ?> ]]></content:encoded> <?php } ?> <?php if (bp_activity_can_comment()) { ?> <slash:comments><?php bp_activity_comment_count(); ?> </slash:comments> <?php } ?> <?php do_action('bp_activity_feed_item_elements'); ?> </item> <?php } ?> <?php } ?> </channel> </rss><?php }
/** * Posts new Activity comments received via a POST request. * * @global BP_Activity_Template $activities_template * @return string HTML * @since BuddyPress (1.2) */ function bp_legacy_theme_new_activity_comment() { global $activities_template; $bp = buddypress(); // Bail if not a POST action if ('POST' !== strtoupper($_SERVER['REQUEST_METHOD'])) { return; } // Check the nonce check_admin_referer('new_activity_comment', '_wpnonce_new_activity_comment'); if (!is_user_logged_in()) { exit('-1'); } $feedback = __('There was an error posting your reply. Please try again.', 'buddypress'); if (empty($_POST['content'])) { exit('-1<div id="message" class="error bp-ajax-message"><p>' . esc_html__('Please do not leave the comment area blank.', 'buddypress') . '</p></div>'); } if (empty($_POST['form_id']) || empty($_POST['comment_id']) || !is_numeric($_POST['form_id']) || !is_numeric($_POST['comment_id'])) { exit('-1<div id="message" class="error bp-ajax-message"><p>' . esc_html($feedback) . '</p></div>'); } $comment_id = bp_activity_new_comment(array('activity_id' => $_POST['form_id'], 'content' => $_POST['content'], 'parent_id' => $_POST['comment_id'])); if (!$comment_id) { if (!empty($bp->activity->errors['new_comment']) && is_wp_error($bp->activity->errors['new_comment'])) { $feedback = $bp->activity->errors['new_comment']->get_error_message(); unset($bp->activity->errors['new_comment']); } exit('-1<div id="message" class="error bp-ajax-message"><p>' . esc_html($feedback) . '</p></div>'); } // Load the new activity item into the $activities_template global bp_has_activities('display_comments=stream&hide_spam=false&show_hidden=true&include=' . $comment_id); // Swap the current comment with the activity item we just loaded if (isset($activities_template->activities[0])) { $activities_template->activity = new stdClass(); $activities_template->activity->id = $activities_template->activities[0]->item_id; $activities_template->activity->current_comment = $activities_template->activities[0]; // Because the whole tree has not been loaded, we manually // determine depth $depth = 1; $parent_id = (int) $activities_template->activities[0]->secondary_item_id; while ($parent_id !== (int) $activities_template->activities[0]->item_id) { $depth++; $p_obj = new BP_Activity_Activity($parent_id); $parent_id = (int) $p_obj->secondary_item_id; } $activities_template->activity->current_comment->depth = $depth; } // get activity comment template part bp_get_template_part('activity/comment'); unset($activities_template); exit; }
?> <?php } ?> <?php if (function_exists('bp_activity_install')) { ?> <div class="info-group"> <h4><?php echo bp_word_or_name(__("My Activity", 'buddypress'), __("%s's Activity", 'buddypress'), true, false); ?> </h4> <?php if (bp_has_activities('type=personal&max=5')) { ?> <div id="activity-rss"> <p><a href="<?php bp_activities_member_rss_link(); ?> " title="<?php _e('RSS Feed', 'buddypress'); ?> "><?php _e('RSS Feed', 'buddypress'); ?> </a></p> </div>
/** * BuddyPress - Activity Loop * * Querystring is set via AJAX in _inc/ajax.php - bp_dtheme_object_filter() * * @package BuddyPress * @subpackage bp-default */ ?> <?php do_action('bp_before_activity_loop'); ?> <?php if (bp_has_activities(bp_ajax_querystring('activity'))) { ?> <?php /* Show pagination if JS is not enabled, since the "Load More" link will do nothing */ ?> <noscript> <div class="pagination"> <div class="pag-count"><?php bp_activity_pagination_count(); ?> </div> <div class="pagination-links"><?php bp_activity_pagination_links(); ?> </div>
/** * 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 }
<h3><?php _e('Youtube Album', 'buddystream_youtube'); ?> </h3> <?php if (bp_has_activities('object=youtube&per_page=35')) { ?> <?php 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
function bp_dtheme_new_activity_comment() { global $bp; // Check the nonce check_admin_referer('new_activity_comment', '_wpnonce_new_activity_comment'); if (!is_user_logged_in()) { echo '-1'; return false; } if (empty($_POST['content'])) { echo '-1<div id="message" class="error"><p>' . __('Please do not leave the comment area blank.', 'buddypress') . '</p></div>'; return false; } if (empty($_POST['form_id']) || empty($_POST['comment_id']) || !is_numeric($_POST['form_id']) || !is_numeric($_POST['comment_id'])) { echo '-1<div id="message" class="error"><p>' . __('There was an error posting that reply, please try again.', 'buddypress') . '</p></div>'; return false; } $comment_id = bp_activity_new_comment(array('activity_id' => $_POST['form_id'], 'content' => $_POST['content'], 'parent_id' => $_POST['comment_id'])); if (!$comment_id) { echo '-1<div id="message" class="error"><p>' . __('There was an error posting that reply, please try again.', 'buddypress') . '</p></div>'; return false; } global $activities_template; // Load the new activity item into the $activities_template global bp_has_activities('display_comments=stream&include=' . $comment_id); // Swap the current comment with the activity item we just loaded $activities_template->activity->id = $activities_template->activities[0]->item_id; $activities_template->activity->current_comment = $activities_template->activities[0]; gconnect_locate_template(array('activity/comment.php'), true); unset($activities_template); }
<div class="activity no-ajax"> <?php if (bp_has_activities('display_comments=threaded&include=' . bp_current_action())) { ?> <ul id="activity-stream" class="activity-list item-list"> <?php while (bp_activities()) { bp_the_activity(); ?> <?php /*locate_template( array( 'activity/entry.php' ), true )*/ global $buddy_boss_wall, $bp; ?> <?php do_action('bp_before_activity_entry'); ?> <li class="<?php bp_activity_css_class(); ?> " id="activity-<?php bp_activity_id(); ?> "> <div class="activity-content"> <div class="activity-header">
<?php get_header('wplms_modern'); ?> <?php do_action('template_notices'); ?> <div class="activity no-ajax" role="main"> <?php if (bp_has_activities('display_comments=threaded&show_hidden=true&include=' . bp_current_action())) { ?> <ul id="activity-stream" class="activity-list item-list"> <?php while (bp_activities()) { bp_the_activity(); ?> <?php locate_template(array('activity/entry.php'), true); ?> <?php } ?> </ul> <?php }
function bp_dtheme_new_activity_comment() { // Bail if not a POST action if ('POST' !== strtoupper($_SERVER['REQUEST_METHOD'])) { return; } // Check the nonce check_admin_referer('new_activity_comment', '_nxtnonce_new_activity_comment'); if (!is_user_logged_in()) { echo '-1'; return false; } if (empty($_POST['content'])) { echo '-1<div id="message" class="error"><p>' . __('Please do not leave the comment area blank.', 'buddypress') . '</p></div>'; return false; } if (empty($_POST['form_id']) || empty($_POST['comment_id']) || !is_numeric($_POST['form_id']) || !is_numeric($_POST['comment_id'])) { echo '-1<div id="message" class="error"><p>' . __('There was an error posting that reply, please try again.', 'buddypress') . '</p></div>'; return false; } $comment_id = bp_activity_new_comment(array('activity_id' => $_POST['form_id'], 'content' => $_POST['content'], 'parent_id' => $_POST['comment_id'])); if (!$comment_id) { echo '-1<div id="message" class="error"><p>' . __('There was an error posting that reply, please try again.', 'buddypress') . '</p></div>'; return false; } global $activities_template; // Load the new activity item into the $activities_template global bp_has_activities('display_comments=stream&include=' . $comment_id); // Swap the current comment with the activity item we just loaded $activities_template->activity->id = $activities_template->activities[0]->item_id; $activities_template->activity->current_comment = $activities_template->activities[0]; $template = locate_template('activity/comment.php', false, false); // Backward compatibility. In older versions of BP, the markup was // generated in the PHP instead of a template. This ensures that // older themes (which are not children of bp-default and won't // have the new template) will still work. if (empty($template)) { $template = BP_PLUGIN_DIR . '/bp-themes/bp-default/activity/comment.php'; } load_template($template, false); unset($activities_template); }
<?php do_action('bp_before_activity_loop'); ?> <?php if (bp_has_activities('object=groups&primary_id=' . bp_get_group_id())) { ?> <?php /* Show pagination if JS is not enabled, since the "Load More" link will do nothing */ ?> <noscript> <div class="pagination"> <div class="pag-count"><?php bp_activity_pagination_count(); ?> </div> <div class="pagination-links"><?php bp_activity_pagination_links(); ?> </div> </div> </noscript> <?php if (empty($_POST['page'])) { ?> <ul id="activity-stream" class="activity-list item-list"> <?php }
function widget($args, $instance) { extract($args); echo $before_widget; echo $before_title . 'Posts' . $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> </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 }