Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

USER01 is not showing in Author drop down list while editing a Page if he's in the my custom ROLE "mycustomrole".

If I change his role as an AUTHOR, and add the very same custom and non custom capacities, he's shown in the list.

I created this role programatically, as shown below.

Is there something particular to add in order to see it in my Authors list?

function cjg_4cast_addroles(){
    cjg_add_role('mycustomrole','My Custom Role',array(
        array('singular' => 'side-add', 'plural' => 'side-adds'),
        array('singular' => 'partner', 'plural' => 'partners')
        ),
        array(
            'read' => true,
            'upload_files' => true,
            'edit_files' => true,
            'edit_pages' => true,
            'edit_published_pages' => true,
            'publish_pages' => true,
            'delete_pages' => true,
            'delete_private_pages' => true,
            'edit_private_pages' => true,
            'read_private_pages' => true,
            'publish_posts' => true,
            'edit_posts' => true,
            'edit_published_posts' => true,
        )
    );
}

function cjg_add_role($role_name,$role_name_display,$custom_type_slugs,$capabilities){

    foreach($custom_type_slugs as $custom_type_slug){
        $capabilities = array_merge($capabilities,
            cjg_capabilitiesarray_fromslug($custom_type_slug['singular'],$custom_type_slug['plural'])
            );
    }

    add_role( $role_name, $role_name_display, $capabilities);
}

function cjg_capabilitiesarray_fromslug($singular,$plural){

    return array(
        "edit_$singular" => true,
        "read_$singular" => true,
        "delete_$singular" => true,
        "edit_$plural" => true,
        "edit_others_$plural" => true,
        "publish_$plural" => true,
        "read_private_$plural" => true,
    );
}
share|improve this question
    
why a down vote? I still need to find an answer, I found other posts with the same issue and no solution –  Christian Nov 6 '12 at 13:38
    
I up voted, valid question. Came across a similar problem. –  addedlovely Oct 2 '13 at 15:03
add comment

2 Answers

Not sure, but could the issues have to do with spelling "plural" as "plurial"?? I know that you are using it as a variable name in your functions, but you also reference it in the cjg_add_role function...

share|improve this answer
    
thanks. Sorry for the mispel, since I kept to my mistake all along and it's only a variable name, I don't see how it could influence. It could have if I had changed it in some other place, but I didn't know the spelling was wrong –  Christian Oct 4 '12 at 21:31
add comment
up vote 0 down vote accepted

the answer is provided here: Users with custom roles not showing in post author select box

I tested and it works:

to add a level_1 cap to your role.

It's PITA, considering how user levels have been deprecated so long ago, but there you go
share|improve this answer
    
I'm taking a plane, I'll copy paste real code later eventually –  Christian Oct 3 '13 at 17:44
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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