Pro WordPress Theme Development by Adam Onishi

Pro WordPress Theme Development by Adam Onishi

Author:Adam Onishi [Onishi, Adam]
Language: eng
Format: epub, pdf
Tags: Web, Blogs, Computers, Web Programming
ISBN: 9781430259145
Publisher: Apress
Published: 2013-11-13T05:00:00+00:00


if (null !== $result) {

$admin = new WP_User( 1 );

$admin->add_role('moderator');

}

}

The example shows that after you create your new moderator role, you can also add this role directly to the site administrator. Of course, if you want all administrator users to also have these capabilities, it might be best to go through the process of adding the capabilities to the role so that new administrator users have these capabilities without having to check when each new user is created.

The other two role functions do what their names infer: the set_role() function changes the role of a current user to the one passed into the function, and the remove_role() function removes the role passed.

The final function, remove_all_caps(),can be used to remove every capability from a user. For instance, it could be used if a user is being blocked from accessing the site. Instead of deleting the user and allowing them to sign up again by freeing their e-mail address, you could remove all their capabilities. This would mean that they couldn’t access anything in the site; and because they’re still technically signed up, they wouldn’t be able to sign up again.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.