Skip Navigation

[Resolved] make subscriber user author.

This support ticket is created 3 years, 6 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 - - 9:00 – 13:00
14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 - - 14:00 – 18:00

Supporter timezone: Africa/Casablanca (GMT+01:00)

This topic contains 3 replies, has 2 voices.

Last updated by Jamal 3 years, 6 months ago.

Assisted by: Jamal.

Author
Posts
#2056823

I have given 'Publish' and 'Edit Own' permission to the default WordPress user role 'Subscriber'. I have done this for a custom post type.

After doing this, I am not able to see any users with the subscriber role in the post author dropdown on the custom posts.

Please help.

#2056861

I escalated this case to our 2nd Tier for further analysis, and I am getting back to you with a workaround solution.

You can add the following custom code to a Toolset snippet and make all the users available in the author dropdown:

add_filter( 'wp_dropdown_users_args', 'add_subscribers_to_dropdown', 10, 2 );
function add_subscribers_to_dropdown( $query_args, $r ) {

    $query_args['who'] = '';
    return $query_args;

}

The wp_dropdown_users_args hook offers more control, the following code will enable only the subscribers and administrators to be selected in the users dropdown:

function wpdocs_add_subscribers_to_dropdown( $query_args ) {
 
    // Use this array to specify multiple roles to show in dropdown
    $query_args['role__in'] = array( 'subscriber', 'administrator' );
 
    // Use this array to specify multiple roles to hide in dropdown
    $query_args['role__not_in'] = array( 'editor' );
 
    // Unset the 'who' as this defaults to the 'author' role
    unset( $query_args['who'] );
  
    return $query_args;
}
add_filter( 'wp_dropdown_users_args', 'wpdocs_add_subscribers_to_dropdown' );

Please note that this works only for the drop-down in the custom post type list. Check this screenshot hidden link

I'll get back to you as soon as I have something to share.

#2059355

Thank you for sharing this. Will this option be incorporated in the plugin in the future? removing the need to add custom code?

#2059465

The request has been escalated to the developers, however, we can't tell when this will be implemented. It may take some months before it lands into Toolset Access.

As of now, the workaround will require custom code. I shared the custom code that should work for the posts list(quick edit), and in the classic editor. You will need a different code to support the Gutenberg editor.
Please check this article for a custom code reference hidden link