[wp-trac] [WordPress Trac] #16841: manually created user roles not showing in author dropdown irregardless of assigned capabilities

WordPress Trac wp-trac at lists.automattic.com
Sat Mar 12 23:39:40 UTC 2011


#16841: manually created user roles not showing in author dropdown irregardless of
assigned capabilities
--------------------------+-----------------------------
 Reporter:  10sexyapples  |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  3.1
 Severity:  normal        |   Keywords:
--------------------------+-----------------------------
 I posted the below on wp-testers hoping to verify or gain experiences from
 others in order to confirm this prior to reporting it as a bug, but,
 haven't received any further input, and it's just becoming more evident to
 me that perhaps it should be posted here, so, I hope I'm not creating a
 false report here. Please excuse me if I am.

 I'm posting this as a link so that it will translate more clearly rather
 than just cluttering up this message with more text than necessary.
 http://lists.automattic.com/pipermail/wp-testers/2011-March/014130.html

 Upon further investigation I have also come across the following:
 http://core.trac.wordpress.org/ticket/16451

 I'm not an expert at debugging this sort of thing, but, I have attempted
 all within my knowledge thus far, and in looking at all of the returned
 objects and entries, the only difference I can spot between how the
 default user roles ( which show up properly in the dropdown ) and the
 custom created roles ( which do not ) are being returned is that the
 default user roles, editor for instance, correctly show the deprecated
 level_7 entry, and the custom user role ( with more assigned privileges
 than the editor ) does not show user levels in the capabilities array at
 all, and shows level_0 in the object.

 This is leading me to think that perhaps there is something happening with
 those user levels in creating the author dropdown on the post editor that
 is blocking the custom user roles from showing up as expected.

 When running the following code:

 {{{
 echo '<br /><br /><h3>Roles</h3>';
         foreach ( $wp_roles->role_names as $role => $name ) :
                 echo '<br /> <br />';
                 echo '<pre> Role displayed in Admin as ' . $name ;
                 echo  '     Database entry: '  . $role . '</pre>';

                 echo '<h5> Capabilities assigned to the role of ' . $name.
 '</h5>';
                 // print_r( $caps);
                 echo '<pre>';
                 $rolename = get_role($role);
                 $caps = $rolename->capabilities;
                         foreach ($caps as $capability => $value):
                                 echo  $capability . ' '.  $value . "\n" ;
                         endforeach;
                 echo '</pre>';
         endforeach;
 }}}


 the default wp roles return the following capability value pairings


 {{{
 delete_published_posts 1
 }}}


 roles created with Justin Tadlock's members plugin return the following


 {{{
 delete_published_posts delete_published_posts
 }}}


 roles created manually in functions.php utilizing


 {{{
 add_role( 'test_role', 'Test Role' );

 //saved and then removed before running the code below ...

 $role = get_role('test_role');

 $role->add_cap('read');
 $role->add_cap('edit_posts);
 $role->add_cap('edit_others_posts');
 $role->add_cap('publish_posts');
 $role->add_cap('read_private_posts');
 $role->add_cap('delete_posts');
 $role->add_cap('delete_private_posts');
 $role->add_cap('delete_published_posts');
 $role->add_cap('delete_others_posts');
 $role->add_cap('edit_private_posts');
 $role->add_cap('edit_published_posts');
 }}}

 return the following ...


 {{{
 delete_published_posts 1
 }}}


 but lack the user levels as mentioned above.

 Let me know if there is any further info I can provide to help sort this
 out~

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/16841>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list