Skip Navigation

[Resolved] Custom User Role is not included in Author field

This support ticket is created 6 years, 2 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
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 3 replies, has 2 voices.

Last updated by Christian Cox 6 years, 2 months ago.

Assisted by: Christian Cox.

Author
Posts
#1120993

edit to #1120947

I have find one more issue.
When a user register from Frontend they get the correct Role (CompanyUser) - thats correct.
But then i cant add this as a Auther. Only administrators can be authors on posts.

#1120995

Okay please go to Toolset > Access Control > Post Types tab. I'm not sure which post type you are referring to, but check to be sure each post type is Managed by Access, and that CompanyUser role has permission to Publish posts. Right now, I can see that the standard Post type is not managed by Access, so CompanyUsers cannot publish Posts. If I have misunderstood your question, please let me know which post type you are referring to, and tell me the name of a CompanyUser so I can test this in wp-admin. Thank you!

#1121319
Customeruser_post.JPG
customerUser.JPG

Posttype: Company Offer
I did try that first, and did not solve it.
I have giv standard Post, satndard Page and CustomerUser the acces to Publish.
Still no CustomerUsers in Author field.

#1122356

Okay I've added some custom code to your child theme:

add_filter( 'wp_dropdown_users_args', 'tssupp_fix_author_dropdown' );
function tssupp_fix_author_dropdown( $query_args ){

  global $pagenow;
  if (( $pagenow == 'post.php' ) && (get_post_type() == 'post' || get_post_type() == 'page' || get_post_type() == 'company' || get_post_type() == 'offers')) {

      // Only modify dropdown users on a post edit screen
    $query_args['who'] = '';
    $query_args['role__in'] = array( 'administrator', 'editor', 'author', 'companyuser' );

  }

  return $query_args;

This will enable you to select Users with the CompanyUser role in the author select field for Posts, Pages, Companies, and Company Offers. Let me know if that's not accurate and I'll be glad to make any necessary modifications. Be sure to pull the functions.php file down to your local file repository.