Class BP_Core_User

Description

BP_Core_User class can be used by any component. It will fetch useful details for any user when provided with a user_id.

Example: $user = new BP_Core_User( $user_id ); $user_avatar = $user->avatar; $user_email = $user->email; $user_status = $user->status; etc.

Located in /bp-core/bp-core-classes.php (line 615)


	
			
Variable Summary
string $avatar
string $avatar_mini
string $avatar_thumb
string $email
string $fullname
integer $id
string $last_active
integer $total_blogs
integer $total_friends
string $total_groups
string $user_link
string $user_url
Method Summary
static array get_core_userdata (integer $user_id)
static array get_specific_users (array $user_ids, [integer $limit = null], [integer $page = 1], [boolean $populate_extras = true])
static mixed get_users_by_letter (string $letter, [integer $limit = null], [integer $page = 1], [boolean $populate_extras = true], [string $exclude = ''])
static mixed get_user_extras ( &$paged_users,  &$user_ids, [string $type = false], array $paged_users, string $user_ids)
static array search_users (string $search_terms, [integer $limit = null], [integer $page = 1], [boolean $populate_extras = true])
BP_Core_User __construct (integer $user_id, [boolean $populate_extras = false])
void get_users ( $type, [ $limit = 0], [ $page = 1], [ $user_id = 0], [ $include = false], [ $search_terms = false], [ $populate_extras = true], [ $exclude = false], [ $meta_key = false], [ $meta_value = false])
void populate ()
void populate_extras ()
Variables
string $avatar (line 629)

The URL to the full size of the avatar for the user.

string $avatar_mini (line 643)

The URL to the mini size of the avatar for the user.

string $avatar_thumb (line 636)

The URL to the thumb size of the avatar for the user.

string $email (line 657)

The email for the user.

string $fullname (line 650)

The full name of the user

integer $id (line 622)

ID of the user which the object relates to.

string $last_active (line 680)

Contains a formatted string when the last time the user was active.

Example: "active 2 hours and 50 minutes ago"

array $profile_data (line 714)

Profile information for the specific user.

  • since: BuddyPress (1.2)
  • access: public
integer $total_blogs (line 697)

The total number of blog posts posted by the user

  • deprecated: No longer used
integer $total_friends (line 689)

The total number of "Friends" the user has on site.

string $total_groups (line 706)

The total number of groups the user is a part of.

Example: "1 group", "2 groups"

string $user_link (line 671)

The HTML for the user link, with the link text being the user's full name.

string $user_url (line 664)

The absolute url for the user's profile.

Methods
static method get_core_userdata (line 1219)

Get WordPress user details for a specified user.

static array get_core_userdata (integer $user_id)
  • integer $user_id: User ID
static method get_specific_users (line 1050)

Get details of specific users from the database

  • return: Associative array
static array get_specific_users (array $user_ids, [integer $limit = null], [integer $page = 1], [boolean $populate_extras = true])
  • array $user_ids: The user IDs of the users who we wish to fetch information on.
  • integer $limit: The limit of results we want.
  • integer $page: The page we are on for pagination.
  • boolean $populate_extras: Populate extra user fields?
static method get_users_by_letter (line 985)

Fetches the user details for all the users who username starts with the letter given.

  • return: False on error, otherwise associative array of results.
static mixed get_users_by_letter (string $letter, [integer $limit = null], [integer $page = 1], [boolean $populate_extras = true], [string $exclude = ''])
  • string $letter: The letter the users names are to start with.
  • integer $limit: The number of users we wish to retrive.
  • integer $page: The page number we are currently on, used in conjunction with $limit to get the start position for the limit.
  • boolean $populate_extras: Populate extra user fields?
  • string $exclude: Comma-separated IDs of users whose results aren't to be fetched.
static method get_user_extras (line 1136)

Fetch extra user information, such as friend count and last profile update message.

Accepts multiple user IDs to fetch data for.

  • return: False on error, otherwise associative array of results.
static mixed get_user_extras ( &$paged_users,  &$user_ids, [string $type = false], array $paged_users, string $user_ids)
  • array $paged_users: an array of stdClass containing the users
  • string $user_ids: the user ids to select information about
  • string $type: the type of fields we wish to get
  • &$paged_users
  • &$user_ids
static method search_users (line 1094)

Find users who match on the value of an xprofile data.

  • return: Associative array
static array search_users (string $search_terms, [integer $limit = null], [integer $page = 1], [boolean $populate_extras = true])
  • string $search_terms: The terms to search the profile table value column for.
  • integer $limit: The limit of results we want.
  • integer $page: The page we are on for pagination.
  • boolean $populate_extras: Populate extra user fields?
Constructor __construct (line 724)

Class constructor.

BP_Core_User __construct (integer $user_id, [boolean $populate_extras = false])
  • integer $user_id: The ID for the user
  • boolean $populate_extras: Whether to fetch extra information such as group/friendship counts or not.
get_profile_data (line 792)
void get_profile_data ()
get_users (line 798)

Static Methods *******************************************************

void get_users ( $type, [ $limit = 0], [ $page = 1], [ $user_id = 0], [ $include = false], [ $search_terms = false], [ $populate_extras = true], [ $exclude = false], [ $meta_key = false], [ $meta_value = false])
  • $type
  • $limit
  • $page
  • $user_id
  • $include
  • $search_terms
  • $populate_extras
  • $exclude
  • $meta_key
  • $meta_value
populate (line 747)

Populate the instantiated class with data based on the User ID provided.

  • uses: bp_get_user_meta() - BP function returns the value of passed usermeta name from usermeta table
  • uses: bp_profile_last_updated_date() - Returns the last updated date for a user.
  • uses: bp_core_get_user_email() - Returns the email address for the user based on user ID
  • 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_fetch_avatar() - Returns HTML formatted avatar for a user
void populate ()
populate_extras (line 780)

Populates extra fields such as group and friendship counts.

void populate_extras ()

Documentation generated on Tue, 23 Jul 2013 01:41:43 +0100 by phpDocumentor 1.4.3