Make WordPress Core

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#44888 closed defect (bug) (duplicate)

Users with custom roles not show on post author metabox

Reported by: araucaria's profile araucaria Owned by:
Milestone: Priority: normal
Severity: minor Version: 4.9.8
Component: Users Keywords:
Focuses: Cc:

Description

I have created a custom user role, which I want to behave in a similar way to the built in Author role - that is, an admin should be able to assign them as the author of a post, and the user should then be able to edit the post.

However, the custom user doesn't appear on the dropdown in the Author metabox, and this is apparently because the role definition does not include the deprecated user levels. That metabox is being populated from this query:

SELECT wp_users.ID,wp_users.user_login,wp_users.display_name
FROM wp_users
INNER JOIN wp_usermeta
ON ( wp_users.ID = wp_usermeta.user_id )
WHERE 1=1
AND ( ( wp_usermeta.meta_key = 'wp_user_level'
AND wp_usermeta.meta_value != '0' ) )
ORDER BY display_name ASC

Workaround is to alter the custom user role to set a user level other than zero, but as user levels were deprecated in 3.0, I shouldn't have to do this. The post_author_meta_box() function is depending on the deprecated user levels.

I found this article which explains the issue quite clearly: https://www.role-editor.com/wordpress-user-levels-deprecated-just-partially/

The following (closed) ticket seems to be reporting the same issue: https://core.trac.wordpress.org/ticket/28230

Change History (2)

#1 @swissspidy
6 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Hi there

We're already tracking this in #16841.

#2 @araucaria
6 years ago

OK, thanks @swissspidy

Note: See TracTickets for help on using tickets.