[wp-testers] Custom User Role Selection in Author Dropdown

Angelia Baladon angelia at 10sexyapples.com
Sat Mar 12 08:53:01 UTC 2011


I've been researching the issue I'm experiencing all over the place:

http://core.trac.wordpress.org/ticket/14572
http://core.trac.wordpress.org/ticket/14122
http://lists.automattic.com/pipermail/wp-testers/2010-November/013718.html

The issue I'm experiencing is similar to the issue posted on the forums
here:
http://wordpress.org/support/topic/user-does-not-appear-in-post_author_override-drop-down-list?replies=2#post-1996819

The only difference being:

I initially registered my post_types the 3.0 way and was using the members
plugin with the hack to use map_meta_cap as posted by Justin Tadlock.

I since removed the map_meta_cap filter functions and removed the
capabilities array from the registration leaving only what I believe is
correct for 3.1 and forward.

'capability_type' => array( 'lesson', 'lessons' ),
'map_meta_cap' => true,


I checked that all of the meta_caps are being properly mapped and they are:

[capability_type] => lesson
[map_meta_cap] => 1
[cap] => stdClass Object (
[edit_post] => edit_lesson
[read_post] => read_lesson
 [delete_post] => delete_lesson
[edit_posts] => edit_lessons
[edit_others_posts] => edit_others_lessons
 [publish_posts] => publish_lessons
[read_private_posts] => read_private_lessons
 [read] => read
[delete_posts] => delete_lessons
[delete_private_posts] => delete_private_lessons
 [delete_published_posts] => delete_published_lessons
[delete_others_posts] => delete_others_lessons
 [edit_private_posts] => edit_private_lessons
[edit_published_posts] => edit_published_lessons
 )

I then removed all of the previously created custom user roles and
capabilities using functions ... remove_cap, add_cap, remove, add_role,
remove_role and re-added them because I was noticing some funny business in
how they were mapping after the change ... ie
edit_lessons edit_lessons
instead of
edit_lessons 1.

After removing and re-adding the custom roles and capabilities, everything
looked as it should ... I believe:

Role displayed in Admin as Site Program Director
Database entry: site_program_director

Capabilities assigned to the role of Site Program Director
read 1
edit_lessons 1
edit_others_lessons 1
publish_lessons 1
read_private_lessons 1
delete_lessons 1
delete_private_lessons 1
delete_published_lessons 1
delete_others_lessons 1
edit_private_lessons 1
edit_published_lessons 1
delete_others_pages 1
delete_others_posts 1
delete_pages 1
delete_posts 1
delete_private_pages 1
delete_private_posts 1
delete_published_pages 1
delete_published_posts 1
edit_others_pages 1
edit_others_posts 1
edit_pages 1
edit_posts 1
edit_private_pages 1
edit_private_posts 1
edit_published_pages 1
edit_published_posts 1
export 1
import 1
list_users 1
manage_categories 1
manage_links 1
moderate_comments 1
publish_pages 1
publish_posts 1
read_private_pages 1
read_private_posts 1
restrict_content 1
upload_files 1

However, when logged in as admin, this user does not show up in the lessons
dropdown author box. When logged in as Site Program Director, I have the
ability to create lessons and they will save with Site Program Director as
the author, but, no other users with this role will show up ( same as issue
on forums linked to above ), only default wp roles will show.

As well, if I log back in as admin and change the author of the lesson to
admin, I cannot change it back to Site Program Director.

Bottom line, it would appear that a custom user role simply will not show up
in the dropdown author box, irregardless of assigned capability.

Does anyone have any further insight into this? I'm running on the release
version of 3.1 at the moment and don't want to update this particular site
to a nightly unless I know this has been addressed already.

As always, any input appreciated.


More information about the wp-testers mailing list