How possible give a user the 'adminstrator' role? for example I made a user with wp_insert_user(array(..., 'role' => 'Administrator') but it doesn't effect on role of user. thanks.
-
Have you tried "Administrator" in all lower case? Please don't truncate your code to the bare minimum like that. If I wanted to throw that code into a dev stack and test it I couldn't. You don't need to post irrelevant code but try to post complete blocks of reasonably relevant code.– s_ha_dumOct 12, 2013 at 20:33
-
Oh thanks I found the problem i should have wrote it 'administrator' because in usermeta table it must be a:2:{s:13:"administrator";b:1;s:13:"bbp_keymaster";b:1;}– user1695063Oct 12, 2013 at 20:51
1 Answer
or
/ NOTE: Of course change 3 to the appropriate user ID $u = new WP_User( 3 ); // Remove role $u->remove_role( 'subscriber' ); // Add role $u->add_role( 'editor' );
Super Admin – somebody with access to the site network administration features and all other features. See the Create a Network article.
Administrator – somebody who has access to all the administration features within a single site.
Editor – somebody who can publish and manage posts including the posts of other users.
Author – somebody who can publish and manage their own posts.
Contributor – somebody who can write and manage their own posts but cannot publish them.
Subscriber – somebody who can only manage their profile.