Manually created user roles not showing in author dropdown regardless of assigned capabilities
|Reported by:||10sexyapples||Owned by:|
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.
Upon further investigation I have also come across the following:
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
roles created with Justin Tadlock's members plugin return the following
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 ...
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~
Change History (28)
comment:16 @DrewAPicture — 10 months ago
- Summary changed from manually created user roles not showing in author dropdown irregardless of assigned capabilities to Manually created user roles not showing in author dropdown regardless of assigned capabilities
comment:20 follow-up: ↓ 21 @lgladdy — 6 weeks ago
comment:22 in reply to: ↑ 21 @lgladdy — 6 weeks ago
comment:27 @boonebgorges — 5 weeks ago
- Keywords needs-patch needs-unit-tests added; 2nd-opinion removed
- Milestone changed from Awaiting Review to Future Release