Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
10/19/2013 09:58:33 AM (11 years ago)
Author:
boonebgorges
Message:

Improve inline docs in bp-core. See #5022

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-core/bp-core-caps.php

    r7228 r7444  
    22
    33/**
    4  * BuddyPress Capabilites
     4 * BuddyPress Capabilites.
    55 *
    66 * @package BuddyPress
     
    1212
    1313/**
    14  * Adds capabilities to WordPress user roles.
     14 * Add capabilities to WordPress user roles.
    1515 *
    1616 * This is called on plugin activation.
    1717 *
    18  * @since BuddyPress (1.6)
    19  *
    20  * @uses get_role() To get the administrator, default and moderator roles
    21  * @uses WP_Role::add_cap() To add various capabilities
    22  * @uses do_action() Calls 'bp_add_caps'
     18 * @since BuddyPress (1.6.0)
     19 *
     20 * @uses get_role() To get the administrator, default and moderator roles.
     21 * @uses WP_Role::add_cap() To add various capabilities.
     22 * @uses do_action() Calls 'bp_add_caps'.
    2323 */
    2424function bp_add_caps() {
     
    4040
    4141/**
    42  * Removes capabilities from WordPress user roles.
     42 * Remove capabilities from WordPress user roles.
    4343 *
    4444 * This is called on plugin deactivation.
    4545 *
    46  * @since BuddyPress (1.6)
    47  *
    48  * @uses get_role() To get the administrator and default roles
    49  * @uses WP_Role::remove_cap() To remove various capabilities
    50  * @uses do_action() Calls 'bp_remove_caps'
     46 * @since BuddyPress (1.6.0)
     47 *
     48 * @uses get_role() To get the administrator and default roles.
     49 * @uses WP_Role::remove_cap() To remove various capabilities.
     50 * @uses do_action() Calls 'bp_remove_caps'.
    5151 */
    5252function bp_remove_caps() {
     
    6868
    6969/**
    70  * Maps community caps to built in WordPress caps
    71  *
    72  * @since BuddyPress (1.6)
    73  *
    74  * @param array $caps Capabilities for meta capability
    75  * @param string $cap Capability name
    76  * @param int $user_id User id
    77  * @param mixed $args Arguments
    78  * @uses get_post() To get the post
    79  * @uses get_post_type_object() To get the post type object
    80  * @uses apply_filters() Calls 'bp_map_meta_caps' with caps, cap, user id and
    81  *                        args
    82  * @return array Actual capabilities for meta capability
     70 * Map community caps to built in WordPress caps.
     71 *
     72 * @since BuddyPress (1.6.0)
     73 *
     74 * @see WP_User::has_cap() for description of the arguments passed to the
     75 *      'map_meta_cap' filter.
     76 * @uses get_post() To get the post.
     77 * @uses get_post_type_object() To get the post type object.
     78 * @uses apply_filters() Calls 'bp_map_meta_caps' with caps, cap, user ID and
     79 *       args.
     80 *
     81 * @param array $caps See {@link WP_User::has_cap()}.
     82 * @param string $cap See {@link WP_User::has_cap()}.
     83 * @param int $user_id See {@link WP_User::has_cap()}.
     84 * @param mixed $args See {@link WP_User::has_cap()}.
     85 * @return array Actual capabilities for meta capability. See {@link WP_User::has_cap()}.
    8386 */
    8487function bp_map_meta_caps( $caps, $cap, $user_id, $args ) {
     
    8790
    8891/**
    89  * Return community capabilities
    90  *
    91  * @since BuddyPress (1.6)
    92  *
    93  * @uses apply_filters() Calls 'bp_get_community_caps' with the capabilities
    94  * @return array Forum capabilities
     92 * Return community capabilities.
     93 *
     94 * @since BuddyPress (1.6.0)
     95 *
     96 * @uses apply_filters() Calls 'bp_get_community_caps' with the capabilities.
     97 *
     98 * @return array Community capabilities.
    9599 */
    96100function bp_get_community_caps() {
     
    103107
    104108/**
    105  * Returns an array of capabilities based on the role that is being requested.
    106  *
    107  * @since BuddyPress (1.6)
    108  *
    109  * @param string $role Optional. Defaults to The role to load caps for
    110  * @uses apply_filters() Allow return value to be filtered
    111  *
    112  * @return array Capabilities for $role
     109 * Return an array of capabilities based on the role that is being requested.
     110 *
     111 * @since BuddyPress (1.6.0)
     112 *
     113 * @uses apply_filters() Allow return value to be filtered.
     114 *
     115 * @param string $role The role for which you're loading caps.
     116 * @return array Capabilities for $role.
    113117 */
    114118function bp_get_caps_for_role( $role = '' ) {
     
    139143
    140144/**
    141  * Give a user the default 'Forum Participant' role when creating a topic/reply
    142  * on a site they do not have a role or capability on.
    143  *
    144  * @since BuddyPress (1.6)
    145  *
    146  * @global BuddyPress $bp
     145 * Set a default role for the current user.
     146 *
     147 * Give a user the default role when creating content on a site they do not
     148 * already have a role or capability on.
     149 *
     150 * @since BuddyPress (1.6.0)
     151 *
     152 * @global BuddyPress $bp Global BuddyPress settings object.
    147153 *
    148154 * @uses is_multisite()
     
    172178
    173179/**
    174  * Whether current user has a capability or role. Can be passed blog ID, or will
    175  * use the root blod by default
    176  *
    177  * @since BuddyPress (1.6)
     180 * Check whether the current user has a given capability.
     181 *
     182 * Can be passed blog ID, or will use the root blog by default.
     183 *
     184 * @since BuddyPress (1.6.0)
    178185 *
    179186 * @param string $capability Capability or role name.
    180  * @param int $blog_id Blog ID
    181  * @return bool
     187 * @param int $blog_id Optional. Blog ID. Defaults to the BP root blog.
     188 * @return bool True if the user has the cap for the given blog.
    182189 */
    183190function bp_current_user_can( $capability, $blog_id = 0 ) {
     
    193200
    194201/**
    195  * Temporary implementation of 'bp_moderate' cap
    196  *
    197  * In BuddyPress 1.6, the 'bp_moderate' cap was introduced. In order to enforce that
    198  * bp_current_user_can( 'bp_moderate' ) always returns true for Administrators, we must manually
    199  * add the 'bp_moderate' cap to the list of user caps for Admins.
    200  *
    201  * Note that this level of enforcement is only necessary in the case of non-Multisite. This is
    202  * because WordPress automatically assigns every capability - and thus 'bp_moderate' - to Super
    203  * Admins on a Multisite installation. See WP_User::has_cap().
    204  *
    205  * This implementation of 'bp_moderate' is temporary, until BuddyPress properly matches caps to
    206  * roles and stores them in the database. Plugin authors: Do not use this function.
    207  *
    208  * @since BuddyPress (1.6)
     202 * Temporary implementation of 'bp_moderate' cap.
     203 *
     204 * In BuddyPress 1.6, the 'bp_moderate' cap was introduced. In order to
     205 * enforce that bp_current_user_can( 'bp_moderate' ) always returns true for
     206 * Administrators, we must manually add the 'bp_moderate' cap to the list of
     207 * user caps for Admins.
     208 *
     209 * Note that this level of enforcement is only necessary in the case of
     210 * non-Multisite. This is because WordPress automatically assigns every
     211 * capability - and thus 'bp_moderate' - to Super Admins on a Multisite
     212 * installation. See {@link WP_User::has_cap()}.
     213 *
     214 * This implementation of 'bp_moderate' is temporary, until BuddyPress properly
     215 * matches caps to roles and stores them in the database. Plugin authors: Do
     216 * not use this function.
     217 *
     218 * @access private
     219 * @since BuddyPress (1.6.0)
     220 *
    209221 * @see WP_User::has_cap()
    210  * @access private
    211  *
    212  * @param array $allcaps The caps that WP associates with the given role
    213  * @param array $caps The caps being tested for in WP_User::has_cap()
    214  * @param array $args Miscellaneous arguments passed to the user_has_cap filter
    215  * @return array $allcaps The user's cap list, with 'bp_moderate' appended, if relevant
     222 *
     223 * @param array $allcaps The caps that WP associates with the given role.
     224 * @param array $caps The caps being tested for in WP_User::has_cap().
     225 * @param array $args Miscellaneous arguments passed to the user_has_cap filter.
     226 * @return array $allcaps The user's cap list, with 'bp_moderate' appended, if relevant.
    216227 */
    217228function _bp_enforce_bp_moderate_cap_for_admins( $caps = array(), $cap = '', $user_id = 0, $args = array() ) {
     
    241252 * This is called on plugin activation.
    242253 *
    243  * @since BuddyPress (1.6)
    244  *
    245  * @deprecated since version 1.7
     254 * @since BuddyPress (1.6.0)
     255 * @deprecated 1.7.0
    246256 */
    247257function bp_add_roles() {
     
    254264 * This is called on plugin deactivation.
    255265 *
    256  * @since BuddyPress (1.6)
    257  *
    258  * @deprecated since version 1.7
     266 * @since BuddyPress (1.6.0)
     267 * @deprecated 1.7.0
    259268 */
    260269function bp_remove_roles() {
     
    264273
    265274/**
    266  * The participant role for registered users without roles
     275 * The participant role for registered users without roles.
    267276 *
    268277 * This is primarily for multisite compatibility when users without roles on
    269  * sites that have global communities enabled
     278 * sites that have global communities enabled.
    270279 *
    271280 * @since BuddyPress (1.6)
    272  *
    273  * @deprecated since version 1.7
     281 * @deprecated 1.7.0
    274282 */
    275283function bp_get_participant_role() {
     
    278286
    279287/**
    280  * The moderator role for BuddyPress users
    281  *
    282  * @since BuddyPress (1.6)
    283  *
    284  * @deprecated since version 1.7
     288 * The moderator role for BuddyPress users.
     289 *
     290 * @since BuddyPress (1.6.0)
     291 * @deprecated 1.7.0
    285292 */
    286293function bp_get_moderator_role() {
Note: See TracChangeset for help on using the changeset viewer.