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


PHP bp_core_get_last_activity函数代码示例

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


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

示例1: populate

	/**
	 * populate()
	 *
	 * Populate the instantiated class with data based on the User ID provided.
	 *
	 * @package BuddyPress Core
 	 * @global $userdata WordPress user data for the current logged in user.
	 * @uses bp_core_get_userurl() Returns the URL with no HTML markup for a user based on their user id
	 * @uses bp_core_get_userlink() Returns a HTML formatted link for a user with the user's full name as the link text
	 * @uses bp_core_get_user_email() Returns the email address for the user based on user ID
	 * @uses get_user_meta() WordPress function returns the value of passed usermeta name from usermeta table
	 * @uses bp_core_fetch_avatar() Returns HTML formatted avatar for a user
	 * @uses bp_profile_last_updated_date() Returns the last updated date for a user.
	 */
	function populate() {
		if ( function_exists( 'xprofile_install' ) )
			$this->profile_data = $this->get_profile_data();

		if ( $this->profile_data ) {
			$this->user_url = bp_core_get_user_domain( $this->id, $this->profile_data['user_nicename'], $this->profile_data['user_login'] );
			$this->fullname = esc_attr( $this->profile_data[BP_XPROFILE_FULLNAME_FIELD_NAME]['field_data'] );
			$this->user_link = "<a href='{$this->user_url}' title='{$this->fullname}'>{$this->fullname}</a>";
			$this->email = esc_attr( $this->profile_data['user_email'] );
		} else {
			$this->user_url = bp_core_get_user_domain( $this->id );
			$this->user_link = bp_core_get_userlink( $this->id );
			$this->fullname = esc_attr( bp_core_get_user_displayname( $this->id ) );
			$this->email = esc_attr( bp_core_get_user_email( $this->id ) );
		}

		/* Cache a few things that are fetched often */
		wp_cache_set( 'bp_user_fullname_' . $this->id, $this->fullname, 'bp' );
		wp_cache_set( 'bp_user_email_' . $this->id, $this->email, 'bp' );
		wp_cache_set( 'bp_user_url_' . $this->id, $this->user_url, 'bp' );

		$this->avatar = bp_core_fetch_avatar( array( 'item_id' => $this->id, 'type' => 'full' ) );
		$this->avatar_thumb = bp_core_fetch_avatar( array( 'item_id' => $this->id, 'type' => 'thumb' ) );
		$this->avatar_mini = bp_core_fetch_avatar( array( 'item_id' => $this->id, 'type' => 'thumb', 'width' => 30, 'height' => 30 ) );

		$this->last_active = bp_core_get_last_activity( get_user_meta( $this->id, 'last_activity', true ), __( 'active %s ago', 'buddypress' ) );
	}
开发者ID:n-sane,项目名称:zaroka,代码行数:41,代码来源:bp-core-classes.php

示例2: populate

 /**
  * populate()
  *
  * Populate the instantiated class with data based on the User ID provided.
  * 
  * @package BuddyPress Core
  * @global $userdata WordPress user data for the current logged in user.
  * @uses bp_core_get_userurl() Returns the URL with no HTML markup for a user based on their user id
  * @uses bp_core_get_userlink() Returns a HTML formatted link for a user with the user's full name as the link text
  * @uses bp_core_get_user_email() Returns the email address for the user based on user ID
  * @uses get_usermeta() WordPress function returns the value of passed usermeta name from usermeta table
  * @uses bp_core_get_avatar() Returns HTML formatted avatar for a user
  * @uses bp_profile_last_updated_date() Returns the last updated date for a user.
  */
 function populate()
 {
     $this->user_url = bp_core_get_userurl($this->id);
     $this->user_link = bp_core_get_userlink($this->id);
     $this->fullname = bp_fetch_user_fullname($this->id, false);
     $this->email = bp_core_get_user_email($this->id);
     $this->last_active = bp_core_get_last_activity(get_usermeta($this->id, 'last_activity'), __('active %s ago', 'buddypress'));
     $this->avatar = bp_core_get_avatar($this->id, 2);
     $this->avatar_thumb = bp_core_get_avatar($this->id, 1);
     $this->avatar_mini = bp_core_get_avatar($this->id, 1, 25, 25, false);
 }
开发者ID:alvaropereyra,项目名称:shrekcms,代码行数:25,代码来源:bp-core-classes.php

示例3: test_bp_get_blog_last_active_active_format_true

 /**
  * @group bp_get_blog_last_active
  */
 public function test_bp_get_blog_last_active_active_format_true()
 {
     // Fake the global
     global $blogs_template;
     $time = date('Y-m-d h:i:s', time() - 24 * 60 * 60);
     $blogs_template = new stdClass();
     $blogs_template->blog = new stdClass();
     $blogs_template->blog->last_activity = $time;
     $this->assertEquals(bp_core_get_last_activity($time, __('active %s', 'buddypress')), bp_get_blog_last_active(array('active_format' => true)));
     $blogs_template->blog = null;
 }
开发者ID:swissspidy,项目名称:BuddyPress,代码行数:14,代码来源:template.php

示例4: bp_get_group_member_joined_since

function bp_get_group_member_joined_since()
{
    global $members_template;
    return apply_filters('bp_get_group_member_joined_since', bp_core_get_last_activity($members_template->member->date_modified, __('joined %s', 'buddypress')));
}
开发者ID:newington,项目名称:buddypress,代码行数:5,代码来源:bp-groups-template.php

示例5: bp_get_last_activity

/**
 * Get the "active [x days ago]" string for a user.
 *
 * @param int $user_id ID of the user. Default: displayed user ID.
 * @return string
 */
function bp_get_last_activity($user_id = 0)
{
    if (empty($user_id)) {
        $user_id = bp_displayed_user_id();
    }
    $last_activity = bp_core_get_last_activity(bp_get_user_last_activity($user_id), __('active %s', 'buddypress'));
    /**
     * Filters the 'active [x days ago]' string for a user.
     *
     * @since 1.5.0
     *
     * @param string $value Formatted 'active [x days ago]' string.
     */
    return apply_filters('bp_get_last_activity', $last_activity);
}
开发者ID:mawilliamson,项目名称:wordpress,代码行数:21,代码来源:bp-members-template.php

示例6: populate

 /**
  * Populate the instantiated class with data based on the User ID provided.
  *
  * @uses bp_core_get_userurl() Returns the URL with no HTML markup for
  *       a user based on their user id.
  * @uses bp_core_get_userlink() Returns a HTML formatted link for a
  *       user with the user's full name as the link text.
  * @uses bp_core_get_user_email() Returns the email address for the
  *       user based on user ID.
  * @uses bp_get_user_meta() BP function returns the value of passed
  *       usermeta name from usermeta table.
  * @uses bp_core_fetch_avatar() Returns HTML formatted avatar for a user
  * @uses bp_profile_last_updated_date() Returns the last updated date
  *       for a user.
  */
 public function populate()
 {
     if (bp_is_active('xprofile')) {
         $this->profile_data = $this->get_profile_data();
     }
     if (!empty($this->profile_data)) {
         $full_name_field_name = bp_xprofile_fullname_field_name();
         $this->user_url = bp_core_get_user_domain($this->id, $this->profile_data['user_nicename'], $this->profile_data['user_login']);
         $this->fullname = esc_attr($this->profile_data[$full_name_field_name]['field_data']);
         $this->user_link = "<a href='{$this->user_url}' title='{$this->fullname}'>{$this->fullname}</a>";
         $this->email = esc_attr($this->profile_data['user_email']);
     } else {
         $this->user_url = bp_core_get_user_domain($this->id);
         $this->user_link = bp_core_get_userlink($this->id);
         $this->fullname = esc_attr(bp_core_get_user_displayname($this->id));
         $this->email = esc_attr(bp_core_get_user_email($this->id));
     }
     // Cache a few things that are fetched often
     wp_cache_set('bp_user_fullname_' . $this->id, $this->fullname, 'bp');
     wp_cache_set('bp_user_email_' . $this->id, $this->email, 'bp');
     wp_cache_set('bp_user_url_' . $this->id, $this->user_url, 'bp');
     $this->avatar = bp_core_fetch_avatar(array('item_id' => $this->id, 'type' => 'full', 'alt' => sprintf(__('Profile photo of %s', 'buddypress'), $this->fullname)));
     $this->avatar_thumb = bp_core_fetch_avatar(array('item_id' => $this->id, 'type' => 'thumb', 'alt' => sprintf(__('Profile photo of %s', 'buddypress'), $this->fullname)));
     $this->avatar_mini = bp_core_fetch_avatar(array('item_id' => $this->id, 'type' => 'thumb', 'alt' => sprintf(__('Profile photo of %s', 'buddypress'), $this->fullname), 'width' => 30, 'height' => 30));
     $this->last_active = bp_core_get_last_activity(bp_get_user_last_activity($this->id), __('active %s', 'buddypress'));
 }
开发者ID:kosir,项目名称:thatcamp-org,代码行数:41,代码来源:class-bp-core-user.php

示例7: bp_get_blog_last_active

/**
 * Return the last active date of the current blog in the loop.
 *
 * @param array $args {
 *     Array of optional arguments.
 *     @type bool $active_format If true, formatted "Active 5 minutes ago".
 *                               If false, formatted "5 minutes ago".
 *                               Default: true.
 * }
 * @return string Last active date.
 */
function bp_get_blog_last_active($args = array())
{
    global $blogs_template;
    // Parse the activity format
    $r = bp_parse_args($args, array('active_format' => true));
    // Backwards compatibility for anyone forcing a 'true' active_format
    if (true === $r['active_format']) {
        $r['active_format'] = __('active %s', 'buddypress');
    }
    // Blog has been posted to at least once
    if (isset($blogs_template->blog->last_activity)) {
        // Backwards compatibility for pre 1.5 'ago' strings
        $last_activity = !empty($r['active_format']) ? bp_core_get_last_activity($blogs_template->blog->last_activity, $r['active_format']) : bp_core_time_since($blogs_template->blog->last_activity);
        // Blog has never been posted to
    } else {
        $last_activity = __('Never active', 'buddypress');
    }
    /**
     * Filters the last active date of the current blog in the loop.
     *
     * @since
     *
     * @param string $last_activity Last active date.
     * @param array  $r             Array of parsed args used to determine formatting.
     */
    return apply_filters('bp_blog_last_active', $last_activity, $r);
}
开发者ID:AceMedia,项目名称:BuddyPress,代码行数:38,代码来源:bp-blogs-template.php

示例8: bp_get_last_activity

function bp_get_last_activity($user_id = 0)
{
    global $bp;
    if (empty($user_id)) {
        $user_id = $bp->displayed_user->id;
    }
    $last_activity = bp_core_get_last_activity(bp_get_user_meta($user_id, 'last_activity', true), __('active %s', 'buddypress'));
    return apply_filters('bp_get_last_activity', $last_activity);
}
开发者ID:nxtclass,项目名称:NXTClass-Plugin,代码行数:9,代码来源:bp-members-template.php

示例9: bp_get_the_site_blog_last_active

function bp_get_the_site_blog_last_active()
{
    global $site_blogs_template;
    return apply_filters('bp_the_site_blog_last_active', bp_core_get_last_activity(bp_blogs_get_blogmeta($site_blogs_template->blog->blog_id, 'last_activity'), __('active %s ago', 'buddypress')));
}
开发者ID:alvaropereyra,项目名称:shrekcms,代码行数:5,代码来源:bp-blogs-templatetags.php

示例10: bp_get_group_member_joined_since

/**
 * @since 1.0.0
 *
 * @return mixed|void
 */
function bp_get_group_member_joined_since()
{
    global $members_template;
    /**
     * Filters the joined since time for the current member in the loop.
     *
     * @since 1.0.0
     *
     * @param string $value Joined since time.
     */
    return apply_filters('bp_get_group_member_joined_since', bp_core_get_last_activity($members_template->member->date_modified, __('joined %s', 'buddypress')));
}
开发者ID:igniterealtime,项目名称:community-plugins,代码行数:17,代码来源:bp-groups-template.php

示例11: groups_ajax_widget_groups_list

function groups_ajax_widget_groups_list()
{
    global $bp;
    check_ajax_referer('groups_widget_groups_list');
    switch ($_POST['filter']) {
        case 'newest-groups':
            if (!($groups = wp_cache_get('newest_groups', 'bp'))) {
                $groups = groups_get_newest($_POST['max-groups'], 1);
                wp_cache_set('newest_groups', $groups, 'bp');
            }
            break;
        case 'recently-active-groups':
            if (!($groups = wp_cache_get('active_groups', 'bp'))) {
                $groups = groups_get_active($_POST['max-groups'], 1);
                wp_cache_set('active_groups', $groups, 'bp');
            }
            break;
        case 'popular-groups':
            if (!($groups = wp_cache_get('popular_groups', 'bp'))) {
                $groups = groups_get_popular($_POST['max-groups'], 1);
                wp_cache_set('popular_groups', $groups, 'bp');
            }
            break;
    }
    if ($groups['groups']) {
        echo '0[[SPLIT]]';
        // return valid result.
        foreach ((array) $groups['groups'] as $group_id) {
            if (!($group = wp_cache_get('groups_group_nouserdata_' . $group_id->group_id, 'bp'))) {
                $group = new BP_Groups_Group($group_id->group_id, false, false);
                wp_cache_set('groups_group_nouserdata_' . $group_id->group_id, $group, 'bp');
            }
            ?>
			<li>
				<div class="item-avatar">
					<?php 
            echo bp_get_group_avatar_thumb($group);
            ?>
				</div>

				<div class="item">
					<div class="item-title"><a href="<?php 
            echo bp_get_group_permalink($group);
            ?>
" title="<?php 
            echo bp_get_group_name($group);
            ?>
"><?php 
            echo bp_get_group_name($group);
            ?>
</a></div>
					<div class="item-meta">
						<span class="activity">
							<?php 
            if ('newest-groups' == $_POST['filter']) {
                echo bp_core_get_last_activity($group->date_created, __('created %s ago', 'buddypress'));
            } else {
                if ('recently-active-groups' == $_POST['filter']) {
                    echo bp_core_get_last_activity(groups_get_groupmeta($group->id, 'last_activity'), __('active %s ago', 'buddypress'));
                } else {
                    if ('popular-groups' == $_POST['filter']) {
                        if ($group->total_member_count == 1) {
                            echo $group->total_member_count . __(' member', 'buddypress');
                        } else {
                            echo $group->total_member_count . __(' members', 'buddypress');
                        }
                    }
                }
            }
            ?>
						</span>
					</div>	
				</div>
			</li>
			<?php 
        }
    } else {
        echo "-1[[SPLIT]]<li>" . __("No groups matched the current filter.", 'buddypress');
    }
}
开发者ID:alvaropereyra,项目名称:shrekcms,代码行数:80,代码来源:bp-groups-ajax.php

示例12: bp_get_last_activity

/**
 * Get the "active [x days ago]" string for a user.
 *
 * @param int $user_id ID of the user. Default: displayed user ID.
 * @return string
 */
function bp_get_last_activity($user_id = 0)
{
    if (empty($user_id)) {
        $user_id = bp_displayed_user_id();
    }
    $last_activity = bp_core_get_last_activity(bp_get_user_last_activity($user_id), __('active %s', 'buddypress'));
    return apply_filters('bp_get_last_activity', $last_activity);
}
开发者ID:eresyyl,项目名称:mk,代码行数:14,代码来源:bp-members-template.php

示例13: bp_get_blog_last_active

/**
 * Return the last active date of the current blog in the loop.
 *
 * @param array $args {
 *     Array of optional arguments.
 *     @type bool $active_format If true, formatted "Active 5 minutes
 *           ago". If false, formatted "5 minutes ago". Default: true.
 * }
 * @return string Last active date.
 */
function bp_get_blog_last_active($args = array())
{
    global $blogs_template;
    // Parse the activity format
    $r = bp_parse_args($args, array('active_format' => true));
    // Backwards compatibilty for anyone forcing a 'true' active_format
    if (true === $r['active_format']) {
        $r['active_format'] = __('active %s', 'buddypress');
    }
    // Blog has been posted to at least once
    if (isset($blogs_template->blog->last_activity)) {
        // Backwards compatibility for pre 1.5 'ago' strings
        $last_activity = !empty($r['active_format']) ? bp_core_get_last_activity($blogs_template->blog->last_activity, $r['active_format']) : bp_core_time_since($blogs_template->blog->last_activity);
        // Blog has never been posted to
    } else {
        $last_activity = __('Never active', 'buddypress');
    }
    return apply_filters('bp_blog_last_active', $last_activity, $r);
}
开发者ID:eresyyl,项目名称:mk,代码行数:29,代码来源:bp-blogs-template.php

示例14: bp_core_widget_members

function bp_core_widget_members($args)
{
    global $current_blog, $bp;
    extract($args);
    $options = get_blog_option($current_blog->blog_id, 'bp_core_widget_members');
    ?>
	<?php 
    echo $before_widget;
    ?>
	<?php 
    echo $before_title . $widget_name . $after_title;
    ?>
	
	<?php 
    if (!($users = wp_cache_get('newest_users', 'bp'))) {
        $users = BP_Core_User::get_newest_users($options['max_members']);
        wp_cache_set('newest_users', $users, 'bp');
    }
    ?>
	
	<?php 
    if ($users['users']) {
        ?>
		<div class="item-options" id="members-list-options">
			<img id="ajax-loader-members" src="<?php 
        echo $bp->core->image_base;
        ?>
/ajax-loader.gif" height="7" alt="<?php 
        _e('Loading', 'buddypress');
        ?>
" style="display: none;" /> 
			<a href="<?php 
        echo site_url() . '/' . BP_MEMBERS_SLUG;
        ?>
" id="newest-members" class="selected"><?php 
        _e('Newest', 'buddypress');
        ?>
</a> | 
			<a href="<?php 
        echo site_url() . '/' . BP_MEMBERS_SLUG;
        ?>
" id="recently-active-members"><?php 
        _e('Active', 'buddypress');
        ?>
</a> | 
			<a href="<?php 
        echo site_url() . '/' . BP_MEMBERS_SLUG;
        ?>
" id="popular-members"><?php 
        _e('Popular', 'buddypress');
        ?>
</a>
		</div>
		<ul id="members-list" class="item-list">
			<?php 
        foreach ((array) $users['users'] as $user) {
            ?>
				<li class="vcard">
					<div class="item-avatar">
						<a href="<?php 
            echo bp_core_get_userlink($user->user_id, false, true);
            ?>
"><?php 
            echo bp_core_get_avatar($user->user_id, 1);
            ?>
</a>
					</div>

					<div class="item">
						<div class="item-title fn"><?php 
            echo bp_core_get_userlink($user->user_id);
            ?>
</div>
						<div class="item-meta"><span class="activity"><?php 
            echo bp_core_get_last_activity($user->user_registered, __('registered %s ago', 'buddypress'));
            ?>
</span></div>
					</div>
				</li>
				<?php 
            $counter++;
            ?>
	
			<?php 
        }
        ?>
		</ul>
		
		<?php 
        if (function_exists('wp_nonce_field')) {
            wp_nonce_field('bp_core_widget_members', '_wpnonce-members');
        }
        ?>
		
		<input type="hidden" name="members_widget_max" id="members_widget_max" value="<?php 
        echo attribute_escape($options['max_members']);
        ?>
" />
		
	<?php 
//.........这里部分代码省略.........
开发者ID:alvaropereyra,项目名称:shrekcms,代码行数:101,代码来源:bp-core-widgets.php

示例15: bp_last_activity

function bp_last_activity($user_id = false, $echo = true)
{
    global $bp;
    if (!$user_id) {
        $user_id = $bp->displayed_user->id;
    }
    $last_activity = bp_core_get_last_activity(get_usermeta($user_id, 'last_activity'), __('active %s ago', 'buddypress'));
    if ($echo) {
        echo apply_filters('bp_last_activity', $last_activity);
    } else {
        return apply_filters('bp_last_activity', $last_activity);
    }
}
开发者ID:alvaropereyra,项目名称:shrekcms,代码行数:13,代码来源:bp-core-templatetags.php


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