What is the difference between “create_users” and “add_users” capabilities?

The codex lists both create_users and add_users under roles and capabilities.

Does anyone know what is the difference between these two?

Related posts

Leave a Reply

2 comments

  1. I explored WordPress to find difference between it and in schema.php file i found the following function only where in WordPress add_users capability is used.

    /**
     * Create and modify WordPress roles for WordPress 3.0.
     *
     * @since 3.0.0
     */
    function populate_roles_300() {
    $role =& get_role( 'administrator' );
    
    if ( !empty( $role ) ) {
        $role->add_cap( 'update_core' );
        $role->add_cap( 'list_users' );
        $role->add_cap( 'remove_users' );
    
        // Never used, will be removed. create_users or
        // promote_users is the capability you're looking for.
        $role->add_cap( 'add_users' );
    
        $role->add_cap( 'promote_users' );
        $role->add_cap( 'edit_theme_options' );
        $role->add_cap( 'delete_themes' );
        $role->add_cap( 'export' );
    }
    }
    

    Based on the comment written in code i think that the add_users capability is only used for backward compatibility and can be removed in future version of WordPress so we should use create_users capability instead of add_users capability.

  2. I’m not completely sure, but afaik WordPress added those when the meta capabilities for Post types got added. There’re a bunch of capabilities for posts, pages and CPTs that can be either mapped to the default *_post caps or set to custom ones like create_issues for an issues CPT. And as create_posts came with one of the more current versions, I’m pretty sure that the same goes for create_users.

    • You can’t create a user unless you have promote_users.

    Let’s say we’d like to give an editor some extra capabilities concerning users:

    • list_users does just what it says.
    • edit_users allows him to edit user accounts with an inferior role (author/contributor/subscriber).
    • create_users does not work at all without promote_users (returns “You do not have sufficient permissions to access this page.”).

    I’m not sure when the patches will move in (they’ve “commit” state for two years now).