Skip Navigation

[Resolved] Cannot change author to custom user in post

This support ticket is created 7 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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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: Asia/Kolkata (GMT+05:30)

This topic contains 5 replies, has 2 voices.

Last updated by Minesh 7 years, 2 months ago.

Assisted by: Minesh.

Author
Posts
#566680

I have a custom user, Breed Note Writer, who can submit a custom post, Breed Notes, using a cred form.

So far I have submitted posts on their behalf and changed the author on the post to them.

I then finalised setting up Access Control by setting up a post group so if user does not have permission to post they go to a specific page.

Since doing that the Breed Note Writers do not appear in the author drop down box any more, so I am unable to allocate the post to them.

#566801

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Well - the wp-admin access details you shared with us is not working at this end. Could you please send us working wp-admin access details.

Aa I understand you are talking about the post author meta box where you would like to display users with the specific role - correct? If no - could you please share post link with all related details where and which users you would like to display. Few screenshots will be helpful to understand your issue.

#566806
#566810

Yes. When I submit a Breed Note (custom post type) I need to change the author to one of the other users with the role of Breed Note Writer.

For instance, I posted hidden link
So I am shown as the Author. However, I need to set the author as dandiedinmont. The list of all users used to be in the author box, but since working on Access they are no longer there

#566820

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Well - you can use the post author argument WP hook: "wp_dropdown_users_args"

I've added following code to your current theme's functions.php file:

add_filter('wp_dropdown_users_args', 'assign_any_users_author_box_func', 10, 2);
function assign_any_users_author_box_func($query_args, $r){
    $query_arg['who'] = 'any';
    return $query_arg;
}

As you can see I've assigned "any" value to argument 'who' - that means it will dispaly ALL users with author dropdown. You can adjust the 'who' argument accordingly.

More info:
=> https://developer.wordpress.org/reference/hooks/wp_dropdown_users_args/

#566857

Thank you, it is indeed now working once again.

However, I am intrigued as to why it broke in the first place. As I mentioned, it was working perfectly without the need for a hook prior to setting up Access Control

#566863

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Yes it must be Access. - I did not check your access settings but Access must be overriding the things as you have activated Access and setup permissions accordingly.