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

WordPress Trac noreply at wordpress.org
Thu Mar 21 11:09:55 UTC 2019


#16841: Manually created user roles not showing in author dropdown regardless of
assigned capabilities
------------------------------------------+-------------------------
 Reporter:  10sexyapples                  |       Owner:  swissspidy
     Type:  defect (bug)                  |      Status:  assigned
 Priority:  normal                        |   Milestone:  5.2
Component:  Role/Capability               |     Version:  3.1
 Severity:  normal                        |  Resolution:
 Keywords:  needs-patch needs-unit-tests  |     Focuses:
------------------------------------------+-------------------------

Comment (by efi123):

 Replying to [comment:60 Mte90]:

 This snipped seems to have fixed the issue I was facing.
 I use the "Super Socializer" plugin to create new users via Facebook login
 and assign them a custom role.

 Until now authors showed as blank titles from the author dropdown menu.

 After adding the code to my functions.php I could see author names showing
 in the quick edit section.

 Thanks for that! I hope it will get fixed in 5.2.

 > To fix in your instance you have to run this piece of code and use the
 user role that you want.
 > After reading on Slack the problem is that usually usuers created
 manually (instead of registration screen) doesn't have this user_level
 configured.
 >
 > Anyway in case your issue is different you can fix it running this code
 but you have to do it everytime until there is a fix for this problem.
 >
 > Also this problem happen in REST API so this fix the problem also in
 Gutenberg.
 > {{{
 > $blogusers = get_users( 'role=instructor' );
 > foreach ( $blogusers as $user ) {
 >    $user->add_cap('level_1');
 > }
 > }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/16841#comment:62>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list