本文整理汇总了PHP中bp_core_fetch_avatar函数的典型用法代码示例。如果您正苦于以下问题:PHP bp_core_fetch_avatar函数的具体用法?PHP bp_core_fetch_avatar怎么用?PHP bp_core_fetch_avatar使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bp_core_fetch_avatar函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: bp_adminbar_authors_menu
/**
* Blog Authors Menu (visible when not logged in)
*/
function bp_adminbar_authors_menu()
{
global $wpdb;
// Only for multisite
if (!is_multisite()) {
return false;
}
// Hide on root blog
if ($wpdb->blogid == bp_get_root_blog_id() || !bp_is_active('blogs')) {
return false;
}
$blog_prefix = $wpdb->get_blog_prefix($wpdb->blogid);
$authors = $wpdb->get_results("SELECT user_id, user_login, user_nicename, display_name, user_email, meta_value as caps FROM {$wpdb->users} u, {$wpdb->usermeta} um WHERE u.ID = um.user_id AND meta_key = '{$blog_prefix}capabilities' ORDER BY um.user_id");
if (!empty($authors)) {
// This is a blog, render a menu with links to all authors
echo '<li id="bp-adminbar-authors-menu"><a href="/">';
_e('Blog Authors', 'buddypress');
echo '</a>';
echo '<ul class="author-list">';
foreach ((array) $authors as $author) {
$caps = maybe_unserialize($author->caps);
if (isset($caps['subscriber']) || isset($caps['contributor'])) {
continue;
}
echo '<li>';
echo '<a href="' . bp_core_get_user_domain($author->user_id, $author->user_nicename, $author->user_login) . '">';
echo bp_core_fetch_avatar(array('item_id' => $author->user_id, 'email' => $author->user_email, 'width' => 15, 'height' => 15, 'alt' => sprintf(__('Profile picture of %s', 'buddypress'), $author->display_name)));
echo ' ' . $author->display_name . '</a>';
echo '<div class="admin-bar-clear"></div>';
echo '</li>';
}
echo '</ul>';
echo '</li>';
}
}
示例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_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' ) );
}
示例3: bp_members_admin_bar_user_admin_menu
/**
* Adds the User Admin top-level menu to user pages
*
* @package BuddyPress
* @since 1.5
*/
function bp_members_admin_bar_user_admin_menu()
{
global $bp, $wp_admin_bar;
// Only show if viewing a user
if (!bp_is_user()) {
return false;
}
// Don't show this menu to non site admins or if you're viewing your own profile
if (!current_user_can('edit_users') || bp_is_my_profile()) {
return false;
}
// User avatar
$avatar = bp_core_fetch_avatar(array('item_id' => $bp->displayed_user->id, 'email' => $bp->displayed_user->userdata->user_email, 'width' => 16, 'height' => 16));
// Unique ID for the 'My Account' menu
$bp->user_admin_menu_id = !empty($avatar) ? 'user-admin-with-avatar' : 'user-admin';
// Add the top-level User Admin button
$wp_admin_bar->add_menu(array('id' => $bp->user_admin_menu_id, 'title' => $avatar . bp_get_displayed_user_fullname(), 'href' => bp_displayed_user_domain()));
// User Admin > Edit this user's profile
$wp_admin_bar->add_menu(array('parent' => $bp->user_admin_menu_id, 'id' => 'edit-profile', 'title' => __("Edit Profile", 'buddypress'), 'href' => bp_get_members_component_link('profile', 'edit')));
// User Admin > Edit this user's avatar
$wp_admin_bar->add_menu(array('parent' => $bp->user_admin_menu_id, 'id' => 'change-avatar', 'title' => __("Edit Avatar", 'buddypress'), 'href' => bp_get_members_component_link('profile', 'change-avatar')));
// User Admin > Spam/unspam
if (!bp_core_is_user_spammer(bp_displayed_user_id())) {
$wp_admin_bar->add_menu(array('parent' => $bp->user_admin_menu_id, 'id' => 'spam-user', 'title' => __('Mark as Spammer', 'buddypress'), 'href' => wp_nonce_url(bp_displayed_user_domain() . 'admin/mark-spammer/', 'mark-unmark-spammer'), 'meta' => array('onclick' => 'confirm(" ' . __('Are you sure you want to mark this user as a spammer?', 'buddypress') . '");')));
} else {
$wp_admin_bar->add_menu(array('parent' => $bp->user_admin_menu_id, 'id' => 'unspam-user', 'title' => __('Not a Spammer', 'buddypress'), 'href' => wp_nonce_url(bp_displayed_user_domain() . 'admin/unmark-spammer/', 'mark-unmark-spammer'), 'meta' => array('onclick' => 'confirm(" ' . __('Are you sure you want to mark this user as not a spammer?', 'buddypress') . '");')));
}
// User Admin > Delete Account
$wp_admin_bar->add_menu(array('parent' => $bp->user_admin_menu_id, 'id' => 'delete-user', 'title' => __('Delete Account', 'buddypress'), 'href' => wp_nonce_url(bp_displayed_user_domain() . 'admin/delete-user/', 'delete-user'), 'meta' => array('onclick' => 'confirm(" ' . __("Are you sure you want to delete this user's account?", 'buddypress') . '");')));
}
示例4: getPostData
public function getPostData()
{
$fooName = 'bbp_get_' . $this->postType . '_content';
$content = $fooName($this->postId);
$return = array('autor' => array('isCurrentUser' => $this->autorId == get_current_user_id(), 'url' => bp_core_get_user_domain($this->autorId), 'avatar' => bp_core_fetch_avatar(array('item_id' => $autorId, 'height' => $imgSize, 'width' => $imgSize)), 'name' => bbp_get_reply_author_display_name($this->postId)), 'type' => $this->postType, 'attachmentList' => $this->_getAttachmentList(), 'sContent' => bbp_get_reply_content($this->postId), 'id' => $this->postId, 'likes' => 0, 'sDate' => get_post_time('j F ', false, $this->postId, true) . __('at', 'qode') . get_post_time(' H:i', false, $this->postId, true), 'sContentShort' => mb_substr($content, 0, 500), 'sContent' => $content, 'like' => get_post_meta($this->postId, 'likes', true), 'isLiked' => get_post_meta($this->postId, 'like_' . $autorId, true));
return $return;
}
示例5: userpro_user_has_avatar
/**
* Check if the given user has an uploaded avatar
* @return boolean
*/
function userpro_user_has_avatar($user_id = false)
{
// $user_id = bp_loggedin_user_id();
if (bp_core_fetch_avatar(array('item_id' => $user_id, 'no_grav' => true, 'html' => false)) != bp_core_avatar_default()) {
return true;
}
return false;
}
示例6: dln_get_avatar_link
function dln_get_avatar_link()
{
if (!bp_loggedin_user_id()) {
return '';
}
$user_id = bp_loggedin_user_id();
$link = bp_core_fetch_avatar(array('item_id' => $user_id, 'width' => 40, 'height' => 40, 'class' => 'img-circle', 'alt' => bp_core_get_user_displayname($user_id)));
return $link;
}
示例7: getData
public static function getData($post)
{
//$user = get_user_by("id", $post->post_author );
$userData = false;
$user = get_user_by("id", 30);
if ($user) {
$user = $userData = array('isCurrentUser' => $user->ID == get_current_user_id(), 'url' => bp_core_get_user_domain($user->ID), 'avatar' => bp_core_fetch_avatar(array('item_id' => $user->ID, 'height' => $imgSize, 'width' => $imgSize)), 'name' => $user->data->display_name);
}
$return = array('autor' => $user, 'type' => $post->post_type, 'title' => $post->post_name, 'id' => $post->ID, 'likes' => 0, 'createDate' => strtotime($post->post_date), 'contentShort' => mb_substr($post->post_content, 0, 500), 'content' => $post->post_content, 'like' => get_post_meta($post->ID, 'likes', true), 'isLiked' => get_post_meta($post->ID, 'like_' . $autorId, true));
return $return;
}
示例8: rtmedia_api_user_data_from_id
function rtmedia_api_user_data_from_id($user_id, $width = 80, $height = 80, $type = 'thumb')
{
if (empty($user_id)) {
return false;
}
$user_data = array();
$user_data['id'] = $user_id;
$user_data['name'] = xprofile_get_field_data('Name', $user_id);
$avatar_args = array('item_id' => $user_id, 'width' => $width, 'height' => $height, 'html' => false, 'alt' => '', 'type' => $type);
$user_data['avatar'] = bp_core_fetch_avatar($avatar_args);
return $user_data;
}
示例9: meso_fetch_random_groups
function meso_fetch_random_groups($limit = '', $size = '', $type = '', $block_id = '')
{
global $wpdb, $bp;
$fetch_group = "SELECT * FROM " . $wpdb->base_prefix . "bp_groups WHERE status = 'public' ORDER BY rand() LIMIT {$limit}";
$sql_fetch_group = $wpdb->get_results($fetch_group);
?>
<ul class="random-groups item-list group-in-<?php
echo $block_id;
?>
">
<?php
$no_avatar = 'http://www.gravatar.com/avatar';
foreach ($sql_fetch_group as $group_fe) {
$avatar_full = bp_core_fetch_avatar('item_id=' . $group_fe->id . '&class=avatar&object=group&type=' . $type . '&width=' . $size . '&height=' . $size);
$group_description = stripslashes($group_fe->description);
?>
<li>
<div class="item-avatar"><?php
echo $avatar_full;
?>
</div>
<div class="item">
<div class="item-title">
<a title="<?php
echo $group_fe->name . ' - ' . dez_get_short_text($group_description, 150);
?>
" href="<?php
echo home_url() . '/' . bp_get_root_slug('groups') . '/' . $group_fe->slug;
?>
"><?php
echo $group_fe->name;
?>
</a>
</div>
<div class="item-meta">
<span class="activity">
<?php
echo groups_get_groupmeta($group_fe->id, $meta_key = 'total_member_count');
?>
<?php
echo bp_get_root_slug('members');
?>
</span>
</div>
</div>
</li>
<?php
}
?>
</ul>
<?php
}
示例10: bpchat_extend_messages
/**
* Extend chat messages by injecting the username, avatar image and escaping the message
*
* @param array $messages
* @param type $uid
* @return type
*/
function bpchat_extend_messages($messages, $uid = 'sender_id')
{
if (empty($messages)) {
return $messages;
}
$message_count = count($messages);
for ($i = 0; $i < $message_count; $i++) {
$messages[$i]->name = bp_core_get_user_displayname($messages[$i]->{$uid});
$messages[$i]->message = stripslashes($messages[$i]->message);
$messages[$i]->thumb = bp_core_fetch_avatar(array('item_id' => $messages[$i]->{$uid}, 'type' => 'thumb', 'width' => 50, 'height' => 50, 'html' => false));
}
return $messages;
}
示例11: bp_reshare_prepare_reshare
function bp_reshare_prepare_reshare($activity_id)
{
global $bp;
$activity_to_reshare = bp_activity_get_specific('activity_ids=' . $activity_id);
$activity = $activity_to_reshare['activities'][0];
/* get and increment reshared count */
$rs_count = bp_activity_get_meta($activity_id, 'reshared_count');
$rs_count = !empty($rs_count) ? (int) $rs_count + 1 : 1;
bp_activity_update_meta($activity_id, 'reshared_count', $rs_count);
/* get an array of users that reshared the activity */
$reshared_by = bp_activity_get_meta($activity_id, 'reshared_by');
if (is_array($reshared_by) && !in_array($bp->loggedin_user->id, $reshared_by)) {
$reshared_by[] = $bp->loggedin_user->id;
} else {
$reshared_by[] = $bp->loggedin_user->id;
}
bp_activity_update_meta($activity_id, 'reshared_by', $reshared_by);
$secondary_avatar = bp_core_fetch_avatar(array('item_id' => $activity->user_id, 'object' => 'user', 'type' => 'thumb', 'alt' => $alt, 'class' => 'avatar', 'width' => 20, 'height' => 20));
$component = $activity->component;
$item_id = $activity->item_id;
if ($component != 'activity') {
if ($activity->type == 'new_blog_post') {
$action = sprintf(__('%s reshared a <a href="%s">blog post</a> originally posted by %s', 'bp-reshare'), bp_core_get_userlink($bp->loggedin_user->id), $activity->primary_link, $secondary_avatar . bp_core_get_userlink($activity->user_id));
} else {
if ($activity->type == 'new_blog_comment') {
$action = sprintf(__('%s reshared a <a href="%s">comment</a> originally posted by %s', 'bp-reshare'), bp_core_get_userlink($bp->loggedin_user->id), $activity->primary_link, $secondary_avatar . bp_core_get_userlink($activity->user_id));
} else {
if ($component == 'groups') {
$group = groups_get_group(array('group_id' => $item_id));
$group_link = '<a href="' . bp_get_group_permalink($group) . '">' . $group->name . '</a>';
if ($activity->type == 'new_forum_topic') {
$action = sprintf(__('%s reshared a <a href="%s">forum topic</a> originally posted by %s in the group %s', 'bp-reshare'), bp_core_get_userlink($bp->loggedin_user->id), $activity->primary_link, $secondary_avatar . bp_core_get_userlink($activity->user_id), $group_link);
} else {
if ($activity->type == 'new_forum_post') {
$action = sprintf(__('%s reshared a <a href="%s">forum reply</a> originally posted by %s in the group %s', 'bp-reshare'), bp_core_get_userlink($bp->loggedin_user->id), $activity->primary_link, $secondary_avatar . bp_core_get_userlink($activity->user_id), $group_link);
} else {
$action = sprintf(__("%s reshared an activity originally shared by %s in the group %s", 'bp-reshare'), bp_core_get_userlink($bp->loggedin_user->id), $secondary_avatar . bp_core_get_userlink($activity->user_id), $group_link);
}
}
}
}
}
} else {
$action = sprintf(__("%s reshared an activity originally shared by %s", 'bp-reshare'), bp_core_get_userlink($bp->loggedin_user->id), $secondary_avatar . bp_core_get_userlink($activity->user_id));
}
$reshared_args = array('action' => apply_filters('bp_reshare_action_parent_activity', $action, $activity->type), 'content' => $activity->content, 'component' => $component, 'type' => 'reshare_update', 'user_id' => $bp->loggedin_user->id, 'secondary_item_id' => $activity_id, 'recorded_time' => bp_core_current_time(), 'hide_sitewide' => $activity->hide_sitewide);
if (!empty($item_id)) {
$reshared_args['item_id'] = $item_id;
}
return apply_filters('bp_reshare_prepare_reshare', $reshared_args, $activity_id);
}
示例12: bp_groups_group_admin_menu
/**
* Adds the Group Admin top-level menu to group pages
*
* @package BuddyPress
* @since 1.5
*
* @todo Add dynamic menu items for group extensions
*/
function bp_groups_group_admin_menu()
{
global $nxt_admin_bar, $bp;
// Only show if viewing a group
if (!bp_is_group()) {
return false;
}
// Only show this menu to group admins and super admins
if (!is_super_admin() && !bp_group_is_admin()) {
return false;
}
if ('3.2' == bp_get_major_nxt_version()) {
// Group avatar
$avatar = bp_core_fetch_avatar(array('object' => 'group', 'type' => 'thumb', 'avatar_dir' => 'group-avatars', 'item_id' => $bp->groups->current_group->id, 'width' => 16, 'height' => 16));
// Unique ID for the 'My Account' menu
$bp->group_admin_menu_id = !empty($avatar) ? 'group-admin-with-avatar' : 'group-admin';
// Add the top-level Group Admin button
$nxt_admin_bar->add_menu(array('id' => $bp->group_admin_menu_id, 'title' => $avatar . bp_get_current_group_name(), 'href' => bp_get_group_permalink($bp->groups->current_group)));
} elseif ('3.3' == bp_get_major_nxt_version()) {
// Unique ID for the 'My Account' menu
$bp->group_admin_menu_id = 'group-admin';
// Add the top-level Group Admin button
$nxt_admin_bar->add_menu(array('id' => $bp->group_admin_menu_id, 'title' => __('Edit Group', 'buddypress'), 'href' => bp_get_group_permalink($bp->groups->current_group)));
}
// Group Admin > Edit details
$nxt_admin_bar->add_menu(array('parent' => $bp->group_admin_menu_id, 'id' => 'edit-details', 'title' => __('Edit Details', 'buddypress'), 'href' => bp_get_groups_action_link('admin/edit-details')));
// Group Admin > Group settings
$nxt_admin_bar->add_menu(array('parent' => $bp->group_admin_menu_id, 'id' => 'group-settings', 'title' => __('Edit Settings', 'buddypress'), 'href' => bp_get_groups_action_link('admin/group-settings')));
// Group Admin > Group avatar
if (!(int) bp_get_option('bp-disable-avatar-uploads')) {
$nxt_admin_bar->add_menu(array('parent' => $bp->group_admin_menu_id, 'id' => 'group-avatar', 'title' => __('Edit Avatar', 'buddypress'), 'href' => bp_get_groups_action_link('admin/group-avatar')));
}
// Group Admin > Manage invitations
if (bp_is_active('friends')) {
$nxt_admin_bar->add_menu(array('parent' => $bp->group_admin_menu_id, 'id' => 'manage-invitations', 'title' => __('Manage Invitations', 'buddypress'), 'href' => bp_get_groups_action_link('send-invites')));
}
// Group Admin > Manage members
$nxt_admin_bar->add_menu(array('parent' => $bp->group_admin_menu_id, 'id' => 'manage-members', 'title' => __('Manage Members', 'buddypress'), 'href' => bp_get_groups_action_link('admin/manage-members')));
// Group Admin > Membership Requests
if (bp_get_group_status($bp->groups->current_group) == 'private') {
$nxt_admin_bar->add_menu(array('parent' => $bp->group_admin_menu_id, 'id' => 'membership-requests', 'title' => __('Membership Requests', 'buddypress'), 'href' => bp_get_groups_action_link('admin/membership-requests')));
}
// Delete Group
$nxt_admin_bar->add_menu(array('parent' => $bp->group_admin_menu_id, 'id' => 'delete-group', 'title' => __('Delete Group', 'buddypress'), 'href' => bp_get_groups_action_link('admin/delete-group')));
}
示例13: buddyreshare_prepare_reshare
/**
* Builds the argument of the reshared activity
*
* @package BP Reshare
* @since 1.0
*
* @param integer $activity_id the activity id
* @uses bp_activity_get_specific() to fetch the specific activity
* @uses bp_activity_get_meta() to get some meta infos about the activity
* @uses bp_loggedin_user_id() to get current user id
* @uses bp_activity_update_meta() to save some meta infos for the activity
* @uses bp_core_fetch_avatar() to build the avatar for the user
* @uses bp_core_get_userlink() to build the user link
* @uses bp_core_current_time() to date the reshare
* @uses apply_filters() at various places to let plugins/themes override values
* @return array the reshared activity arguments
*/
function buddyreshare_prepare_reshare($activity_id = 0)
{
$activity_to_reshare = bp_activity_get_specific(array('activity_ids' => $activity_id));
if (empty($activity_to_reshare)) {
return array('error' => __('OOps, looks like the activity does not exist anymore', 'bp-reshare'));
}
$activity = $activity_to_reshare['activities'][0];
$reshared_by = bp_activity_get_meta($activity_id, 'reshared_by');
if (is_array($reshared_by) && in_array(bp_loggedin_user_id(), $reshared_by)) {
return array('error' => __('OOps, looks like you already reshared this activity', 'bp-reshare'));
}
if ($activity->user_id == bp_loggedin_user_id()) {
return array('error' => __('OOps, looks like you are trying to reshare your own activity', 'bp-reshare'));
}
/* get and increment reshared count */
$rs_count = bp_activity_get_meta($activity_id, 'reshared_count');
$rs_count = !empty($rs_count) ? (int) $rs_count + 1 : 1;
bp_activity_update_meta($activity_id, 'reshared_count', $rs_count);
if (is_array($reshared_by) && !in_array(bp_loggedin_user_id(), $reshared_by)) {
$reshared_by[] = bp_loggedin_user_id();
} else {
$reshared_by[] = bp_loggedin_user_id();
}
bp_activity_update_meta($activity_id, 'reshared_by', $reshared_by);
$secondary_avatar = bp_core_fetch_avatar(array('item_id' => $activity->user_id, 'object' => 'user', 'type' => 'thumb', 'class' => 'avatar', 'width' => 20, 'height' => 20));
$component = $activity->component;
$item_id = $activity->item_id;
if ($component != 'activity') {
$user_link = bp_core_get_userlink($activity->user_id);
if (strpos($activity->primary_link, $user_link) === false) {
$action = apply_filters('buddyreshare_prepare_reshare_content', sprintf(__('%s reshared a <a href="%s">content</a> originally shared by %s', 'bp-reshare'), bp_core_get_userlink(bp_loggedin_user_id()), $activity->primary_link, bp_core_get_userlink($activity->user_id)), $activity);
} else {
$action = apply_filters('buddyreshare_prepare_reshare_nocontent', sprintf(__('%s reshared some content originally shared by %s', 'bp-reshare'), bp_core_get_userlink(bp_loggedin_user_id()), bp_core_get_userlink($activity->user_id)), $activity);
}
} else {
$action = apply_filters('buddyreshare_prepare_reshare_activity', sprintf(__('%s reshared an activity originally shared by %s', 'bp-reshare'), bp_core_get_userlink(bp_loggedin_user_id()), $secondary_avatar . bp_core_get_userlink($activity->user_id)), $activity);
}
$reshared_args = array('action' => apply_filters('bp_reshare_action_parent_activity', $action, $activity->type), 'content' => $activity->content, 'component' => $component, 'type' => 'reshare_update', 'user_id' => bp_loggedin_user_id(), 'secondary_item_id' => $activity_id, 'recorded_time' => bp_core_current_time(), 'hide_sitewide' => $activity->hide_sitewide);
if (!empty($item_id)) {
$reshared_args['item_id'] = $item_id;
}
return apply_filters('buddyreshare_prepare_reshare', $reshared_args, $activity_id);
}
示例14: 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;
}
示例15: bp_dtheme_blog_comments
/**
* HTML for outputting blog comments as defined by the WP comment API
*
* @param mixed $comment Comment record from database
* @param array $args Arguments from wp_list_comments() call
* @param int $depth Comment nesting level
* @see wp_list_comments()
* @package BuddyPress Theme
* @since 1.2
*/
function bp_dtheme_blog_comments( $comment, $args, $depth ) {
$GLOBALS['comment'] = $comment; ?>
<?php if ( 'pingback' == $comment->comment_type ) return false; ?>
<li id="comment-<?php comment_ID(); ?>">
<div class="comment-avatar-box">
<div class="avb">
<a href="<?php echo get_comment_author_url() ?>" rel="nofollow">
<?php if ( $comment->user_id ) : ?>
<?php echo bp_core_fetch_avatar( array( 'item_id' => $comment->user_id, 'width' => 50, 'height' => 50, 'email' => $comment->comment_author_email ) ); ?>
<?php else : ?>
<?php echo get_avatar( $comment, 50 ) ?>
<?php endif; ?>
</a>
</div>
</div>
<div class="comment-content">
<div class="comment-meta">
<a href="<?php echo get_comment_author_url() ?>" rel="nofollow"><?php echo get_comment_author(); ?></a> <?php _e( 'said:', 'buddypress' ) ?>
<em><?php _e( 'On', 'buddypress' ) ?> <a href="#comment-<?php comment_ID() ?>" title=""><?php comment_date() ?></a></em>
</div>
<?php if ( $comment->comment_approved == '0' ) : ?>
<em class="moderate"><?php _e('Your comment is awaiting moderation.'); ?></em><br />
<?php endif; ?>
<?php comment_text() ?>
<div class="comment-options">
<?php echo comment_reply_link( array('depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ?>
<?php edit_comment_link( __( 'Edit' ),'','' ); ?>
</div>
</div>
<?php
}