Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

Does anyone know what is the difference between these two?

share|improve this question

2 Answers 2

up vote 6 down vote accepted

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.

share|improve this answer
    
This explains it. Thanks for digging it up. –  Sudar Mar 28 '13 at 12:33

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).

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.