Add a role
-
Hi,
i’m trying to add a role of “developer”. This role should contain all capabilities of the admin-role ($allcaps) plus a developer role. Currently my only problem are the “allcaps”-capabilities. I simply don’t know how i can receive them when adding a role.
>> Role: global $allcaps; $role = "developer"; $display_name = "Developer"; $allcaps = "????????????"; add_role( "developer", "Developer", $allcaps ) >> Capability: $role = get_role('developer'); if ($role !== NULL) { $role->add_cap('dev_cap'); }
I need this in themes where i got other admins too, that should not see any changes i make on templates, so can use something like this:
if(current_user_can('developer')) { code i work on } else { old code - or - maintainance message }
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Add a role’ is closed to new replies.