当前位置: 首页>>代码示例>>PHP>>正文


PHP bp_activities函数代码示例

本文整理汇总了PHP中bp_activities函数的典型用法代码示例。如果您正苦于以下问题:PHP bp_activities函数的具体用法?PHP bp_activities怎么用?PHP bp_activities使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了bp_activities函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: rtmedia_api_get_feed

 /**
  * 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;
 }
开发者ID:fs-contributor,项目名称:rtMedia,代码行数:54,代码来源:RTMediaJsonApiFunctions.php

示例2: post_comment

 /**
  * 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;
 }
开发者ID:baden03,项目名称:mediapress,代码行数:59,代码来源:class-mpp-ajax-comment-helper.php

示例3: widget

	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
	}
开发者ID:n-sane,项目名称:zaroka,代码行数:46,代码来源:bp-blogs-widgets.php

示例4: test_user_can_delete_for_nonadmin

 /**
  * 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);
 }
开发者ID:JeroenNouws,项目名称:BuddyPress,代码行数:21,代码来源:template.php

示例5: swa_post_update

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);
}
开发者ID:pyropictures,项目名称:wordpress-plugins,代码行数:44,代码来源:ajax.php

示例6: get_activity

 /**
  * 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;
 }
开发者ID:Ritesh-patel,项目名称:BP-API,代码行数:27,代码来源:bp-api-activity.php

示例7: devb_aawire_post_update

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);
}
开发者ID:poweronio,项目名称:mbsite,代码行数:69,代码来源:bp-activity-as-wire.php

示例8: bp_activity_heartbeat_last_recorded

/**
 * 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;
}
开发者ID:mawilliamson,项目名称:wordpress,代码行数:47,代码来源:bp-activity-filters.php

示例9: unpin_activity

    /**
     *
     */
    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>
//.........这里部分代码省略.........
开发者ID:rpi-virtuell,项目名称:rw-sticky-activity,代码行数:101,代码来源:RW_Sticky_Activity_Core.php

示例10: bp_dtheme_new_activity_comment

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() ) ?> &middot; <?php printf( __( '%s ago', 'buddypress' ), bp_core_time_since( bp_core_current_time() ) ) ?> &middot;
					<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>
					 &middot; <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;
}
开发者ID:n-sane,项目名称:zaroka,代码行数:52,代码来源:ajax.php

示例11: bp_p2_post_update

/**
 * 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';
            }
        }
    }
}
开发者ID:adisonc,项目名称:MaineLearning,代码行数:43,代码来源:functions.php

示例12: show_comment_form

	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'); ?>" /> &nbsp; <?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;
	}
开发者ID:rolandinsh,项目名称:buddypress-media,代码行数:77,代码来源:bp-media-class-wordpress.php

示例13: output

    /**
     * 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 
//.........这里部分代码省略.........
开发者ID:novichkovv,项目名称:candoweightloss,代码行数:101,代码来源:bp-activity-classes.php

示例14: myfossil_bp_wall_ajax_handler

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;
}
开发者ID:par-orillonsoft,项目名称:myfossil-theme,代码行数:60,代码来源:plugins.php

示例15: bp_legacy_theme_post_update

/**
 * 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;
}
开发者ID:CompositeUK,项目名称:clone.BuddyPress,代码行数:70,代码来源:buddypress-functions.php


注:本文中的bp_activities函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。