[ Index ]

PHP Cross Reference of BuddyPress

title

Body

[close]

/src/bp-members/ -> bp-members-functions.php (summary)

BuddyPress Member Functions. Functions specific to the members component.

File Size: 2850 lines (86 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 69 functions

  bp_members_has_directory()
  bp_core_define_slugs()
  bp_core_get_users()
  bp_core_get_user_domain()
  bp_core_get_core_userdata()
  bp_core_get_displayed_userid()
  bp_core_get_userid()
  bp_core_get_userid_from_nicename()
  bp_core_get_username()
  bp_members_get_user_nicename()
  bp_core_get_user_email()
  bp_core_get_userlink()
  bp_core_get_user_displaynames()
  bp_core_get_user_displayname()
  bp_core_get_userlink_by_email()
  bp_core_get_userlink_by_username()
  bp_core_get_total_member_count()
  bp_core_get_active_member_count()
  bp_core_update_member_status()
  bp_core_process_spammer_status()
  bp_core_mark_user_spam_admin()
  bp_core_mark_user_ham_admin()
  bp_is_user_spammer()
  bp_is_user_deleted()
  bp_is_user_active()
  bp_is_user_inactive()
  bp_update_user_last_activity()
  _bp_get_user_meta_last_activity_warning()
  _bp_update_user_meta_last_activity_warning()
  bp_get_user_last_activity()
  bp_last_activity_migrate()
  bp_core_get_all_posts_for_user()
  bp_core_delete_account()
  bp_core_delete_avatar_on_user_delete()
  bp_core_ucfirst()
  bp_core_boot_spammer()
  bp_core_remove_data()
  bp_core_can_edit_settings()
  bp_core_flush_illegal_names()
  bp_core_get_illegal_names()
  bp_core_validate_email_address()
  bp_core_add_validation_error_messages()
  bp_core_validate_user_signup()
  bp_core_validate_blog_signup()
  bp_core_signup_user()
  bp_core_signup_blog()
  bp_core_activate_signup()
  bp_members_add_role_after_activation()
  bp_members_migrate_signups()
  bp_core_map_user_registration()
  bp_core_signup_avatar_upload_dir()
  bp_core_signup_send_validation_email()
  bp_core_signup_disable_inactive()
  bp_members_login_resend_activation_email()
  bp_core_wpsignup_redirect()
  bp_stop_live_spammer()
  bp_live_spammer_login_error()
  bp_get_displayed_user()
  bp_member_type_tax_name()
  bp_get_member_type_tax_name()
  bp_register_member_type()
  bp_get_member_type_object()
  bp_get_member_types()
  bp_set_member_type()
  bp_remove_member_type()
  bp_get_member_type()
  bp_has_member_type()
  bp_remove_member_type_on_user_delete()
  bp_get_current_member_type()

Functions
Functions that are not part of a class:

bp_members_has_directory()   X-Ref
Check for the existence of a Members directory page.

return: bool True if found, otherwise false.
since: 1.5.0

bp_core_define_slugs()   X-Ref
Define the slug constants for the Members component.

Handles the three slug constants used in the Members component -
BP_MEMBERS_SLUG, BP_REGISTER_SLUG, and BP_ACTIVATION_SLUG. If these
constants are not overridden in wp-config.php or bp-custom.php, they are
defined here to match the slug of the corresponding WP pages.

In general, fallback values are only used during initial BP page creation,
when no slugs have been explicitly defined.

since: 1.5.0

bp_core_get_users( $args = '' )   X-Ref
Fetch an array of users based on the parameters passed.

Since BuddyPress 1.7, bp_core_get_users() uses BP_User_Query. If you
need backward compatibility with BP_Core_User::get_users(), filter the
bp_use_legacy_user_query value, returning true.

param: array|string $args {
return: array
since: 1.2.0

bp_core_get_user_domain( $user_id = 0, $user_nicename = false, $user_login = false )   X-Ref
Return the domain for the passed user: e.g. http://example.com/members/andy/.

param: int         $user_id       The ID of the user.
param: string|bool $user_nicename Optional. user_nicename of the user.
param: string|bool $user_login    Optional. user_login of the user.
return: string
since: 1.0.0

bp_core_get_core_userdata( $user_id = 0 )   X-Ref
Fetch everything in the wp_users table for a user, without any usermeta.

param: int $user_id The ID of the user.
return: array|bool Array of data on success, boolean false on failure.
since: 1.2.0

bp_core_get_displayed_userid( $user_login )   X-Ref
Return the ID of a user, based on user_login.

No longer used.

param: string $user_login user_login of the user being queried.
return: int

bp_core_get_userid( $username = '' )   X-Ref
Return the user ID based on a user's user_login.

param: string $username user_login to check.
return: int|null The ID of the matched user on success, null on failure.
since: 1.0.0

bp_core_get_userid_from_nicename( $user_nicename = '' )   X-Ref
Return the user ID based on a user's user_nicename.

param: string $user_nicename user_nicename to check.
return: int|null The ID of the matched user on success, null on failure.
since: 1.2.3

bp_core_get_username( $user_id = 0, $user_nicename = false, $user_login = false )   X-Ref
Return the username for a user based on their user id.

This function is sensitive to the BP_ENABLE_USERNAME_COMPATIBILITY_MODE,
so it will return the user_login or user_nicename as appropriate.

param: int         $user_id       User ID to check.
param: string|bool $user_nicename Optional. user_nicename of user being checked.
param: string|bool $user_login    Optional. user_login of user being checked.
return: string The username of the matched user or an empty string if no user is found.
since: 1.0.0

bp_members_get_user_nicename( $user_id )   X-Ref
Return the user_nicename for a user based on their user_id.

This should be used for linking to user profiles and anywhere else a
sanitized and unique slug to a user is needed.

param: int $user_id User ID to check.
return: string The username of the matched user or an empty string if no user is found.
since: 1.5.0

bp_core_get_user_email( $user_id )   X-Ref
Return the email address for the user based on user ID.

param: int $uid User ID to check.
return: string The email for the matched user. Empty string if no user
since: 1.0.0

bp_core_get_userlink( $user_id, $no_anchor = false, $just_link = false )   X-Ref
Return a HTML formatted link for a user with the user's full name as the link text.

Eg: <a href="http://andy.example.com/">Andy Peatling</a>

Optional parameters will return just the name or just the URL.

param: int  $user_id   User ID to check.
param: bool $no_anchor Disable URL and HTML and just return full name.
param: bool $just_link Disable full name and HTML and just return the URL
return: string|bool The link text based on passed parameters, or false on
since: 1.0.0

bp_core_get_user_displaynames( $user_ids )   X-Ref
Fetch the display name for a group of users.

Uses the 'Name' field in xprofile if available. Falls back on WP
display_name, and then user_nicename.

param: array $user_ids Array of user IDs to get display names for.
return: array Associative array of the format "id" => "displayname".
since: 2.0.0

bp_core_get_user_displayname( $user_id_or_username )   X-Ref
Fetch the display name for a user.

param: int|string|bool $user_id_or_username User ID or username.
return: string|bool The display name for the user in question, or false if
since: 1.0.1

bp_core_get_userlink_by_email( $email )   X-Ref
Return the user link for the user based on user email address.

param: string $email The email address for the user.
return: string The link to the users home base. False on no match.
since: 1.0.0

bp_core_get_userlink_by_username( $username )   X-Ref
Return the user link for the user based on the supplied identifier.

param: string $username If BP_ENABLE_USERNAME_COMPATIBILITY_MODE is set,
return: string|bool The link to the user's domain, false on no match.
since: 1.0.0

bp_core_get_total_member_count()   X-Ref
Return the total number of members for the installation.

Note that this is a raw count of non-spam, activated users. It does not
account for users who have logged activity (last_active). See
{@link bp_core_get_active_member_count()}.

return: int The total number of members.
since: 1.2.0

bp_core_get_active_member_count()   X-Ref
Return the total number of members, limited to those members with last_activity.

return: int The number of active members.
since: 1.6.0

bp_core_update_member_status( $user_id = 0, $value = 0 )   X-Ref
Update the spam status of the member on multisite configs.

param: int   $user_id The user ID to spam or ham.
param: int   $value   0 to mark the user as `ham`, 1 to mark as `spam`.
return: bool          True if the spam status of the member changed.
since: 5.0.0

bp_core_process_spammer_status( $user_id, $status, $do_wp_cleanup = true )   X-Ref
Process a spammed or unspammed user.

This function is called from three places:

- in bp_settings_action_capabilities() (from the front-end)
- by bp_core_mark_user_spam_admin()    (from wp-admin)
- bp_core_mark_user_ham_admin()        (from wp-admin)

param: int    $user_id       The ID of the user being spammed/hammed.
param: string $status        'spam' if being marked as spam, 'ham' otherwise.
param: bool   $do_wp_cleanup True to force the cleanup of WordPress content
return: bool True on success, false on failure.
since: 1.6.0

bp_core_mark_user_spam_admin( $user_id )   X-Ref
Hook to WP's make_spam_user and run our custom BP spam functions.

param: int $user_id The user ID passed from the make_spam_user hook.
since: 1.6.0

bp_core_mark_user_ham_admin( $user_id )   X-Ref
Hook to WP's make_ham_user and run our custom BP spam functions.

param: int $user_id The user ID passed from the make_ham_user hook.
since: 1.6.0

bp_is_user_spammer( $user_id = 0 )   X-Ref
Check whether a user has been marked as a spammer.

param: int $user_id The ID for the user.
return: bool True if spammer, otherwise false.
since: 1.6.0

bp_is_user_deleted( $user_id = 0 )   X-Ref
Check whether a user has been marked as deleted.

param: int $user_id The ID for the user.
return: bool True if deleted, otherwise false.
since: 1.6.0

bp_is_user_active( $user_id = 0 )   X-Ref
Check whether a user is "active", ie neither deleted nor spammer.

param: int $user_id The user ID to check.
return: bool True if active, otherwise false.
since: 1.6.0

bp_is_user_inactive( $user_id = 0 )   X-Ref
Check whether user is not active.

param: int $user_id The user ID to check.
return: bool True if inactive, otherwise false.
since: 1.6.0

bp_update_user_last_activity( $user_id = 0, $time = '' )   X-Ref
Update a user's last activity.

param: int    $user_id ID of the user being updated.
param: string $time    Time of last activity, in 'Y-m-d H:i:s' format.
return: bool True on success, false on failure.
since: 1.9.0

_bp_get_user_meta_last_activity_warning( $retval, $object_id, $meta_key, $single )   X-Ref
Backward compatibility for 'last_activity' usermeta fetching.

In BuddyPress 2.0, user last_activity data was moved out of usermeta. For
backward compatibility, we continue to mirror the data there. This function
serves two purposes: it warns plugin authors of the change, and it returns
the data from the proper location.

param: null   $retval Null retval value.
param: int    $object_id ID of the user.
param: string $meta_key  Meta key being fetched.
param: bool   $single    Whether a single key is being fetched (vs an array).
return: string|null
since: 2.0.0
since: 2.9.3 Added the `$single` parameter.

_bp_update_user_meta_last_activity_warning( $meta_id, $object_id, $meta_key, $meta_value )   X-Ref
Backward compatibility for 'last_activity' usermeta setting.

In BuddyPress 2.0, user last_activity data was moved out of usermeta. For
backward compatibility, we continue to mirror the data there. This function
serves two purposes: it warns plugin authors of the change, and it updates
the data in the proper location.

param: int    $meta_id    ID of the just-set usermeta row.
param: int    $object_id  ID of the user.
param: string $meta_key   Meta key being fetched.
param: string $meta_value Active time.
since: 2.0.0

bp_get_user_last_activity( $user_id = 0 )   X-Ref
Get the last activity for a given user.

param: int $user_id The ID of the user.
return: string Time of last activity, in 'Y-m-d H:i:s' format, or an empty
since: 1.9.0

bp_last_activity_migrate()   X-Ref
Migrate last_activity data from the usermeta table to the activity table.

Generally, this function is only run when BP is upgraded to 2.0. It can also
be called directly from the BuddyPress Tools panel.

return: bool
since: 2.0.0

bp_core_get_all_posts_for_user( $user_id = 0 )   X-Ref
Fetch every post that is authored by the given user for the current blog.

No longer used in BuddyPress.

param: int $user_id ID of the user being queried.
return: array Post IDs.

bp_core_delete_account( $user_id = 0 )   X-Ref
Process account deletion requests.

Primarily used for self-deletions, as requested through Settings.

param: int $user_id Optional. ID of the user to be deleted. Default: the
return: bool True on success, false on failure.
since: 1.0.0

bp_core_delete_avatar_on_user_delete( $user_id )   X-Ref
Delete a user's avatar when the user is deleted.

param: int $user_id ID of the user who is about to be deleted.
return: bool True on success, false on failure.
since: 1.9.0

bp_core_ucfirst( $str )   X-Ref
Multibyte-safe ucfirst() support.

Uses multibyte functions when available on the PHP build.

param: string $str String to be upper-cased.
return: string
since: 1.0.0

bp_core_boot_spammer( $user )   X-Ref
Prevent spammers from logging in.

When a user logs in, check if they have been marked as a spammer. If yes
then simply redirect them to the home page and stop them from logging in.

param: WP_User|WP_Error $user Either the WP_User object or the WP_Error
return: WP_User|WP_Error If the user is not a spammer, return the WP_User
since: 1.1.2

bp_core_remove_data( $user_id )   X-Ref
Delete last_activity data for the user when the user is deleted.

param: int $user_id The user ID for the user to delete usermeta for.
since: 1.0.0

bp_core_can_edit_settings()   X-Ref
Check whether the logged-in user can edit settings for the displayed user.

return: bool True if editing is allowed, otherwise false.
since: 1.5.0

bp_core_flush_illegal_names()   X-Ref
Flush illegal names by getting and setting 'illegal_names' site option.

since: 1.2.5

bp_core_get_illegal_names( $value = '', $oldvalue = '' )   X-Ref
Add BuddyPress-specific items to the illegal_names array.

param: array|string $value    Illegal names as being saved defined in
param: array|string $oldvalue The old value of the option.
return: array Merged and unique array of illegal names.
since: 1.2.7

bp_core_validate_email_address( $user_email )   X-Ref
Check that an email address is valid for use.

Performs the following checks:
- Is the email address well-formed?
- Is the email address already used?
- If there's an email domain blacklist, is the current domain on it?
- If there's an email domain whitelest, is the current domain on it?

param: string $user_email The email being checked.
return: bool|array True if the address passes all checks; otherwise an array
since: 1.6.2

bp_core_add_validation_error_messages( WP_Error $errors, $validation_results )   X-Ref
Add the appropriate errors to a WP_Error object, given results of a validation test.

Functions like bp_core_validate_email_address() return a structured array
of error codes. bp_core_add_validation_error_messages() takes this array and
parses, adding the appropriate error messages to the WP_Error object.

param: WP_Error $errors             WP_Error object.
param: array    $validation_results The return value of a validation function
since: 1.7.0

bp_core_validate_user_signup( $user_name, $user_email )   X-Ref
Validate a user name and email address when creating a new user.

param: string $user_name  Username to validate.
param: string $user_email Email address to validate.
return: array Results of user validation including errors, if any.
since: 1.2.2

bp_core_validate_blog_signup( $blog_url, $blog_title )   X-Ref
Validate blog URL and title provided at signup.

param: string $blog_url   Blog URL requested during registration.
param: string $blog_title Blog title requested during registration.
return: array
since: 1.2.2

bp_core_signup_user( $user_login, $user_password, $user_email, $usermeta )   X-Ref
Process data submitted at user registration and convert to a signup object.

param: string $user_login    Login name requested by the user.
param: string $user_password Password requested by the user.
param: string $user_email    Email address entered by the user.
param: array  $usermeta      Miscellaneous metadata about the user (blog-specific
return: int|false True on success, WP_Error on failure.
since: 1.2.0

bp_core_signup_blog( $blog_domain, $blog_path, $blog_title, $user_name, $user_email, $usermeta )   X-Ref
Create a blog and user based on data supplied at user registration.

param: string $blog_domain Domain requested by user.
param: string $blog_path   Path requested by user.
param: string $blog_title  Title as entered by user.
param: string $user_name   user_login of requesting user.
param: string $user_email  Email address of requesting user.
param: string $usermeta    Miscellaneous metadata for the user.
return: bool
since: 1.2.2

bp_core_activate_signup( $key )   X-Ref
Activate a signup, as identified by an activation key.

param: string $key Activation key.
return: int|bool User ID on success, false on failure.
since: 1.2.2

bp_members_add_role_after_activation( $user_id )   X-Ref
Add default WordPress role for new signups on the BP root blog.

param: int $user_id The user ID to add the default role for.
since: 3.0.0

bp_members_migrate_signups()   X-Ref
Migrate signups from pre-2.0 configuration to wp_signups.

since: 2.0.1

bp_core_map_user_registration( $user_id )   X-Ref
Map a user's WP display name to the XProfile fullname field, if necessary.

This only happens when a user is registered in wp-admin by an administrator;
during normal registration, XProfile data is provided directly by the user.

param: int $user_id ID of the user.
return: bool
since: 1.2.0

bp_core_signup_avatar_upload_dir()   X-Ref
Get the avatar storage directory for use during registration.

return: string|bool Directory path on success, false on failure.
since: 1.1.0

bp_core_signup_send_validation_email( $user_id, $user_email, $key, $salutation = '' )   X-Ref
Send activation email to a newly registered user.

param: int|bool $user_id    ID of the new user, false if BP_SIGNUPS_SKIP_USER_CREATION is true.
param: string   $user_email   Email address of the new user.
param: string   $key          Activation key.
param: string   $salutation   Optional. The name to be used as a salutation in the email.
since: 1.2.2
since: 2.5.0 Add the $user_login parameter.
since: 5.0.0 Change $user_login parameter to more general $salutation.

bp_core_signup_disable_inactive( $user = null, $username = '', $password ='' )   X-Ref
Display a "resend email" link when an unregistered user attempts to log in.

param: WP_User|WP_Error|null $user     Either the WP_User or the WP_Error object.
param: string                $username The inputted, attempted username.
param: string                $password The inputted, attempted password.
return: WP_User|WP_Error
since: 1.2.2

bp_members_login_resend_activation_email()   X-Ref
On the login screen, resends the activation email for a user.

since: 2.0.0

bp_core_wpsignup_redirect()   X-Ref
Redirect away from wp-signup.php if BP registration templates are present.

since: 1.1.0

bp_stop_live_spammer()   X-Ref
Stop a logged-in user who is marked as a spammer.

When an admin marks a live user as a spammer, that user can still surf
around and cause havoc on the site until that person is logged out.

This code checks to see if a logged-in user is marked as a spammer.  If so,
we redirect the user back to wp-login.php with the 'reauth' parameter.

This clears the logged-in spammer's cookies and will ask the spammer to
reauthenticate.

Note: A spammer cannot log back in - {@see bp_core_boot_spammer()}.

Runs on 'bp_init' at priority 5 so the members component globals are setup
before we do our spammer checks.

This is important as the $bp->loggedin_user object is setup at priority 4.

since: 1.8.0

bp_live_spammer_login_error()   X-Ref
Show a custom error message when a logged-in user is marked as a spammer.

since: 1.8.0

bp_get_displayed_user()   X-Ref
Get the displayed user Object

return: object The displayed user object, null otherwise.
since: 2.6.0

bp_member_type_tax_name()   X-Ref
Output the slug of the member type taxonomy.

since: 2.7.0

bp_get_member_type_tax_name()   X-Ref
Return the slug of the member type taxonomy.

return: string The unique member taxonomy slug.
since: 2.7.0

bp_register_member_type( $member_type, $args = array()   X-Ref
Register a member type.

param: string $member_type Unique string identifier for the member type.
param: array  $args {
return: object|WP_Error Member type object on success, WP_Error object on failure.
since: 2.2.0

bp_get_member_type_object( $member_type )   X-Ref
Retrieve a member type object by name.

param: string $member_type The name of the member type.
return: object A member type object.
since: 2.2.0

bp_get_member_types( $args = array()   X-Ref
Get a list of all registered member type objects.

param: array|string $args     Optional. An array of key => value arguments to match against
param: string       $output   Optional. The type of output to return. Accepts 'names'
param: string       $operator Optional. The logical operation to perform. 'or' means only one
return: array A list of member type names or objects.
since: 2.2.0

bp_set_member_type( $user_id, $member_type, $append = false )   X-Ref
Set type for a member.

param: int    $user_id     ID of the user.
param: string $member_type Member type.
param: bool   $append      Optional. True to append this to existing types for user,
return: false|array $retval See {@see bp_set_object_terms()}.
since: 2.2.0

bp_remove_member_type( $user_id, $member_type )   X-Ref
Remove type for a member.

param: int    $user_id     ID of the user.
param: string $member_type Member Type.
return: bool|WP_Error
since: 2.3.0

bp_get_member_type( $user_id, $single = true )   X-Ref
Get type for a member.

param: int  $user_id ID of the user.
param: bool $single  Optional. Whether to return a single type string. If multiple types are found
return: string|array|bool On success, returns a single member type (if $single is true) or an array of member
since: 2.2.0

bp_has_member_type( $user_id, $member_type )   X-Ref
Check whether the given user has a certain member type.

param: int    $user_id     $user_id ID of the user.
param: string $member_type Member Type.
return: bool Whether the user has the given member type.
since: 2.3.0

bp_remove_member_type_on_user_delete( $user_id )   X-Ref
Delete a user's member type when the user when the user is deleted.

param: int $user_id ID of the user.
return: false|array $value See {@see bp_set_member_type()}.
since: 2.2.0

bp_get_current_member_type()   X-Ref
Get the "current" member type, if one is provided, in member directories.

return: string
since: 2.3.0



Generated: Mon Nov 11 01:01:38 2019 Cross-referenced by PHPXref 0.7.1