[ Index ]

PHP Cross Reference of BuddyPress

title

Body

[close]

/src/bp-core/ -> bp-core-caps.php (summary)

BuddyPress Capabilities.

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

Defines 15 functions

  bp_get_current_blog_roles()
  bp_add_caps()
  bp_remove_caps()
  bp_map_meta_caps()
  bp_get_community_caps()
  bp_get_caps_for_role()
  bp_set_current_user_default_role()
  bp_current_user_can()
  bp_user_can()
  _bp_roles_init()
  _bp_enforce_bp_moderate_cap_for_admins()
  bp_add_roles()
  bp_remove_roles()
  bp_get_participant_role()
  bp_get_moderator_role()

Functions
Functions that are not part of a class:

bp_get_current_blog_roles()   X-Ref
Return an array of roles from the currently loaded blog.

WordPress roles are dynamically flipped when calls to switch_to_blog() and
restore_current_blog() are made, so we use and trust WordPress core to have
loaded the correct results for us here. As enhancements are made to
WordPress's RBAC, so should our capability functions here.

return: object
since: 2.1.0

bp_add_caps()   X-Ref
Add capabilities to WordPress user roles.

This is called on plugin activation.

since: 1.6.0

bp_remove_caps()   X-Ref
Remove capabilities from WordPress user roles.

This is called on plugin deactivation.

since: 1.6.0

bp_map_meta_caps( $caps, $cap, $user_id, $args )   X-Ref
Map community caps to built in WordPress caps.

return: array Actual capabilities for meta capability. See {@link WP_User::has_cap()}.
param: array  $caps    See {@link WP_User::has_cap()}.
param: string $cap     See {@link WP_User::has_cap()}.
param: int    $user_id See {@link WP_User::has_cap()}.
param: mixed  $args    See {@link WP_User::has_cap()}.
since: 1.6.0

bp_get_community_caps()   X-Ref
Return community capabilities.

return: array Community capabilities.
since: 1.6.0

bp_get_caps_for_role( $role = '' )   X-Ref
Return an array of capabilities based on the role that is being requested.

return: array Capabilities for $role.
param: string $role The role for which you're loading caps.
since: 1.6.0

bp_set_current_user_default_role()   X-Ref
Set a default role for the current user.

Give a user the default role when creating content on a site they do not
already have a role or capability on.

since: 1.6.0

bp_current_user_can( $capability, $args = array()   X-Ref
Check whether the current user has a given capability.

return: bool True if the user has the cap for the given parameters.
param: string    $capability Capability or role name.
param: array|int $args {
since: 1.6.0
since: 2.4.0 Second argument modified to accept an array, rather than `$blog_id`.
since: 2.7.0 Deprecated $args['blog_id'] in favor of $args['site_id'].

bp_user_can( $user_id, $capability, $args = array()   X-Ref
Check whether the specified user has a given capability on a given site.

return: bool True if the user has the cap for the given parameters.
param: int       $user_id
param: string    $capability Capability or role name.
param: array|int $args {
since: 2.7.0

_bp_roles_init( WP_Roles $wp_roles )   X-Ref
Adds the `bp_moderate` cap to Roles having the `manage_options` cap when
BuddyPress is not active on the network.

param: WP_Roles $wp_roles The WordPress roles object.
since: 7.0.0

_bp_enforce_bp_moderate_cap_for_admins( $caps = array()   X-Ref
Temporary implementation of 'bp_moderate' cap.

In BuddyPress 1.6, the 'bp_moderate' cap was introduced. In order to
enforce that bp_current_user_can( 'bp_moderate' ) always returns true for
Administrators, we must manually add the 'bp_moderate' cap to the list of
user caps for Admins.

Note that this level of enforcement is only necessary in the case of
non-Multisite. This is because WordPress automatically assigns every
capability - and thus 'bp_moderate' - to Super Admins on a Multisite
installation. See {@link WP_User::has_cap()}.

This implementation of 'bp_moderate' is temporary, until BuddyPress properly
matches caps to roles and stores them in the database.

Plugin authors: Please do not use this function; thank you. :)

return: array $allcaps The user's cap list, with 'bp_moderate' appended, if relevant.
param: array  $caps    The caps that WP associates with the given role.
param: string $cap     The caps being tested for in WP_User::has_cap().
param: int    $user_id ID of the user being checked against.
param: array  $args    Miscellaneous arguments passed to the user_has_cap filter.
since: 1.6.0

bp_add_roles()   X-Ref
Adds BuddyPress-specific user roles.

This is called on plugin activation.

since: 1.6.0

bp_remove_roles()   X-Ref
Removes BuddyPress-specific user roles.

This is called on plugin deactivation.

since: 1.6.0

bp_get_participant_role()   X-Ref
The participant role for registered users without roles.

This is primarily for multisite compatibility when users without roles on
sites that have global communities enabled.

since: 1.6.0

bp_get_moderator_role()   X-Ref
The moderator role for BuddyPress users.

since: 1.6.0



Generated: Thu Nov 21 01:00:57 2024 Cross-referenced by PHPXref 0.7.1