/** * Fetches Activity for rtmedia updates, if user id for activity is provided fetches the user specific rtmedia updates * @global type $activities_template * @param type $activity_user_id * @param type $activity_id * @return array(), Activity data */ function rtmedia_api_get_feed($activity_user_id = FALSE, $activity_id = FALSE, $per_page = 10) { global $activities_template, $rtmediajsonapi; $activity_feed = array(); extract($_REQUEST); $i = 0; $args = array('user_id' => $activity_user_id, 'action' => '', 'page' => !empty($_REQUEST['page']) ? $_REQUEST['page'] : 1, 'per_page' => $per_page, 'in' => $activity_id); if (bp_has_activities($args)) { $activity_feed['total_activity_count'] = $activities_template->total_activity_count; $activity_feed['total'] = ceil((int) $activities_template->total_activity_count / (int) $activities_template->pag_num); $activity_feed['current'] = $activities_template->pag_page; while (bp_activities()) { bp_the_activity(); //Activity basic details $activity_feed[$i]['id'] = $activities_template->activity->id; $activity_feed[$i]['activity_type'] = $activities_template->activity->type; $activity_feed[$i]['activity_time'] = bp_get_activity_date_recorded(); $activity_feed[$i]['activity_time_human'] = strip_tags(bp_insert_activity_meta('')); $activity_feed[$i]['activity_content'] = $activities_template->activity->content; //activity User if (!$activity_user_id) { //Activity User data $activity_feed[$i]['user'] = $this->rtmedia_api_user_data_from_id(bp_get_activity_user_id()); } //Media Details if (class_exists("RTMediaModel")) { $model = new RTMediaModel(); $media = $model->get_by_activity_id($activities_template->activity->id); if (isset($media['result']) && count($media['result']) > 0) { //Create media array $media = $this->rtmedia_api_media_details($media['result']); } else { $media = false; } } if ($activity_id) { //Activity Comment Count $id = $media[0]['id']; $activity_feed[$i]['comments'] = $this->rtmedia_api_get_media_comments($id); } //Activity Image $activity_feed[$i]['media'] = $media; $i++; } } return $activity_feed; }
/** * Post a gallery or media Main comment on single page * * @return type */ public function post_comment() { // Bail if not a POST action if ('POST' !== strtoupper($_SERVER['REQUEST_METHOD'])) { return; } // Check the nonce check_admin_referer('post_update', '_wpnonce_post_update'); if (!is_user_logged_in()) { exit('-1'); } $mpp_type = $_POST['mpp-type']; $mpp_id = $_POST['mpp-id']; if (empty($_POST['content'])) { exit('-1<div id="message" class="error"><p>' . __('Please enter some content to post.', 'mediapress') . '</p></div>'); } $activity_id = 0; if (empty($_POST['object']) && bp_is_active('activity')) { //we are preventing this comment to be set as the user's lastes_update $user_id = bp_loggedin_user_id(); $old_latest_update = bp_get_user_meta($user_id, 'bp_latest_update', true); $activity_id = bp_activity_post_update(array('content' => $_POST['content'])); //restore if (!empty($old_latest_update)) { bp_update_user_meta($user_id, 'bp_latest_update', $old_latest_update); } } elseif ($_POST['object'] == 'groups') { if (!empty($_POST['item_id']) && bp_is_active('groups')) { $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 (empty($activity_id)) { exit('-1<div id="message" class="error"><p>' . __('There was a problem posting your update, please try again.', 'mediapress') . '</p></div>'); } //if we have got activity id, let us add a meta key if ($mpp_type == 'gallery') { mpp_activity_update_gallery_id($activity_id, $mpp_id); } elseif ($mpp_type == 'media') { mpp_activity_update_media_id($activity_id, $mpp_id); } $activity = new BP_Activity_Activity($activity_id); // $activity->component = buddypress()->mediapress->id; $activity->type = 'mpp_media_upload'; $activity->save(); if (bp_has_activities('include=' . $activity_id)) { while (bp_activities()) { bp_the_activity(); mpp_locate_template(array('activity/entry.php'), true); } } exit; }
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 }
/** * Test if a non-admin can delete their own activity. */ public function test_user_can_delete_for_nonadmin() { // 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 an activity update for the user $this->factory->activity->create(array('component' => buddypress()->activity->id, 'type' => 'activity_update', 'user_id' => $u)); // start the activity loop bp_has_activities(array('user_id' => $u)); while (bp_activities()) { bp_the_activity(); // assert! $this->assertTrue(bp_activity_user_can_delete()); } // reset $this->set_current_user($old_user); }
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); }
/** * 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 devb_aawire_post_update() { global $bp; $is_wire_post = false; /* Check the nonce */ check_admin_referer('post_update', '_wpnonce_post_update'); if (!is_user_logged_in()) { echo '-1'; exit(0); } if (empty($_POST['content'])) { echo '-1<div id="message"><p>' . __('Please enter some content to post.', 'buddypress') . '</p></div>'; exit(0); } if (empty($_POST['object']) && function_exists('bp_activity_post_update')) { //this is what I have changed if (!bp_is_my_profile() && bp_is_user()) { $content = '@' . bp_get_displayed_user_username() . ' ' . $_POST['content']; $is_wire_post = true; } else { $content = $_POST['content']; } //let us get the last activity id, we will use it to reset user's last activity $last_update = bp_get_user_meta(bp_loggedin_user_id(), 'bp_latest_update', true); if ($is_wire_post) { add_filter('bp_activity_new_update_action', 'devb_aawire_filter_action'); } $activity_id = bp_activity_post_update(array('content' => $content)); if ($is_wire_post) { remove_filter('bp_activity_new_update_action', 'devb_aawire_filter_action'); //add activity meta to remember that it was a wire post and we may use it in future if ($activity_id) { bp_activity_update_meta($activity_id, 'is_wire_post', 1); } //let us remember it for future //for 2.0 Let us add the mentioned user in the meta, so in future if we plan eo extend the wall beyond mention, we can do that easily bp_activity_update_meta($activity_id, 'wire_user_id', bp_displayed_user_id()); //let us remember it for future } //reset the last update bp_update_user_meta(get_current_user_id(), 'bp_latest_update', $last_update); //end of my changes } 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"><p>' . __('There was a problem posting your update, please try again.', 'buddypress') . '</p></div>'; exit(0); } if (bp_has_activities('include=' . $activity_id)) { ?> <?php while (bp_activities()) { bp_the_activity(); ?> <?php bp_locate_template(array('activity/entry.php'), true); ?> <?php } ?> <?php } exit(0); }
/** * Use WordPress Heartbeat API to check for latest activity update. * * @since 2.0.0 * * @uses bp_activity_get_last_updated() to get the recorded date of the last activity. * * @param array $response Array containing Heartbeat API response. * @param array $data Array containing data for Heartbeat API response. * @return array $response */ function bp_activity_heartbeat_last_recorded($response = array(), $data = array()) { if (empty($data['bp_activity_last_recorded'])) { return $response; } // Use the querystring argument stored in the cookie (to preserve // filters), but force the offset to get only new items. $activity_latest_args = bp_parse_args(bp_ajax_querystring('activity'), array('since' => date('Y-m-d H:i:s', $data['bp_activity_last_recorded'])), 'activity_latest_args'); if (!empty($data['bp_activity_last_recorded_search_terms']) && empty($activity_latest_args['search_terms'])) { $activity_latest_args['search_terms'] = addslashes($data['bp_activity_last_recorded_search_terms']); } $newest_activities = array(); $last_activity_recorded = 0; // Temporarily add a just-posted class for new activity items. add_filter('bp_get_activity_css_class', 'bp_activity_newest_class', 10, 1); ob_start(); if (bp_has_activities($activity_latest_args)) { while (bp_activities()) { bp_the_activity(); $atime = strtotime(bp_get_activity_date_recorded()); if ($last_activity_recorded < $atime) { $last_activity_recorded = $atime; } bp_get_template_part('activity/entry'); } } $newest_activities['activities'] = ob_get_contents(); $newest_activities['last_recorded'] = $last_activity_recorded; ob_end_clean(); // Remove the temporary filter. remove_filter('bp_get_activity_css_class', 'bp_activity_newest_class', 10, 1); if (!empty($newest_activities['last_recorded'])) { $response['bp_activity_newest_activities'] = $newest_activities; } return $response; }
/** * */ function unpin_activity() { global $wpdb; $nonce = isset($_REQUEST['nonces']) ? sanitize_text_field($_REQUEST['nonces']) : 0; if (!wp_verify_nonce($nonce, 'pin-activity-nonce')) { exit(__('Not permitted', RW_Sticky_Activity::$textdomain)); } $activityID = isset($_REQUEST['id']) && is_numeric($_REQUEST['id']) ? $_REQUEST['id'] : ''; if ($activityID != '') { bp_activity_update_meta($activityID, 'rw_sticky_activity', 0); } $meta_query_args = array('relation' => 'AND', array('key' => 'rw_sticky_activity', 'value' => '1', 'compare' => '=')); if (function_exists('bb_bp_activity_url_filter')) { // deactivate BuddyBoss Wall activity url preview remove_action('bp_get_activity_content_body', 'bb_bp_activity_url_filter'); } add_filter('bp_activity_excerpt_length', function () { return 99999; }); if (bp_has_activities(array('meta_query' => $meta_query_args))) { ?> <?php while (bp_activities()) { bp_the_activity(); ?> <div class="buddypress-sa"> <div id="factivity-stream"> <div class="activity-list"> <div class="activity-content" style="margin-left: 0px;"> <?php $nonce = wp_create_nonce('pin-activity-nonce'); $title = __('Unpin activity', RW_Sticky_Activity::$textdomain); $class = "sa-button-unpin pinned"; ?> <a href="" class="fa fa-map-marker icon-button sa-button <?php echo $class; ?> " title="<?php echo $title; ?> " data-post-nonces="<?php echo $nonce; ?> " data-post-id="<?php echo bp_get_activity_id(); ?> "></a> <?php if (bp_activity_has_content() && bp_get_activity_type() != 'bbp_topic_create' && bp_get_activity_type() != 'bbp_reply_create') { ?> <div class="activity-inner"> <?php bp_activity_content_body(); ?> </div> <?php } ?> <?php if (bp_get_activity_type() == 'bp_doc_edited') { ?> <div class="activity-inner"><p> <?php $doc = get_post(url_to_postid(bp_get_activity_feed_item_link())); echo __('Doc: ', RW_Sticky_Activity::$textdomain); echo "<a href='" . get_permalink($doc->ID) . "'>"; echo $doc->post_title; echo "</a>"; ?> </p> </div> <?php } // New forum topic created if (bp_get_activity_type() == 'bbp_topic_create') { // url_to_postid fails on permalinks like http://gruppen.domain.tld/groups/frank-testgruppe/forum/topic/neues-thema/ !!! ?> <div class="activity-inner"><p> <?php $link = bp_get_activity_feed_item_link(); $guid = substr($link, strpos($link, "/forum/topic") + 6); $topicid = $wpdb->get_var($wpdb->prepare("SELECT ID FROM {$wpdb->posts} WHERE guid like '%%%s%%'", $guid)); $topic = get_post($topicid); echo __('Forum new topic: ', RW_Sticky_Activity::$textdomain); echo "<a href='" . get_permalink($topic->ID) . "'> "; echo $topic->post_title; echo "</a><br>"; ?> </p> </div> <?php } // New forum reply if (bp_get_activity_type() == 'bbp_reply_create') { // url_to_postid fails on permalinks like http://gruppen.domain.tld/groups/frank-testgruppe/forum/topic/neues-thema/ !!! ?> <div class="activity-inner"><p> <?php $link = bp_get_activity_feed_item_link(); $id = substr($link, strpos($link, "/#post-") + 7); $topic = get_post($id); echo __('Forum reply: ', RW_Sticky_Activity::$textdomain); echo "<a href='" . get_permalink($topic->ID) . "'> "; $parent = get_post($topic->post_parent); echo $parent->post_title; echo "</a><br>"; ?> </p> </div> <?php } ?> <div class="activity-header"> <?php $userid = bp_get_activity_user_id(); $user = get_user_by('id', $userid); echo "(" . $user->nickname . ")"; ?> </div> <div class="clearfix"></div> </div> </div> </div> </div> <?php } ?> <?php } if (function_exists('bb_bp_activity_url_filter')) { // activate BuddyBoss Wall activity url preview add_action('bp_get_activity_content_body', 'bb_bp_activity_url_filter'); } wp_die(); }
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( 'content' => $_POST['content'], 'activity_id' => $_POST['form_id'], '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; } if ( bp_has_activities ( 'include=' . $comment_id ) ) : ?> <?php while ( bp_activities() ) : bp_the_activity(); ?> <li id="acomment-<?php bp_activity_id() ?>"> <div class="acomment-avatar"> <?php bp_activity_avatar() ?> </div> <div class="acomment-meta"> <?php echo bp_core_get_userlink( bp_get_activity_user_id() ) ?> · <?php printf( __( '%s ago', 'buddypress' ), bp_core_time_since( bp_core_current_time() ) ) ?> · <a class="acomment-reply" href="#acomment-<?php bp_activity_id() ?>" id="acomment-reply-<?php echo esc_attr( $_POST['form_id'] ) ?>"><?php _e( 'Reply', 'buddypress' ) ?></a> · <a href="<?php echo wp_nonce_url( $bp->root_domain . '/' . $bp->activity->slug . '/delete/' . bp_get_activity_id() . '?cid=' . $comment_id, 'bp_activity_delete_link' ) ?>" class="delete acomment-delete confirm"><?php _e( 'Delete', 'buddypress' ) ?></a> </div> <div class="acomment-content"> <?php bp_activity_content_body() ?> </div> </li> <?php endwhile; ?> <?php endif; }
/** * bp_p2_post_update() * * We duplicate this function form inc/ajax.php * In order to update the stream through ajax but trying to post the right * activity_id, we need to figure out how to do that before sending the info. * * AJAX update posting */ function bp_p2_post_update() { global $bp, $activities_template; /* Check the nonce */ check_admin_referer('p2_post_update', '_wpnonce_p2_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.', 'buddypress') . '</p></div>'; return false; } $groupblog_id = $_POST['item_id']; $post_id = apply_filters('bp_get_activity_secondary_item_id', $activities_template->activity->secondary_item_id); // $post_id = If we would only already know the get_the_ID(); if (bp_has_activities('max=1&primary_id=' . $groupblog_id . '&secondary_id=' . $post_id)) { while (bp_activities()) { bp_the_activity(); /* if ( groupblog_current_layout() == 'magazine' ) include( 'groupblog/layouts/magazine-entry.php' ); elseif ( groupblog_current_layout() == 'media' ) include( 'groupblog/layouts/media-entry.php' ); else */ if (groupblog_current_layout() == 'microblog') { include 'groupblog/layouts/microblog-entry.php'; } else { include WP_PLUGIN_DIR . '/buddypress/bp-themes/bp-default/activity/entry.php'; } } } }
function show_comment_form() { $activity_id = get_post_meta($this->id, 'bp_media_child_activity', true); if (bp_has_activities(array( 'display_comments' => 'stream', 'include' => $activity_id, 'max' => 1 ))) : while (bp_activities()) : bp_the_activity(); do_action('bp_before_activity_entry'); ?> <div class="activity"> <ul id="activity-stream" class="activity-list item-list"> <li class="activity activity_update" id="activity-<?php echo $activity_id; ?>"> <div class="activity-content"> <?php do_action('bp_activity_entry_content'); ?> <?php if (is_user_logged_in()) : ?> <div class="activity-meta no-ajax"> <?php if (bp_activity_can_comment()) : ?> <a href="<?php bp_get_activity_comment_link(); ?>" class="button acomment-reply bp-primary-action" id="acomment-comment-<?php bp_activity_id(); ?>"><?php printf(__('Comment <span>%s</span>', 'buddypress'), bp_activity_get_comment_count()); ?></a> <?php endif; ?> <?php if (bp_activity_can_favorite()) : ?> <?php if (!bp_get_activity_is_favorite()) : ?> <a href="<?php bp_activity_favorite_link(); ?>" class="button fav bp-secondary-action" title="<?php esc_attr_e('Mark as Favorite', 'buddypress'); ?>"><?php _e('Favorite', 'buddypress') ?></a> <?php else : ?> <a href="<?php bp_activity_unfavorite_link(); ?>" class="button unfav bp-secondary-action" title="<?php esc_attr_e('Remove Favorite', 'buddypress'); ?>"><?php _e('Remove Favorite', 'buddypress') ?></a> <?php endif; ?> <?php endif; ?> <?php if (bp_activity_user_can_delete()) bp_activity_delete_link(); ?> <?php do_action('bp_activity_entry_meta'); ?> </div> <?php endif; ?> </div> <?php do_action('bp_before_activity_entry_comments'); ?> <?php if (( is_user_logged_in() && bp_activity_can_comment() ) || bp_activity_get_comment_count()) : ?> <div class="activity-comments"> <?php bp_activity_comments(); ?> <?php if (is_user_logged_in()) : ?> <form action="<?php bp_activity_comment_form_action(); ?>" method="post" id="ac-form-<?php bp_activity_id(); ?>" class="ac-form"<?php bp_activity_comment_form_nojs_display(); ?>> <div class="ac-reply-avatar"><?php bp_loggedin_user_avatar('width=' . BP_AVATAR_THUMB_WIDTH . '&height=' . BP_AVATAR_THUMB_HEIGHT); ?></div> <div class="ac-reply-content"> <div class="ac-textarea"> <textarea id="ac-input-<?php bp_activity_id(); ?>" class="ac-input" name="ac_input_<?php bp_activity_id(); ?>"></textarea> </div> <input type="submit" name="ac_form_submit" value="<?php _e('Post', 'buddypress'); ?>" /> <?php _e('or press esc to cancel.', 'buddypress'); ?> <input type="hidden" name="comment_form_id" value="<?php bp_activity_id(); ?>" /> </div> <?php do_action('bp_activity_entry_comments'); ?> <?php wp_nonce_field('new_activity_comment', '_wpnonce_new_activity_comment'); ?> </form> <?php endif; ?> </div> <?php endif; ?> <?php do_action('bp_after_activity_entry_comments'); ?> </li> </ul> </div> <?php endwhile; else: ?> <div class="activity"> <ul id="activity-stream" class="activity-list item-list"> <li class="activity activity_update" id="activity-<?php echo $activity_id; ?>"> <div class="activity-content"> <?php do_action('bp_activity_entry_content'); ?> <?php if (is_user_logged_in()) : ?> <div class="activity-meta no-ajax"> <a href="<?php echo $this->get_delete_url(); ?>" class="button item-button bp-secondary-action delete-activity-single confirm" rel="nofollow">Delete</a> </div> <?php endif; ?> </div> </li> </ul> </div> <? endif; }
/** * 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 }
function myfossil_bp_wall_ajax_handler() { // -- begin buddypress code -- $bp = buddypress(); // Bail if not a POST action if ('POST' !== strtoupper($_SERVER['REQUEST_METHOD'])) { return; } // Check the nonce check_admin_referer('post_update', '_wpnonce_post_update'); if (!is_user_logged_in()) { exit('-1'); } if (empty($_POST['content'])) { exit('-1<div id="message" class="error"><p>' . __('Please enter some content to post.', 'buddypress') . '</p></div>'); } // -- end buddypress code -- $wall_user_id = bp_displayed_user_id(); $logged_in_user_id = bp_loggedin_user_id(); // Check if posting user is friend of the wall owner... if (!bp_are_friends($wall_user_id, $logged_in_user_id)) { // User should not be able to post to wall, bail out! exit('-1'); } // Setup Activity post... $action = sprintf("%s posted on %s's wall", bp_core_get_userlink($logged_in_user_id), bp_core_get_userlink($wall_user_id)); if ($logged_in_user_id == $wall_user_id) { $action = sprintf("%s posted on their own wall", bp_core_get_userlink($logged_in_user_id)); } $content = $_POST['content']; $component = 'activity'; $type = 'wall_post'; $item_id = $logged_in_user_id; $secondary_item_id = $wall_user_id; $hide_sitewide = true; $activity_args = array('type' => $type, 'action' => $action, 'content' => $content, 'component' => $component, 'user_id' => $wall_user_id, 'item_id' => $logged_in_user_id); $activity_id = bp_activity_add($activity_args); // -- begin buddypress code -- if (empty($activity_id)) { exit('-1<div id="message" class="error"><p>' . __('There was a problem posting your update; please try again.', 'buddypress') . '</p></div>'); } $last_recorded = !empty($_POST['since']) ? date('Y-m-d H:i:s', intval($_POST['since'])) : 0; if ($last_recorded) { $activity_args = array('since' => $last_recorded); $bp->activity->last_recorded = $last_recorded; add_filter('bp_get_activity_css_class', 'bp_activity_newest_class', 10, 1); } else { $activity_args = array('include' => $activity_id); } if (bp_has_activities($activity_args)) { while (bp_activities()) { bp_the_activity(); bp_get_template_part('activity/entry'); } } if (!empty($last_recorded)) { remove_filter('bp_get_activity_css_class', 'bp_activity_newest_class', 10, 1); } exit; }
/** * Processes Activity updates received via a POST request. * * @return string HTML * @since 1.2.0 */ function bp_legacy_theme_post_update() { $bp = buddypress(); // Bail if not a POST action. if ('POST' !== strtoupper($_SERVER['REQUEST_METHOD'])) { return; } // Check the nonce. check_admin_referer('post_update', '_wpnonce_post_update'); if (!is_user_logged_in()) { exit('-1'); } if (empty($_POST['content'])) { exit('-1<div id="message" class="error bp-ajax-message"><p>' . __('Please enter some content to post.', 'buddypress') . '</p></div>'); } $activity_id = 0; $item_id = 0; $object = ''; // Try to get the item id from posted variables. if (!empty($_POST['item_id'])) { $item_id = (int) $_POST['item_id']; } // Try to get the object from posted variables. if (!empty($_POST['object'])) { $object = sanitize_key($_POST['object']); // If the object is not set and we're in a group, set the item id and the object } elseif (bp_is_group()) { $item_id = bp_get_current_group_id(); $object = 'groups'; } if (!$object && bp_is_active('activity')) { $activity_id = bp_activity_post_update(array('content' => $_POST['content'], 'error_type' => 'wp_error')); } elseif ('groups' === $object) { if ($item_id && bp_is_active('groups')) { $activity_id = groups_post_update(array('content' => $_POST['content'], 'group_id' => $item_id, 'error_type' => 'wp_error')); } } else { /** This filter is documented in bp-activity/bp-activity-actions.php */ $activity_id = apply_filters('bp_activity_custom_update', false, $object, $item_id, $_POST['content']); } if (false === $activity_id) { exit('-1<div id="message" class="error bp-ajax-message"><p>' . __('There was a problem posting your update. Please try again.', 'buddypress') . '</p></div>'); } elseif (is_wp_error($activity_id) && $activity_id->get_error_code()) { exit('-1<div id="message" class="error bp-ajax-message"><p>' . $activity_id->get_error_message() . '</p></div>'); } $last_recorded = !empty($_POST['since']) ? date('Y-m-d H:i:s', intval($_POST['since'])) : 0; if ($last_recorded) { $activity_args = array('since' => $last_recorded); $bp->activity->last_recorded = $last_recorded; add_filter('bp_get_activity_css_class', 'bp_activity_newest_class', 10, 1); } else { $activity_args = array('include' => $activity_id); } if (bp_has_activities($activity_args)) { while (bp_activities()) { bp_the_activity(); bp_get_template_part('activity/entry'); } } if (!empty($last_recorded)) { remove_filter('bp_get_activity_css_class', 'bp_activity_newest_class', 10); } exit; }
/** * 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 }
/** * template/output control functions */ function bp_swa_list_activities($args) { $defaults = array('per_page' => 10, 'page' => 1, 'scope' => '', 'max' => 20, 'show_avatar' => "yes", 'show_filters' => "yes", 'included' => false, 'excluded' => false, 'is_personal' => "no", 'is_blog_admin_activity' => "no", 'show_post_form' => "no"); $args = wp_parse_args($args, $defaults); extract($args); //check for the scope of activity //is it the activity of logged in user/blog admin //logged in user over rides blog admin global $bp; $primary_id = ''; if (function_exists('bp_is_group') && bp_is_group()) { $primary_id = null; } $user_id = false; //for limiting to users if ($is_personal == "yes") { $user_id = bp_loggedin_user_id(); } else { if ($is_blog_admin_activity == "yes") { $user_id = swa_get_blog_admin_id(); } else { if (bp_is_user()) { $user_id = null; } } } $components_scope = swa_get_base_component_scope($included, $excluded); $components_base_scope = ""; if (!empty($components_scope)) { $components_base_scope = join(",", $components_scope); } ?> <div class='swa-wrap'> <?php if (is_user_logged_in() && $show_post_form == "yes") { swa_show_post_form(); } ?> <?php if ($show_filters == "yes") { ?> <ul id="activity-filter-links"> <?php swa_activity_filter_links("scope=" . $scope . "&include=" . $included . "&exclude=" . $excluded); ?> </ul> <div class="clear"></div> <?php } ?> <?php if (bp_has_activities('type=sitewide&max=' . $max . '&page=' . $page . '&per_page=' . $per_page . '&object=' . $scope . "&user_id=" . $user_id . "&primary_id=" . $primary_id)) { ?> <div class="swa-pagination "> <div class="pag-count" id="activity-count"> <?php bp_activity_pagination_count(); ?> </div> <div class="pagination-links" id="activity-pag"> <?php bp_activity_pagination_links(); ?> </div> <div class="clear" ></div> </div> <div class="clear" ></div> <ul class="site-wide-stream swa-activity-list"> <?php while (bp_activities()) { bp_the_activity(); ?> <?php swa_activity_entry($args); ?> <?php } ?> </ul> <?php } else { ?> <div class="widget-error"> <?php if ($is_personal == "yes") { $error = sprintf(__("You have no recent %s activity.", "swa"), $scope); } else { $error = __('There has been no recent site activity.', 'swa'); } ?> <?php echo $error; ?> </div> <?php } ?> </div> <?php }
/** * 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>')); }
function bp_mytheme_post_update() { global $bp; // Check the nonce check_admin_referer('post_update', '_wpnonce_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.', 'buddypress') . '</p></div>'; return false; } if (empty($_POST['object']) && function_exists('bp_activity_post_update')) { if (!bp_is_home() && bp_is_member()) { $content = "@" . bp_get_displayed_user_username() . " " . $_POST['content']; } else { $content = $_POST['content']; } $activity_id = bp_activity_post_update(array('content' => $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.', 'buddypress') . '</p></div>'; return false; } if (bp_has_activities('include=' . $activity_id)) { ?> <?php while (bp_activities()) { bp_the_activity(); ?> <?php locate_template(array('activity/entry-wall.php'), true); ?> <?php } ?> <?php } }
function bp_checkins_post_checkin() { // Bail if not a POST action if ('POST' !== strtoupper($_SERVER['REQUEST_METHOD'])) { return; } // Check the nonce check_admin_referer('post_checkin', '_wpnonce_post_checkin'); 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.', 'bp-checkins') . '</p></div>'; return false; } $content = apply_filters('bp_checkins_contenteditable_fix', $_POST['content']); $activity_id = 0; if ($_POST['object'] == "checkin" && bp_is_active('checkins')) { $activity_id = bp_checkins_post_update(array('content' => $content)); } elseif ($_POST['object'] == 'groups') { if (!empty($_POST['item_id']) && bp_is_active('groups')) { $activity_id = bp_checkins_groups_post_update(array('content' => $content, 'group_id' => $_POST['item_id'])); } } else { $activity_id = apply_filters('bp_checkins_custom_update', $_POST['object'], $_POST['item_id'], $content); } if (empty($activity_id)) { echo '-1<div id="message" class="error"><p>' . __('There was a problem posting your update, please try again.', 'bp-checkins') . '</p></div>'; return false; } if (bp_has_activities('include=' . $activity_id)) { ?> <?php while (bp_activities()) { bp_the_activity(); ?> <?php bp_checkins_locate_template_choose('activity/entry'); ?> <?php } ?> <?php } exit; }
</div> </div> </noscript> <?php if (empty($_POST['page'])) { ?> <ul id="activity-stream" class="activity-list item-list"> <?php } ?> <?php while (bp_activities()) { bp_the_activity(); ?> <?php locate_template(array('activity/entry.php'), true, false); ?> <?php } ?> <?php if (bp_activity_has_more_items()) { ?>
function bp_dtheme_post_update() { global $bp; // Check the nonce check_admin_referer('post_update', '_wpnonce_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.', 'buddypress') . '</p></div>'; return false; } $activity_id = 0; if (empty($_POST['object']) && bp_is_active('activity')) { $activity_id = bp_activity_post_update(array('content' => $_POST['content'])); } elseif ($_POST['object'] == 'groups') { if (!empty($_POST['item_id']) && bp_is_active('groups')) { $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 (empty($activity_id)) { echo '-1<div id="message" class="error"><p>' . __('There was a problem posting your update, please try again.', 'buddypress') . '</p></div>'; return false; } if (bp_has_activities('include=' . $activity_id)) { while (bp_activities()) { bp_the_activity(); gconnect_locate_template(array('activity/entry.php'), true); } } }
/** * This is where we actually save the activity update. */ function ajax_update_activity_contents() { $bpfb_code = $activity = ''; $aid = 0; $codec = new BpfbCodec(); if (!empty($_POST['data']['bpfb_video_url'])) { $bpfb_code = $codec->create_video_tag($_POST['data']['bpfb_video_url']); } if (!empty($_POST['data']['bpfb_link_url'])) { $bpfb_code = $codec->create_link_tag($_POST['data']['bpfb_link_url'], $_POST['data']['bpfb_link_title'], $_POST['data']['bpfb_link_body'], $_POST['data']['bpfb_link_image']); } if (!empty($_POST['data']['bpfb_photos'])) { $images = $this->move_images($_POST['data']['bpfb_photos']); $bpfb_code = $codec->create_images_tag($images); } $bpfb_code = apply_filters('bpfb_code_before_save', $bpfb_code); // All done creating tags. Now, save the code $gid = (int) @$_POST['group_id']; if ($bpfb_code) { $content = @$_POST['content'] . "\n" . $bpfb_code; $content = apply_filters('bp_activity_post_update_content', $content); $aid = $gid ? groups_post_update(array('content' => $content, 'group_id' => $gid)) : bp_activity_post_update(array('content' => $content)); global $blog_id; bp_activity_update_meta($aid, 'bpfb_blog_id', $blog_id); } if ($aid) { ob_start(); if (bp_has_activities('include=' . $aid)) { while (bp_activities()) { bp_the_activity(); if (function_exists('bp_locate_template')) { bp_locate_template(array('activity/entry.php'), true); } else { locate_template(array('activity/entry.php'), true); } } } $activity = ob_get_clean(); } header('Content-type: application/json'); echo json_encode(array('code' => $bpfb_code, 'id' => $aid, 'activity' => $activity)); exit; }
/** * Processes Activity updates received via a POST request. * * @return string HTML * @since BuddyPress (1.2) */ function bp_legacy_theme_post_update() { $bp = buddypress(); // Bail if not a POST action if ('POST' !== strtoupper($_SERVER['REQUEST_METHOD'])) { return; } // Check the nonce check_admin_referer('post_update', '_wpnonce_post_update'); if (!is_user_logged_in()) { exit('-1'); } if (empty($_POST['content'])) { exit('-1<div id="message" class="error bp-ajax-message"><p>' . __('Please enter some content to post.', 'buddypress') . '</p></div>'); } $activity_id = 0; if (empty($_POST['object']) && bp_is_active('activity')) { $activity_id = bp_activity_post_update(array('content' => $_POST['content'])); } elseif ($_POST['object'] == 'groups') { if (!empty($_POST['item_id']) && bp_is_active('groups')) { $activity_id = groups_post_update(array('content' => $_POST['content'], 'group_id' => $_POST['item_id'])); } } else { /** This filter is documented in bp-activity/bp-activity-actions.php */ $activity_id = apply_filters('bp_activity_custom_update', false, $_POST['object'], $_POST['item_id'], $_POST['content']); } if (empty($activity_id)) { exit('-1<div id="message" class="error bp-ajax-message"><p>' . __('There was a problem posting your update. Please try again.', 'buddypress') . '</p></div>'); } $last_recorded = !empty($_POST['since']) ? date('Y-m-d H:i:s', intval($_POST['since'])) : 0; if ($last_recorded) { $activity_args = array('since' => $last_recorded); $bp->activity->last_recorded = $last_recorded; add_filter('bp_get_activity_css_class', 'bp_activity_newest_class', 10, 1); } else { $activity_args = array('include' => $activity_id); } if (bp_has_activities($activity_args)) { while (bp_activities()) { bp_the_activity(); bp_get_template_part('activity/entry'); } } if (!empty($last_recorded)) { remove_filter('bp_get_activity_css_class', 'bp_activity_newest_class', 10, 1); } exit; }
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; }
<?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> </li> <?php endif; ?> <?php if ( empty( $_POST['page'] ) ) : ?> </ul> <?php endif; ?>
/** * Processes Activity updates received via a POST request. * * @return string HTML * @since BuddyPress (1.2) */ function bp_dtheme_post_update() { // Bail if not a POST action if ('POST' !== strtoupper($_SERVER['REQUEST_METHOD'])) { return; } // Check the nonce check_admin_referer('post_update', '_wpnonce_post_update'); if (!is_user_logged_in()) { exit('-1'); } if (empty($_POST['content'])) { exit('-1<div id="message" class="error"><p>' . __('Please enter some content to post.', 'logicalboneshug') . '</p></div>'); } $activity_id = 0; if (empty($_POST['object']) && bp_is_active('activity')) { $activity_id = bp_activity_post_update(array('content' => $_POST['content'])); } elseif ($_POST['object'] == 'groups') { if (!empty($_POST['item_id']) && bp_is_active('groups')) { $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 (empty($activity_id)) { exit('-1<div id="message" class="error"><p>' . __('There was a problem posting your update, please try again.', 'logicalboneshug') . '</p></div>'); } if (bp_has_activities('include=' . $activity_id)) { while (bp_activities()) { bp_the_activity(); locate_template(array('activity/entry.php'), true); } } exit; }
/** * 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 }
/** * 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 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 }