Make WordPress Core

Changeset 26126


Ignore:
Timestamp:
11/13/2013 04:38:13 AM (11 years ago)
Author:
SergeyBiryukov
Message:

Inline documentation for hooks in wp-includes/capabilities.php.

props ptahdunbar, kpdesign.
fixes #25531.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/capabilities.php

    r26081 r26126  
    379379     */
    380380    function has_cap( $cap ) {
     381        /**
     382         * Filter which capabilities a role has.
     383         *
     384         * @since 2.0.0
     385         *
     386         * @param array  $capabilities Array of role capabilities.
     387         * @param string $cap          Capability name.
     388         * @param string $name         Role name.
     389         */
    381390        $capabilities = apply_filters( 'role_has_cap', $this->capabilities, $cap, $this->name );
    382391        if ( !empty( $capabilities[$cap] ) )
     
    823832        $this->get_role_caps();
    824833        $this->update_user_level_from_caps();
     834
     835        /**
     836         * Fires after the user's role has changed.
     837         *
     838         * @since 2.9.0
     839         * @since 3.6.0 Added $old_roles to include an array of the user's previous roles.
     840         *
     841         * @param int    $user_id   The user ID.
     842         * @param string $role      The new role.
     843         * @param array  $old_roles An array of the user's previous roles.
     844         */
    825845        do_action( 'set_user_role', $this->ID, $role, $old_roles );
    826846    }
     
    943963        }
    944964
     965        /**
     966         * Dynamically filter a user's capabilities.
     967         *
     968         * @since 2.0.0
     969         * @since 3.7.0 Added the user object.
     970         *
     971         * @param array   $allcaps An array of all the role's capabilities.
     972         * @param array   $caps    Actual capabilities for meta capability.
     973         * @param array   $args    Optional parameters passed to has_cap(), typically object ID.
     974         * @param WP_User $user    The user object.
     975         */
    945976        // Must have ALL requested caps
    946977        $capabilities = apply_filters( 'user_has_cap', $this->allcaps, $caps, $args, $this );
     
    11711202
    11721203        if ( $meta_key && has_filter( "auth_post_meta_{$meta_key}" ) ) {
     1204            /**
     1205             * Filter whether the user is allowed to add post meta to a post.
     1206             *
     1207             * The dynamic portion of the hook name, $meta_key, refers to the
     1208             * meta key passed to map_meta_cap().
     1209             *
     1210             * @since 3.3.0
     1211             *
     1212             * @param bool   $allowed  Whether the user can add the post meta. Default false.
     1213             * @param string $meta_key The meta key.
     1214             * @param int    $post_id  Post ID.
     1215             * @param int    $user_id  User ID.
     1216             * @param string $cap      Capability name.
     1217             * @param array  $caps     User capabilities.
     1218             */
    11731219            $allowed = apply_filters( "auth_post_meta_{$meta_key}", false, $meta_key, $post->ID, $user_id, $cap, $caps );
    11741220            if ( ! $allowed )
     
    12721318    }
    12731319
    1274     return apply_filters('map_meta_cap', $caps, $cap, $user_id, $args);
     1320    /**
     1321     * Filter a user's capabilities depending on specific context and/or privilege.
     1322     *
     1323     * @since 2.8.0
     1324     *
     1325     * @param array  $caps    Returns the user's actual capabilities.
     1326     * @param string $cap     Capability name.
     1327     * @param int    $user_id The user ID.
     1328     * @param array  $args    Adds the context to the cap. Typically the object ID.
     1329     */
     1330    return apply_filters( 'map_meta_cap', $caps, $cap, $user_id, $args );
    12751331}
    12761332
Note: See TracChangeset for help on using the changeset viewer.