Skip to:
Content

BuddyPress.org

Changeset 9640


Ignore:
Timestamp:
03/24/2015 06:07:07 AM (6 years ago)
Author:
tw2113
Message:

Adds hooks documentation for bp-core-caps.php.

See #5940.

File:
1 edited

Legend:

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

    r9351 r9640  
    3131        : array();
    3232
    33     // Apply WordPress core filter to editable roles
     33    /**
     34     * Filters the list of editable roles.
     35     *
     36     * @since BuddyPress (2.1.0)
     37     *
     38     * @param array $roles List of roles.
     39     */
    3440    $roles = apply_filters( 'editable_roles', $roles );
    3541
    36     // Return the editable roles
     42    /**
     43     * Filters the array of roles from the currently loaded blog.
     44     *
     45     * @since BuddyPress (2.1.0)
     46     *
     47     * @param array    $roles    Available roles.
     48     * @param WP_Roles $wp_roles Object of WordPress roles.
     49     */
    3750    return apply_filters( 'bp_get_current_blog_roles', $roles, $wp_roles );
    3851}
     
    6376    }
    6477
     78    /**
     79     * Fires after the addition of capabilities to WordPress user roles.
     80     *
     81     * This is called on plugin activation.
     82     *
     83     * @since BuddyPress (1.6.0)
     84     */
    6585    do_action( 'bp_add_caps' );
    6686}
     
    91111    }
    92112
     113    /**
     114     * Fires after the removal of capabilities from WordPress user roles.
     115     *
     116     * This is called on plugin deactivation.
     117     *
     118     * @since BuddyPress (1.6.0)
     119     */
    93120    do_action( 'bp_remove_caps' );
    94121}
     
    111138 */
    112139function bp_map_meta_caps( $caps, $cap, $user_id, $args ) {
     140
     141    /**
     142     * Filters the community caps mapping to be built in WordPress caps.
     143     *
     144     * @since BuddyPress (1.6.0)
     145     *
     146     * @param array  $caps    Returns the user's actual capabilities.
     147     * @param string $cap     Capability name.
     148     * @param int    $user_id The user ID.
     149     * @param array  $args    Adds the context to the cap. Typically the object ID.
     150     */
    113151    return apply_filters( 'bp_map_meta_caps', $caps, $cap, $user_id, $args );
    114152}
     
    128166    $caps = array();
    129167
     168    /**
     169     * Filters community capabilities.
     170     *
     171     * @since BuddyPress (1.6.0)
     172     *
     173     * @param array $caps Array of capabilities to add. Empty by default.
     174     */
    130175    return apply_filters( 'bp_get_community_caps', $caps );
    131176}
     
    164209    }
    165210
     211    /**
     212     * Filters the array of capabilities based on the role that is being requested.
     213     *
     214     * @since BuddyPress (1.6.0)
     215     *
     216     * @param array  $caps Array of capabilities to return.
     217     * @param string $role The role currently being loaded.
     218     */
    166219    return apply_filters( 'bp_get_caps_for_role', $caps, $role );
    167220}
     
    221274    $retval = current_user_can_for_blog( $blog_id, $capability );
    222275
     276    /**
     277     * Filters whether or not the current user has a given capability.
     278     *
     279     * @since BuddyPress (1.6.0)
     280     *
     281     * @param bool   $retval     Whether or not the current user has the capability.
     282     * @param string $capability The capability being checked for.
     283     * @param int    $blog_id    Blog ID. Defaults to the BP root blog.
     284     */
    223285    return (bool) apply_filters( 'bp_current_user_can', $retval, $capability, $blog_id );
    224286}
Note: See TracChangeset for help on using the changeset viewer.