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


PHP bp_has_activities函数代码示例

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


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

示例1: mpp_gallery_has_activity

/**
 * A wrapper for bp_has_activity
 * checks if the gallery has associated activity
 * 
 * @param type $args
 * @return type
 */
function mpp_gallery_has_activity($args = null)
{
    $default = array('gallery_id' => mpp_get_current_gallery_id());
    $args = wp_parse_args($args, $default);
    extract($args);
    $args = array('meta_query' => array(array('key' => '_mpp_gallery_id', 'value' => $gallery_id), array('key' => '_mpp_context', 'value' => 'gallery', 'compare' => '=')), 'type' => 'mpp_media_upload');
    return bp_has_activities($args);
}
开发者ID:enboig,项目名称:mediapress,代码行数:15,代码来源:mpp-gallery-activity.php

示例2: sp_get_bp_activity_author

function sp_get_bp_activity_author()
{
    global $activities_template, $bp;
    bp_has_activities();
    // echo "AT: ";
    // print_r_html( $activities_template );
    foreach ($activities_template->activities as $activity) {
        if ($activity->id == $bp->current_action) {
            return $activity->display_name;
        }
    }
}
开发者ID:netconstructor,项目名称:SeoPress,代码行数:12,代码来源:functions.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: 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: test_follow_blog_and_groupblog

 /**
  * @group groupblog
  */
 public function test_follow_blog_and_groupblog()
 {
     if (!is_multisite()) {
         return;
     }
     // save the current user and override logged-in user
     $old_user = get_current_user_id();
     $u = $this->factory->user->create();
     $this->set_current_user($u);
     // create some blogs
     $b = $this->factory->blog->create(array('title' => 'Groupblog', 'user_id' => $u));
     $b2 = $this->factory->blog->create(array('title' => 'Test blog 1', 'user_id' => $u));
     $b3 = $this->factory->blog->create(array('title' => 'Test blog 2', 'user_id' => $u));
     // create a group and connect a blog
     $g = $this->factory->group->create(array('creator_id' => $u));
     groups_update_groupmeta($g, 'groupblog_blog_id', $b);
     // follow the groupblog
     $f = bp_follow_start_following(array('leader_id' => $b, 'follower_id' => $u, 'follow_type' => 'blogs'));
     // follow a regular blog
     $f2 = bp_follow_start_following(array('leader_id' => $b2, 'follower_id' => $u, 'follow_type' => 'blogs'));
     // add some activity items
     $a = $this->factory->activity->create(array('component' => buddypress()->groups->id, 'type' => 'new_groupblog_post', 'user_id' => $u, 'item_id' => $g, 'secondary_item_id' => 1));
     $a2 = $this->factory->activity->create(array('component' => buddypress()->blogs->id, 'type' => 'new_blog_post', 'user_id' => $u, 'item_id' => $b3, 'secondary_item_id' => 1));
     $a3 = $this->factory->activity->create(array('component' => buddypress()->blogs->id, 'type' => 'new_blog_post', 'user_id' => $u, 'item_id' => $b2, 'secondary_item_id' => 1));
     // fake that we're on a user's "Activity > Followed Sites" page
     add_filter('bp_ajax_querystring', array($this, 'add_activity_scope_filter'));
     // fake that BP groupblog is installed so groupblog filter will kick in
     if (!function_exists('bp_groupblog_init')) {
         function bp_groupblog_init()
         {
         }
     }
     // run the activity loop
     global $activities_template;
     bp_has_activities(bp_ajax_querystring('activity'));
     // grab the activity IDs from the loop
     $ids = wp_list_pluck($activities_template->activities, 'id');
     // assert!
     $this->assertEquals(array($a, $a3), $ids);
     // reset everything
     $activities_template = null;
     $this->set_current_user($old_user);
     remove_filter('bp_ajax_querystring', array($this, 'add_activity_scope_filter'));
 }
开发者ID:wesavetheworld,项目名称:buddypress-followers,代码行数:47,代码来源:blogs.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: get_activity

 function get_activity()
 {
     // Depends on both bbPress and BuddyPress
     if (!class_exists('bbPress') | !class_exists('BuddyPress')) {
         return false;
     }
     // Try to retrieve the widget from the cache
     $widget = wp_cache_get('recent_discussion', 'apoc');
     if ($widget) {
         $this->html = $widget;
         $this->cached = true;
     } else {
         // Declare valid actions
         $actions = array('bbp_topic_create', 'bbp_reply_create', 'new_blog_comment');
         // Setup query args
         $args = array('max' => $this->number, 'action' => implode(',', $actions));
         // If topics are found, build the HTML
         if (bp_has_activities($args)) {
             $this->html = $this->build_html();
             // Store the new HTML in the cache with 1 minute expiration
             wp_cache_set('recent_discussion', $this->html, 'apoc', 60);
         }
     }
 }
开发者ID:tamriel-foundry,项目名称:apoc2,代码行数:24,代码来源:widgets.php

示例8: output

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

示例9: bebop_manage_oers

function bebop_manage_oers()
{
    if (bp_is_current_component('bebop') && bp_is_current_action('bebop-manager')) {
        if (isset($_POST['action'])) {
            global $wpdb;
            global $bp;
            $oer_count = 0;
            $success = false;
            //Add OER's to the activity stream.
            if ($_POST['action'] == 'verify') {
                foreach (array_keys($_POST) as $oer) {
                    if ($oer != 'action') {
                        $data = bebop_tables::fetch_individual_oer_data($oer);
                        //go and fetch data from the activity buffer table.
                        if (!empty($data->id)) {
                            $should_users_verify_content = bebop_tables::get_option_value('bebop_' . $data->type . '_content_user_verification');
                            if ($should_users_verify_content != 'no') {
                                global $wpdb;
                                if (!bp_has_activities('action=bebop_oer_plugin&item_id=' . $data->id)) {
                                    $new_activity_item = array('user_id' => $data->user_id, 'component' => 'bebop_oer_plugin', 'type' => $data->type, 'action' => $data->action, 'content' => $data->content, 'item_id' => $data->id, 'date_recorded' => $data->date_recorded, 'hide_sitewide' => $data->hide_sitewide);
                                    if (bp_activity_add($new_activity_item)) {
                                        bebop_tables::update_oer_data($data->id, 'status', 'verified');
                                        bebop_tables::update_oer_data($data->id, 'activity_stream_id', $wpdb->insert_id);
                                        $oer_count++;
                                    } else {
                                        bebop_tables::log_error(__('Activity Stream', 'bebop'), __('Could not update the content status.', 'bebop'));
                                    }
                                } else {
                                    bebop_tables::log_error(__('Activity Stream', 'bebop'), __('This content already exists in the activity stream.', 'bebop'));
                                }
                            }
                            //End if ( $should_users_verify_content != 'no' ) {
                        }
                    }
                }
                //End foreach ( array_keys($_POST) as $oer ) {
                if ($oer_count > 1) {
                    $success = true;
                    $message = __('Resources verified.', 'bebop');
                } else {
                    $success = true;
                    $message = __('Resource verified.', 'bebop');
                }
            } else {
                if ($_POST['action'] == 'delete') {
                    foreach (array_keys($_POST) as $oer) {
                        if ($oer != 'action') {
                            $data = bebop_tables::fetch_individual_oer_data($oer);
                            //go and fetch data from the activity buffer table.
                            if (!empty($data->id)) {
                                //delete the activity, let the filter update the tables.
                                if (!empty($data->activity_stream_id)) {
                                    $should_users_verify_content = bebop_tables::get_option_value('bebop_' . $data->type . '_content_user_verification');
                                    if ($should_users_verify_content != 'no') {
                                        bp_activity_delete(array('id' => $data->activity_stream_id));
                                    }
                                }
                                bebop_tables::update_oer_data($data->id, 'status', 'deleted');
                                $oer_count++;
                            }
                        }
                    }
                    //End foreach ( array_keys( $_POST ) as $oer ) {
                    if ($oer_count > 1) {
                        $success = true;
                        $message = __('Resources deleted.', 'bebop');
                    } else {
                        $success = true;
                        $message = __('Resource deleted.', 'bebop');
                    }
                } else {
                    if ($_POST['action'] == 'undelete') {
                        foreach (array_keys($_POST) as $oer) {
                            $exclude_array = array('action', 'submit');
                            if (!in_array($oer, $exclude_array)) {
                                $data = bebop_tables::fetch_individual_oer_data($oer);
                                //go and fetch data from the activity buffer table.
                                $should_users_verify_content = bebop_tables::get_option_value('bebop_' . $data->type . '_content_user_verification');
                                if ($should_users_verify_content != 'no') {
                                    bebop_tables::update_oer_data($data->id, 'status', 'unverified');
                                    $oer_count++;
                                }
                            }
                        }
                        if ($oer_count > 1) {
                            $success = true;
                            $message = __('Resources undeleted.', 'bebop');
                        } else {
                            $success = true;
                            $message = __('Resource undeleted.', 'bebop');
                        }
                    }
                }
            }
            if ($success) {
                bp_core_add_message($message);
            } else {
                bp_core_add_message(__('We couldnt do that for you. Please try again.', 'bebop'), __('error', 'bebop'));
            }
            bp_core_redirect($bp->loggedin_user->domain . bp_current_component() . '/' . bp_current_action());
//.........这里部分代码省略.........
开发者ID:adisonc,项目名称:MaineLearning,代码行数:101,代码来源:bebop-core.php

示例10: extract

 * @subpackage K Elements
 * @author SeventhQueen <themesupport@seventhqueen.com>
 * @since K Elements 1.0
 */
extract(shortcode_atts(array('show' => false, 'number' => 6, 'show_button' => 'yes', 'button_link' => '/activity', 'button_label' => 'View All Activity', 'post_form' => ''), $atts));
if (function_exists('bp_is_active') && bp_is_active('activity')) {
    $output = '';
    $params = array('max' => $number, 'object' => $show);
    $output .= '<div class="wpb_wrapper">';
    $output .= '<div class="activity kleo-activity-streams">';
    if (is_user_logged_in() && $post_form == 'yes') {
        ob_start();
        bp_get_template_part('activity/post-form');
        $output .= ob_get_clean();
    }
    if (bp_has_activities($params)) {
        $output .= '<ul id="activity-stream" class="activity-list item-list">';
        while (bp_activities()) {
            bp_the_activity();
            $output .= '<li class="' . bp_get_activity_css_class() . '" id="activity-' . bp_get_activity_id() . '">';
            $output .= '<div class="activity-avatar rounded">';
            $output .= '<a class="kleo-activity-avatar" title="' . __('View Profile', 'kleo_framework') . '" href="' . bp_get_activity_user_link() . '">';
            $output .= bp_get_activity_avatar();
            $output .= '</a>';
            $output .= '</div>';
            // activity content
            $output .= '<div class="activity-content">';
            $output .= '<div class="activity-header">';
            $output .= bp_get_activity_action();
            $output .= '</div>';
            $output .= '<div class="activity-inner">';
开发者ID:VLabsInc,项目名称:WordPressPlatforms,代码行数:31,代码来源:kleo_bp_activity_stream.php

示例11: do_action

 * @subpackage BuddyBoss
 */
?>

<?php 
do_action('bp_before_activity_loop');
?>

<?php 
$qs = bp_ajax_querystring('activity');
global $bp;
?>


<?php 
if (bp_has_activities($qs)) {
    ?>

	<?php 
    /* Show pagination if JS is not enabled, since the "Load More" link will do nothing */
    ?>
	<noscript>
		<div class="pagination">
			<div class="pag-count"><?php 
    bp_activity_pagination_count();
    ?>
</div>
			<div class="pagination-links"><?php 
    bp_activity_pagination_links();
    ?>
</div>
开发者ID:par-orillonsoft,项目名称:Wishmagnet,代码行数:31,代码来源:activity-loop.php

示例12: bp_dtheme_activity_loop

<?php /* Querystring is set via AJAX in _inc/ajax.php - bp_dtheme_activity_loop() */ ?>

<?php do_action( 'bp_before_activity_loop' ) ?>

<?php global $bp;
if ( bp_is_active("activity")&&bp_has_activities( "action=gallery_new_comment&show_hidden=1&secondary_id=".$bp->gallery->current_gallery->id ) ) : ?>


	<?php /* Show pagination if JS is not enabled, since the "Load More" link will do nothing */ ?>
	<noscript>
		<div class="pagination">
			<div class="pag-count"><?php bp_activity_pagination_count() ?></div>
			<div class="pagination-links"><?php bp_activity_pagination_links() ?></div>
		</div>
	</noscript>
<?php if ( is_user_logged_in() ) : ?>
				<?php locate_template( array( 'gallery/single/media/post-form.php'), true ) ?>
			<?php endif; ?>
	<?php if ( empty( $_POST['page'] ) ) : ?>
		<ul id="activity-stream" class="activity-list item-list">
	<?php endif; ?>

	<?php while ( bp_activities() ) : bp_the_activity(); ?>

		<?php include( locate_template( array( 'activity/entry.php' ), false ) ) ?>

	<?php endwhile; ?>

	<?php if ( bp_get_activity_count() == bp_get_activity_per_page() ) : ?>
		<li class="load-more">
			<a href="#more"><?php _e( 'Load More', 'buddypress' ) ?></a> &nbsp; <span class="ajax-loader"></span>
开发者ID:r-chopra17,项目名称:p2bp,代码行数:31,代码来源:activity.php

示例13: get_option

	<language><?php 
echo get_option('rss_language');
?>
</language>

	<?php 
do_action('bp_activity_favorites_feed_head');
?>

	<?php 
$favs = bp_activity_get_user_favorites(bp_displayed_user_id());
$fav_ids = implode(',', (array) $favs);
?>

	<?php 
if (bp_has_activities('include=' . $fav_ids . '&max=50&display_comments=stream')) {
    ?>
		<?php 
    while (bp_activities()) {
        bp_the_activity();
        ?>

			<item>
				<guid><?php 
        bp_activity_thread_permalink();
        ?>
</guid>
				<title><?php 
        bp_activity_feed_item_title();
        ?>
</title>
开发者ID:newington,项目名称:buddypress,代码行数:31,代码来源:bp-activity-favorites-feed.php

示例14: get_option

?>
</pubDate>
	<generator>http://buddypress.org/?v=<?php 
echo BP_VERSION;
?>
</generator>
	<language><?php 
echo get_option('rss_language');
?>
</language>
	<?php 
do_action('bp_activity_friends_feed_head');
?>

	<?php 
if (bp_has_activities('scope=friends&max=50&display_comments=stream')) {
    ?>
		<?php 
    while (bp_activities()) {
        bp_the_activity();
        ?>
			<item>
				<guid><?php 
        bp_activity_thread_permalink();
        ?>
</guid>
				<title><?php 
        bp_activity_feed_item_title();
        ?>
</title>
				<link><?php 
开发者ID:nxtclass,项目名称:NXTClass-Plugin,代码行数:31,代码来源:bp-activity-friends-feed.php

示例15: get_option

?>
</pubDate>
	<generator>http://buddypress.org/?v=<?php 
echo BP_VERSION;
?>
</generator>
	<language><?php 
echo get_option('rss_language');
?>
</language>
	<?php 
do_action('bp_activity_group_feed_head');
?>

	<?php 
if (bp_has_activities('object=' . $bp->groups->id . '&primary_id=' . $bp->groups->current_group->id . '&max=50&display_comments=threaded')) {
    ?>
		<?php 
    while (bp_activities()) {
        bp_the_activity();
        ?>
			<item>
				<guid><?php 
        bp_activity_thread_permalink();
        ?>
</guid>
				<title><?php 
        bp_activity_feed_item_title();
        ?>
</title>
				<link><?php 
开发者ID:nxtclass,项目名称:NXTClass-Plugin,代码行数:31,代码来源:bp-activity-group-feed.php


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