[wp-hackers] A developer-user-role might (sometimes) be useful

kaiiser 24-7 at gmx.net
Tue Apr 27 22:11:52 UTC 2010


I got some installations where i have other admin-users too, that
should not see when i'm making changes to a template. I'm searching
for a possibility to generate a custom role called "developer", that
has all capabilities, so i can use it like an admin-user-account, but
with the benefit of a one-person-development-mode. I want to check for
something like this:

if(current_user_can('developer')) {
 code i work on
} else {
 old code - or - maintainance message
}

I know how to add custom capabilities, and custom roles, but i don't
know how to assign "allcaps" to my new role. This gives me currently
the problem, that i can't even login with this user. Any help would be
appreciated.

>> Role:
global $allcaps;
$role = "developer";
$display_name = "Developer";
add_role( "developer", "Developer", $allcaps )
>> Capability:
$role = get_role('developer');
if ($role !== NULL) {
 $role->add_cap('dev_cap');
}

Thanks.
-K.


More information about the wp-hackers mailing list