I'm trying to add a specific role to manage my custom post types and I'm stuck at the very beginning.

I've added add_role() to the functions.php file as following:

add_role('resourcerer', 'Resourcerer', array('read_internal_jobs'));

and created a user with that role. However, when I try to login with a new user I would get an error You do not have sufficient permissions to access this page. I can't figure out what I'm doing wrong here :S

When registering my Custom Post Type I've got the following settings:

'capability_type' => array('internal_job', 'internal_jobs'),
'map_meta_cap' => true,

which, if I understand the register_post_type() Codex correctly, by specifying capability_type the capabilities strings will be constructed respectively using the strings specified in the capability_type, for example: edit_internal_jobs, publish_internal_jobs and so on.

I would really appreciate any help!

link|improve this question

79% accept rate
feedback

1 Answer

up vote 0 down vote accepted

That's because the "normal" capabilites that are needed to login are missing. You should simply load the capabilites of some default role and attach them to your custom role before using it on a user.


EDIT: Solution from @dashalune (OP):

add_role('resourcerer', 'Resourcerer'); 
$role =& get_role('resourcerer'); 
$role->add_cap('read');
link|improve this answer
thanks. I've added the 'read' capability, so at least I could login and see admin side. Here is my code if anyone will find it useful: add_role('resourcerer', 'Resourcerer'); $role =& get_role('resourcerer'); $role->add_cap('read'); – dashaluna Sep 13 '11 at 11:21
feedback

Your Answer

 
or
required, but never shown

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