コード例 #1
0
/**
 * 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
0
ファイル: bp-core-classes.php プロジェクト: n-sane/zaroka
	/**
	 * 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
0
/**
 * 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
0
 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
0
/**
 * 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
0
ファイル: functions.php プロジェクト: httvncoder/151722441
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
0
 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
0
 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
0
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
0
ファイル: functions.php プロジェクト: Lady1178/bp-chat
/**
 * 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
0
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
0
/**
 * 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
0
ファイル: functions.php プロジェクト: socialray/surfied-2-0
/**
 * 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
0
 /**
  * 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
0
ファイル: functions.php プロジェクト: n-sane/zaroka
/**
 * 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
}
コード例 #16
0
ファイル: bp-friends.php プロジェクト: n-sane/zaroka
function friends_setup_nav() {
	global $bp;

	/* Add 'Friends' to the main navigation */
	bp_core_new_nav_item( array( 'name' => sprintf( __( 'Friends <span>(%d)</span>', 'buddypress' ), friends_get_total_friend_count() ), 'slug' => $bp->friends->slug, 'position' => 60, 'screen_function' => 'friends_screen_my_friends', 'default_subnav_slug' => 'my-friends', 'item_css_id' => $bp->friends->id ) );

	$friends_link = $bp->loggedin_user->domain . $bp->friends->slug . '/';

	/* Add the subnav items to the friends nav item */
	bp_core_new_subnav_item( array( 'name' => __( 'My Friends', 'buddypress' ), 'slug' => 'my-friends', 'parent_url' => $friends_link, 'parent_slug' => $bp->friends->slug, 'screen_function' => 'friends_screen_my_friends', 'position' => 10, 'item_css_id' => 'friends-my-friends' ) );
	bp_core_new_subnav_item( array( 'name' => __( 'Requests', 'buddypress' ), 'slug' => 'requests', 'parent_url' => $friends_link, 'parent_slug' => $bp->friends->slug, 'screen_function' => 'friends_screen_requests', 'position' => 20, 'user_has_access' => bp_is_my_profile() ) );

	if ( $bp->current_component == $bp->friends->slug ) {
		if ( bp_is_my_profile() ) {
			$bp->bp_options_title = __( 'My Friends', 'buddypress' );
		} else {
			$bp->bp_options_avatar = bp_core_fetch_avatar( array( 'item_id' => $bp->displayed_user->id, 'type' => 'thumb' ) );
			$bp->bp_options_title = $bp->displayed_user->fullname;
		}
	}

	do_action( 'friends_setup_nav' );
}
コード例 #17
0
function bp_friends_random_members( $total_members = 5 ) {
	global $bp;

	if ( !$user_ids = wp_cache_get( 'friends_random_users', 'bp' ) ) {
		$user_ids = BP_Core_User::get_users( 'random', $total_members );
		wp_cache_set( 'friends_random_users', $user_ids, 'bp' );
	}
?>
	<?php if ( $user_ids['users'] ) { ?>
		<ul class="item-list" id="random-members-list">
		<?php for ( $i = 0; $i < count( $user_ids['users'] ); $i++ ) { ?>
			<li>
				<a href="<?php echo bp_core_get_user_domain( $user_ids['users'][$i]->user_id ) ?>"><?php echo bp_core_fetch_avatar( array( 'item_id' => $user_ids['users'][$i]->user_id, 'type' => 'thumb' ) ) ?></a>
				<h5><?php echo bp_core_get_userlink( $user_ids['users'][$i]->user_id ) ?></h5>
				<?php if ( function_exists( 'xprofile_get_random_profile_data' ) ) { ?>
					<?php $random_data = xprofile_get_random_profile_data( $user_ids['users'][$i]->user_id, true ); ?>
					<div class="profile-data">
						<p class="field-name"><?php echo $random_data[0]->name ?></p>
						<?php echo $random_data[0]->value ?>
					</div>
				<?php } ?>

				<div class="action">
					<?php if ( function_exists( 'bp_add_friend_button' ) ) { ?>
						<?php bp_add_friend_button( $user_ids['users'][$i]->user_id ) ?>
					<?php } ?>
				</div>
			</li>
		<?php } ?>
		</ul>
	<?php } else { ?>
		<div id="message" class="info">
			<p><?php _e( "There aren't enough site members to show a random sample just yet.", 'buddypress' ) ?></p>
		</div>
	<?php } ?>
<?php
}
コード例 #18
0
function bp_gtm_get_resp_tabs()
{
    global $bp;
    if (isset($_GET['r'])) {
        $user_id = bp_core_get_userid($_GET['r']);
        if ($user_id) {
            ?>
            <li id="un-<?php 
            echo $_GET['r'];
            ?>
" class="resps-tab">
                <span>
                    <?php 
            echo bp_core_fetch_avatar(array('item_id' => $user_id, 'type' => 'thumb', 'width' => 15, 'height' => 15));
            ?>
                    <?php 
            echo bp_core_get_userlink($user_id);
            ?>
                </span>
            </li>
            <?php 
        }
    }
}
コード例 #19
0
 function wplms_coauthor_plus_instructor($instructor, $id)
 {
     if (function_exists('get_coauthors')) {
         $coauthors = get_coauthors($id);
         $instructor = '';
         foreach ($coauthors as $k => $inst) {
             $instructor_id = $inst->ID;
             $displayname = bp_core_get_user_displayname($instructor_id);
             if (function_exists('vibe_get_option')) {
                 $field = vibe_get_option('instructor_field');
             }
             $special = '';
             if (bp_is_active('xprofile')) {
                 $special = bp_get_profile_field_data('field=' . $field . '&user_id=' . $instructor_id);
             }
             $r = array('item_id' => $instructor_id, 'object' => 'user');
             $instructor .= '<div class="instructor_course"><div class="item-avatar">' . bp_core_fetch_avatar($r) . '</div>';
             $instructor .= '<h5 class="course_instructor"><a href="' . bp_core_get_user_domain($instructor_id) . '">' . $displayname . '<span>' . $special . '</span></a></h5>';
             $instructor .= apply_filters('wplms_instructor_meta', '', $instructor_id);
             $instructor .= '</div>';
         }
     }
     return $instructor;
 }
コード例 #20
0
ファイル: theme-functions.php プロジェクト: quyip8818/wps
 function kleo_ajax_search()
 {
     //if "s" input is missing exit
     if (empty($_REQUEST['s']) && empty($_REQUEST['bbp_search'])) {
         die;
     }
     if (!empty($_REQUEST['bbp_search'])) {
         $search_string = $_REQUEST['bbp_search'];
     } else {
         $search_string = $_REQUEST['s'];
     }
     $output = "";
     $context = "any";
     $defaults = array('numberposts' => 4, 'posts_per_page' => 20, 'post_type' => 'any', 'post_status' => 'publish', 'post_password' => '', 'suppress_filters' => false, 's' => $_REQUEST['s']);
     if (isset($_REQUEST['context']) && $_REQUEST['context'] != '') {
         $context = explode(",", $_REQUEST['context']);
         $defaults['post_type'] = $context;
     }
     $defaults = apply_filters('kleo_ajax_query_args', $defaults);
     $the_query = new WP_Query($defaults);
     $posts = $the_query->get_posts();
     $members = array();
     $members['total'] = 0;
     $groups = array();
     $groups['total'] = 0;
     $forums = FALSE;
     if (function_exists('bp_is_active') && ($context == "any" || in_array("members", $context))) {
         $members = bp_core_get_users(array('search_terms' => $search_string, 'per_page' => $defaults['numberposts'], 'populate_extras' => false));
     }
     if (function_exists('bp_is_active') && bp_is_active("groups") && ($context == "any" || in_array("groups", $context))) {
         $groups = groups_get_groups(array('search_terms' => $search_string, 'per_page' => $defaults['numberposts'], 'populate_extras' => false));
     }
     if (class_exists('bbPress') && ($context == "any" || in_array("forum", $context))) {
         $forums = kleo_bbp_get_replies($search_string);
     }
     //if there are no posts, groups nor members
     if (empty($posts) && $members['total'] == 0 && $groups['total'] == 0 && !$forums) {
         $output = "<div class='kleo_ajax_entry ajax_not_found'>";
         $output .= "<div class='ajax_search_content'>";
         $output .= "<i class='icon icon-exclamation-sign'></i> ";
         $output .= __("Sorry, we haven't found anything based on your criteria.", 'kleo_framework');
         $output .= "<br>";
         $output .= __("Please try searching by different terms.", 'kleo_framework');
         $output .= "</div>";
         $output .= "</div>";
         echo $output;
         die;
     }
     //if there are members
     if ($members['total'] != 0) {
         $output .= '<div class="kleo-ajax-part kleo-ajax-type-members">';
         $output .= '<h4><span>' . __("Members", 'kleo_framework') . '</span></h4>';
         foreach ((array) $members['users'] as $member) {
             $image = '<img src="' . bp_core_fetch_avatar(array('item_id' => $member->ID, 'width' => 25, 'height' => 25, 'html' => false)) . '" class="kleo-rounded" alt="">';
             if ($update = bp_get_user_meta($member->ID, 'bp_latest_update', true)) {
                 $latest_activity = char_trim(trim(strip_tags(bp_create_excerpt($update['content'], 50, "..."))));
             } else {
                 $latest_activity = '';
             }
             $output .= "<div class ='kleo_ajax_entry'>";
             $output .= "<div class='ajax_search_image'>{$image}</div>";
             $output .= "<div class='ajax_search_content'>";
             $output .= "<a href='" . bp_core_get_user_domain($member->ID) . "' class='search_title'>";
             $output .= $member->display_name;
             $output .= "</a>";
             $output .= "<span class='search_excerpt'>";
             $output .= $latest_activity;
             $output .= "</span>";
             $output .= "</div>";
             $output .= "</div>";
         }
         $output .= "<a class='ajax_view_all' href='" . bp_get_members_directory_permalink() . "?s=" . $search_string . "'>" . __('View member results', 'kleo_framework') . "</a>";
         $output .= "</div>";
     }
     //if there are groups
     if ($groups['total'] != 0) {
         $output .= '<div class="kleo-ajax-part kleo-ajax-type-groups">';
         $output .= '<h4><span>' . __("Groups", 'kleo_framework') . '</span></h4>';
         foreach ((array) $groups['groups'] as $group) {
             $image = '<img src="' . bp_core_fetch_avatar(array('item_id' => $group->id, 'object' => 'group', 'width' => 25, 'height' => 25, 'html' => false)) . '" class="kleo-rounded" alt="">';
             $output .= "<div class ='kleo_ajax_entry'>";
             $output .= "<div class='ajax_search_image'>{$image}</div>";
             $output .= "<div class='ajax_search_content'>";
             $output .= "<a href='" . bp_get_group_permalink($group) . "' class='search_title'>";
             $output .= $group->name;
             $output .= "</a>";
             $output .= "</div>";
             $output .= "</div>";
         }
         $output .= "<a class='ajax_view_all' href='" . bp_get_groups_directory_permalink() . "?s=" . $search_string . "'>" . __('View group results', 'kleo_framework') . "</a>";
         $output .= "</div>";
     }
     //if there are posts
     if (!empty($posts)) {
         $post_types = array();
         $post_type_obj = array();
         foreach ($posts as $post) {
             $post_types[$post->post_type][] = $post;
             if (empty($post_type_obj[$post->post_type])) {
                 $post_type_obj[$post->post_type] = get_post_type_object($post->post_type);
             }
         }
         foreach ($post_types as $ptype => $post_type) {
             $output .= '<div class="kleo-ajax-part kleo-ajax-type-' . esc_attr($post_type_obj[$ptype]->name) . '">';
             if (isset($post_type_obj[$ptype]->labels->name)) {
                 $output .= "<h4><span>" . $post_type_obj[$ptype]->labels->name . "</span></h4>";
             } else {
                 $output .= "<hr>";
             }
             $count = 0;
             foreach ($post_type as $post) {
                 $count++;
                 if ($count > 4) {
                     continue;
                 }
                 $format = get_post_format($post->ID);
                 if ($img_url = kleo_get_post_thumbnail_url($post->ID)) {
                     $image = aq_resize($img_url, 44, 44, true, true, true);
                     if (!$image) {
                         $image = $img_url;
                     }
                     $image = '<img src="' . $image . '" class="kleo-rounded">';
                 } else {
                     if ($format == 'video') {
                         $image = "<i class='icon icon-video'></i>";
                     } elseif ($format == 'image' || $format == 'gallery') {
                         $image = "<i class='icon icon-picture'></i>";
                     } else {
                         $image = "<i class='icon icon-link'></i>";
                     }
                 }
                 $excerpt = "";
                 if (!empty($post->post_content)) {
                     $excerpt = char_trim(trim(strip_tags(strip_shortcodes($post->post_content))), 40, "...");
                 }
                 $link = apply_filters('kleo_custom_url', get_permalink($post->ID));
                 $classes = "format-" . $format;
                 $output .= "<div class ='kleo_ajax_entry {$classes}'>";
                 $output .= "<div class='ajax_search_image'>{$image}</div>";
                 $output .= "<div class='ajax_search_content'>";
                 $output .= "<a href='{$link}' class='search_title'>";
                 $output .= get_the_title($post->ID);
                 $output .= "</a>";
                 $output .= "<span class='search_excerpt'>";
                 $output .= $excerpt;
                 $output .= "</span>";
                 $output .= "</div>";
                 $output .= "</div>";
             }
             $output .= '</div>';
         }
         $output .= "<a class='ajax_view_all' href='" . home_url('/') . '?s=' . $search_string . "'>" . __('View all results', 'kleo_framework') . "</a>";
     }
     /* Forums topics search */
     if (!empty($forums)) {
         $output .= '<div class="kleo-ajax-part kleo-ajax-type-forums">';
         $output .= '<h4><span>' . __("Forums", 'kleo_framework') . '</span></h4>';
         $i = 0;
         foreach ($forums as $fk => $forum) {
             $i++;
             if ($i <= 4) {
                 $image = "<i class='icon icon-chat-1'></i>";
                 $output .= "<div class ='kleo_ajax_entry'>";
                 $output .= "<div class='ajax_search_image'>{$image}</div>";
                 $output .= "<div class='ajax_search_content'>";
                 $output .= "<a href='" . $forum['url'] . "' class='search_title'>";
                 $output .= $forum['name'];
                 $output .= "</a>";
                 //$output .= "<span class='search_excerpt'>";
                 //$output .= $latest_activity;
                 //$output .= "</span>";
                 $output .= "</div>";
                 $output .= "</div>";
             }
         }
         $output .= "<a class='ajax_view_all' href='" . bbp_get_search_url() . "?bbp_search=" . $search_string . "'>" . __('View forum results', 'kleo_framework') . "</a>";
         $output .= "</div>";
     }
     echo $output;
     die;
 }
コード例 #21
0
 /**
  * Name column, and "quick admin" rollover actions.
  *
  * Called "comment" in the CSS so we can re-use some WP core CSS.
  *
  * @since 1.7.0
  *
  * @see WP_List_Table::single_row_columns()
  *
  * @param array $item A singular item (one full row).
  */
 public function column_comment($item = array())
 {
     // Preorder items: Edit | Delete | View
     $actions = array('edit' => '', 'delete' => '', 'view' => '');
     // We need the group object for some BP functions
     $item_obj = (object) $item;
     // Build actions URLs
     $base_url = bp_get_admin_url('admin.php?page=bp-groups&amp;gid=' . $item['id']);
     $delete_url = wp_nonce_url($base_url . "&amp;action=delete", 'bp-groups-delete');
     $edit_url = $base_url . '&amp;action=edit';
     $view_url = bp_get_group_permalink($item_obj);
     /**
      * Filters the group name for a group's column content.
      *
      * @since 1.7.0
      *
      * @param string $value Name of the group being rendered.
      * @param array  $item  Array for the current group item.
      */
     $group_name = apply_filters_ref_array('bp_get_group_name', array($item['name']), $item);
     // Rollover actions
     // Edit
     $actions['edit'] = sprintf('<a href="%s">%s</a>', esc_url($edit_url), __('Edit', 'buddypress'));
     // Delete
     $actions['delete'] = sprintf('<a href="%s">%s</a>', esc_url($delete_url), __('Delete', 'buddypress'));
     // Visit
     $actions['view'] = sprintf('<a href="%s">%s</a>', esc_url($view_url), __('View', 'buddypress'));
     /**
      * Filters the actions that will be shown for the column content.
      *
      * @since 1.7.0
      *
      * @param array $value Array of actions to be displayed for the column content.
      * @param array $item  The current group item in the loop.
      */
     $actions = apply_filters('bp_groups_admin_comment_row_actions', array_filter($actions), $item);
     // Get group name and avatar
     $avatar = '';
     if (buddypress()->avatar->show_avatars) {
         $avatar = bp_core_fetch_avatar(array('item_id' => $item['id'], 'object' => 'group', 'type' => 'thumb', 'avatar_dir' => 'group-avatars', 'alt' => sprintf(__('Group logo of %s', 'buddypress'), $group_name), 'width' => '32', 'height' => '32', 'title' => $group_name));
     }
     $content = sprintf('<strong><a href="%s">%s</a></strong>', esc_url($edit_url), $group_name);
     echo $avatar . ' ' . $content . ' ' . $this->row_actions($actions);
 }
コード例 #22
0
ファイル: User.php プロジェクト: KulwinderKohli/json-api-user
 public function get_avatar()
 {
     global $json_api;
     if (function_exists('bp_is_active')) {
         if (!$json_api->query->user_id) {
             $json_api->error("You must include 'user_id' var in your request. ");
         }
         if (!$json_api->query->type) {
             $json_api->error("You must include 'type' var in your request. possible values 'full' or 'thumb' ");
         }
         $avatar = bp_core_fetch_avatar(array('item_id' => $json_api->query->user_id, 'type' => $json_api->query->type, 'html' => false));
         return array('avatar' => $avatar);
     } else {
         $json_api->error("You must install and activate BuddyPress plugin to use this method.");
     }
 }
コード例 #23
0
if (bp_has_members("include={$_POST['userid']}&max=1")) {
    ?>

    <?php 
    while (bp_members()) {
        bp_the_member();
        global $members_template;
        ?>

        <?php 
        /* The loop for the member you're showing a hovercard for is set up. Place hovercard code here */
        ?>

        <div class="tipsy-avatar">
            <img src="<?php 
        echo bp_core_fetch_avatar(array('item_id' => bp_get_member_user_id(), 'type' => 'full', 'width' => 100, 'height' => 100, 'html' => false));
        ?>
">
        </div>

        <div class='tipsy-content'>

            <div class="user">

                <h3>
                    <?php 
        // iexpert_skype_status( xprofile_get_field_data( 'skype', bp_get_member_user_id() ) );
        ?>

                    <a href="<?php 
        bp_member_link();
コード例 #24
0
ファイル: ajax.php プロジェクト: hscale/webento
/**
 * bp_dtheme_ajax_messages_autocomplete_results()
 *
 * AJAX handler for autocomplete. Displays friends only, unless BP_MESSAGES_AUTOCOMPLETE_ALL is defined
 *
 * @global object object $bp Global BuddyPress settings object
 * @return none
 */
function bp_dtheme_ajax_messages_autocomplete_results()
{
    global $bp;
    // Include everyone in the autocomplete, or just friends?
    if ($bp->messages->slug == $bp->current_component) {
        $autocomplete_all = $bp->messages->autocomplete_all;
    }
    $friends = false;
    $pag_page = 1;
    $limit = $_GET['limit'] ? $_GET['limit'] : apply_filters('bp_autocomplete_max_results', 10);
    // Get the user ids based on the search terms
    if (!empty($autocomplete_all)) {
        $users = BP_Core_User::search_users($_GET['q'], $limit, $pag_page);
        if (!empty($users['users'])) {
            // Build an array with the correct format
            $user_ids = array();
            foreach ($users['users'] as $user) {
                if ($user->id != $bp->loggedin_user->id) {
                    $user_ids[] = $user->id;
                }
            }
            $user_ids = apply_filters('bp_core_autocomplete_ids', $user_ids, $_GET['q'], $limit);
        }
    } else {
        if (bp_is_active('friends')) {
            $users = friends_search_friends($_GET['q'], $bp->loggedin_user->id, $limit, 1);
            // Keeping the bp_friends_autocomplete_list filter for backward compatibility
            $users = apply_filters('bp_friends_autocomplete_list', $users, $_GET['q'], $limit);
            if (!empty($users['friends'])) {
                $user_ids = apply_filters('bp_friends_autocomplete_ids', $users['friends'], $_GET['q'], $limit);
            }
        }
    }
    if (!empty($user_ids)) {
        foreach ($user_ids as $user_id) {
            $ud = get_userdata($user_id);
            if (!$ud) {
                continue;
            }
            if (bp_is_username_compatibility_mode()) {
                $username = $ud->user_login;
            } else {
                $username = $ud->user_nicename;
            }
            echo '<span id="link-' . $username . '" href="' . bp_core_get_user_domain($user_id) . '"></span>' . bp_core_fetch_avatar(array('item_id' => $user_id, 'type' => 'thumb', 'width' => 15, 'height' => 15)) . ' &nbsp;' . bp_core_get_user_displayname($user_id) . ' (' . $username . ')
			';
        }
    }
}
コード例 #25
0
ファイル: bp-messages.php プロジェクト: n-sane/zaroka
function messages_setup_nav() {
	global $bp;

	if ( $count = messages_get_unread_count() )
		$name = sprintf( __('Messages <strong>(%s)</strong>', 'buddypress'), $count );
	else
		$name = __('Messages <strong></strong>', 'buddypress');

	/* Add 'Messages' to the main navigation */
	bp_core_new_nav_item( array( 'name' => $name, 'slug' => $bp->messages->slug, 'position' => 50, 'show_for_displayed_user' => false, 'screen_function' => 'messages_screen_inbox', 'default_subnav_slug' => 'inbox', 'item_css_id' => $bp->messages->id ) );

	$messages_link = $bp->loggedin_user->domain . $bp->messages->slug . '/';

	/* Add the subnav items to the profile */
	bp_core_new_subnav_item( array( 'name' => __( 'Inbox', 'buddypress' ) . $count_indicator, 'slug' => 'inbox', 'parent_url' => $messages_link, 'parent_slug' => $bp->messages->slug, 'screen_function' => 'messages_screen_inbox', 'position' => 10, 'user_has_access' => bp_is_my_profile() ) );
	bp_core_new_subnav_item( array( 'name' => __( 'Sent Messages', 'buddypress' ), 'slug' => 'sentbox', 'parent_url' => $messages_link, 'parent_slug' => $bp->messages->slug, 'screen_function' => 'messages_screen_sentbox', 'position' => 20, 'user_has_access' => bp_is_my_profile() ) );
	bp_core_new_subnav_item( array( 'name' => __( 'Compose', 'buddypress' ), 'slug' => 'compose', 'parent_url' => $messages_link, 'parent_slug' => $bp->messages->slug, 'screen_function' => 'messages_screen_compose', 'position' => 30, 'user_has_access' => bp_is_my_profile() ) );

	if ( is_super_admin() )
		bp_core_new_subnav_item( array( 'name' => __( 'Notices', 'buddypress' ), 'slug' => 'notices', 'parent_url' => $messages_link, 'parent_slug' => $bp->messages->slug, 'screen_function' => 'messages_screen_notices', 'position' => 90, 'user_has_access' => is_super_admin() ) );

	if ( $bp->current_component == $bp->messages->slug ) {
		if ( bp_is_my_profile() ) {
			$bp->bp_options_title = __( 'My Messages', 'buddypress' );
		} else {
			$bp_options_avatar =  bp_core_fetch_avatar( array( 'item_id' => $bp->displayed_user->id, 'type' => 'thumb' ) );
			$bp->bp_options_title = $bp->displayed_user->fullname;
		}
	}

	do_action( 'messages_setup_nav' );
}
コード例 #26
0
 function the_invite()
 {
     global $group_id;
     $this->in_the_loop = true;
     $user_id = $this->next_invite();
     $this->invite = new stdClass();
     $this->invite->user = $this->invite_data[$user_id];
     // This method previously populated the user object with
     // BP_Core_User. We manually configure BP_Core_User data for
     // backward compatibility.
     if (bp_is_active('xprofile')) {
         $this->invite->user->profile_data = BP_XProfile_ProfileData::get_all_for_user($user_id);
     }
     $this->invite->user->avatar = bp_core_fetch_avatar(array('item_id' => $user_id, 'type' => 'full', 'alt' => sprintf(__('Avatar of %s', 'buddypress'), $this->invite->user->fullname)));
     $this->invite->user->avatar_thumb = bp_core_fetch_avatar(array('item_id' => $user_id, 'type' => 'thumb', 'alt' => sprintf(__('Avatar of %s', 'buddypress'), $this->invite->user->fullname)));
     $this->invite->user->avatar_mini = bp_core_fetch_avatar(array('item_id' => $user_id, 'type' => 'thumb', 'alt' => sprintf(__('Avatar of %s', 'buddypress'), $this->invite->user->fullname), 'width' => 30, 'height' => 30));
     $this->invite->user->email = $this->invite->user->user_email;
     $this->invite->user->user_url = bp_core_get_user_domain($user_id, $this->invite->user->user_nicename, $this->invite->user->user_login);
     $this->invite->user->user_link = "<a href='{$this->invite->user->user_url}' title='{$this->invite->user->fullname}'>{$this->invite->user->fullname}</a>";
     $this->invite->user->last_active = bp_core_get_last_activity($this->invite->user->last_activity, __('active %s', 'buddypress'));
     if (bp_is_active('groups')) {
         $total_groups = BP_Groups_Member::total_group_count($user_id);
         $this->invite->user->total_groups = sprintf(_n('%d group', '%d groups', $total_groups, 'buddypress'), $total_groups);
     }
     if (bp_is_active('friends')) {
         $this->invite->user->total_friends = BP_Friends_Friendship::total_friend_count($user_id);
     }
     if (bp_is_active('friends')) {
         $this->invite->user->total_friends = BP_Friends_Friendship::total_friend_count($user_id);
     }
     $this->invite->user->total_blogs = null;
     $this->invite->group_id = $group_id;
     // Globaled in bp_group_has_invites()
     if (0 == $this->current_invite) {
         // loop has just started
         do_action('loop_start');
     }
 }
コード例 #27
0
ファイル: manage-users.php プロジェクト: r-chopra17/p2bp
<div class="forums">
<?php if(gf_current_user_can_admin()):?>
	<?php
	//it is a copy paste/edit of wpmu-users.php, we will make it much better in next version
	include_once(ABSPATH.WPINC."/user.php");
	include_once(ABSPATH."wp-admin/includes/user.php");
    ?>
<div class="users">
	<?php
	$apage = isset( $_GET['apage'] ) ? intval( $_GET['apage'] ) : 1;
	$num = isset( $_GET['num'] ) ? intval( $_GET['num'] ) :5;
	$s = wp_specialchars( trim( $_GET[ 's' ] ) );
	$query = "SELECT * FROM {$wpdb->users} WHERE ";
        $where_sql=array();
	if( !empty( $s ) ) {
		$search = '%' . trim( $s ) . '%';
		$where_sql[]= " user_login LIKE '$search' OR user_email LIKE '$search'";
	}
      $where_sql[]="user_status=0";
      if(function_exists("is_multisite")&&is_multisite()||function_exists("add_new_user_to_blog"))
          $where_sql[]="spam=0 AND deleted=0";
      $where_sql=join(" AND ", $where_sql);
      $query.=$where_sql;
	if( !isset($_GET['sortby']) ) {
		$_GET['sortby'] = 'id';
	}
	if( $_GET['sortby'] == 'email' ) {
		$query .= ' ORDER BY user_email ';
	} elseif( $_GET['sortby'] == 'id' ) {
		$query .= ' ORDER BY ID ';
コード例 #28
0
ファイル: theme.php プロジェクト: JeffreyBue/jb
    function wpmudev_blog_comments($comment, $args, $depth)
    {
        global $themename, $shortname, $options, $options2, $options3, $bp_existed, $multi_site_on;
        if ($bp_existed == 'true') {
            $GLOBALS['comment'] = $comment;
            if ('pingback' == $comment->comment_type) {
                return false;
            }
            if (1 == $depth) {
                $avatar_size = 50;
            } else {
                $avatar_size = 25;
            }
            ?>

	<li <?php 
            comment_class();
            ?>
 id="li-comment-<?php 
            comment_ID();
            ?>
">
		<div id="comment-<?php 
            comment_ID();
            ?>
">
		<div class="comment-author vcard">
				<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' => $avatar_size, 'height' => $avatar_size, 'email' => $comment->comment_author_email));
                ?>
					<?php 
            } else {
                ?>
						<?php 
                echo get_avatar($comment, $avatar_size);
                ?>
					<?php 
            }
            ?>
				</div>
					<?php 
            if ($comment->comment_approved == '0') {
                ?>
						<em><?php 
                _e('Your comment is awaiting moderation.', 'framemarket');
                ?>
</em>
						<br />
					<?php 
            }
            ?>

					<div class="comment-meta commentmetadata"><a href="<?php 
            echo esc_url(get_comment_link($comment->comment_ID));
            ?>
">
						<?php 
            printf(__('%1$s at %2$s', 'framemarket'), get_comment_date(), get_comment_time());
            ?>
</a><?php 
            edit_comment_link(__('(Edit)', 'framemarket'), ' ');
            ?>
					</div>

					<div class="comment-body"><?php 
            comment_text();
            ?>
</div>

					<div class="reply">
						<?php 
            comment_reply_link(array_merge($args, array('depth' => $depth, 'max_depth' => $args['max_depth'])));
            ?>
					</div>
				</div>

		<?php 
        } else {
            $GLOBALS['comment'] = $comment;
            if ('pingback' == $comment->comment_type) {
                return false;
            }
            if (1 == $depth) {
                $avatar_size = 50;
            } else {
                $avatar_size = 25;
            }
            ?>
<li <?php 
            comment_class();
            ?>
 id="li-comment-<?php 
            comment_ID();
            ?>
">
	<div id="comment-<?php 
            comment_ID();
            ?>
">
	<div class="comment-author vcard">
				<a href="<?php 
            echo get_comment_author_url();
            ?>
" rel="nofollow">
					<?php 
            if ($comment->user_id) {
                ?>
							<?php 
                echo get_avatar($comment, 40);
                ?>
					<?php 
            } else {
                ?>
						<?php 
                echo get_avatar($comment, $avatar_size);
                ?>
					<?php 
            }
            ?>
	</div>
		<?php 
            if ($comment->comment_approved == '0') {
                ?>
			<em><?php 
                _e('Your comment is awaiting moderation.', 'framemarket');
                ?>
</em>
			<br />
		<?php 
            }
            ?>

		<div class="comment-meta commentmetadata"><a href="<?php 
            echo esc_url(get_comment_link($comment->comment_ID));
            ?>
">
			<?php 
            printf(__('%1$s at %2$s', 'framemarket'), get_comment_date(), get_comment_time());
            ?>
</a><?php 
            edit_comment_link(__('(Edit)', 'framemarket'), ' ');
            ?>
		</div>

		<div class="comment-body"><?php 
            comment_text();
            ?>
</div>

		<div class="reply">
			<?php 
            comment_reply_link(array_merge($args, array('depth' => $depth, 'max_depth' => $args['max_depth'])));
            ?>
		</div>
	</div>

<?php 
        }
    }
コード例 #29
0
/**
 * Check if a given user ID has an uploaded avatar.
 *
 * @since 1.0.0
 *
 * @param int $user_id ID of the user whose avatar is being checked.
 *
 * @return bool True if the user has uploaded a local avatar. Otherwise false.
 */
function bp_get_user_has_avatar($user_id = 0)
{
    if (empty($user_id)) {
        $user_id = bp_displayed_user_id();
    }
    $retval = false;
    if (bp_core_fetch_avatar(array('item_id' => $user_id, 'no_grav' => true, 'html' => false)) != bp_core_avatar_default('local')) {
        $retval = true;
    }
    /**
     * Filters whether or not a user has an uploaded avatar.
     *
     * @since 1.6.0
     *
     * @param bool $retval  Whether or not a user has an uploaded avatar.
     * @param int  $user_id ID of the user being checked.
     */
    return (bool) apply_filters('bp_get_user_has_avatar', $retval, $user_id);
}
コード例 #30
0
/**
 * Return the avatar of the user who posted the current post in the loop.
 *
 * @param array $args {
 *     Arguments for building the avatar.
 *     @type string $type Avatar type. 'thumb' or 'full'. Default:
 *           'thumb'.
 *     @type int $width Width of the avatar, in pixels. Default: the
 *           width corresponding to $type.
 *           See {@link bp_core_fetch_avatar()}.
 *     @type int $height Height of the avatar, in pixels. Default: the
 *           height corresponding to $type.
 *           See {@link bp_core_fetch_avatar()}.
 *     @type string $alt The text of the image's 'alt' attribute.
 *           Default: 'Profile picture of [user name]'.
 * }
 * @return string HTML of user avatar.
 */
function bp_get_the_topic_post_poster_avatar($args = '')
{
    global $topic_template;
    $defaults = array('type' => 'thumb', 'width' => 20, 'height' => 20, 'alt' => __('Profile picture of %s', 'buddypress'));
    $r = wp_parse_args($args, $defaults);
    extract($r, EXTR_SKIP);
    return apply_filters('bp_get_the_topic_post_poster_avatar', bp_core_fetch_avatar(array('item_id' => $topic_template->post->poster_id, 'type' => $type, 'width' => $width, 'height' => $height, 'alt' => $alt)));
}