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


PHP bp_the_activity函数代码示例

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


在下文中一共展示了bp_the_activity函数的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: 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

示例3: 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

示例4: 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

示例5: 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

示例6: 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

示例7: 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

示例8: 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

示例9: bp_mytheme_post_update

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 
    }
}
开发者ID:par-orillonsoft,项目名称:Wishmagnet,代码行数:46,代码来源:buddy_boss_wall.php

示例10: 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

示例11: 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

示例12: widget

    /**
     * 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 
    }
开发者ID:danielcoats,项目名称:schoolpress,代码行数:83,代码来源:bp-blogs-widgets.php

示例13: bp_swa_list_activities

/**
 * 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">
                                &nbsp; <?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');
//.........这里部分代码省略.........
开发者ID:pyropictures,项目名称:wordpress-plugins,代码行数:101,代码来源:template-tags.php

示例14: framework

        /**
         * 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>'));
        }
开发者ID:ryanhellyer,项目名称:thememix-pro-genesis,代码行数:78,代码来源:widget.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_the_activity函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。