Skip Navigation

[Resolved] Change user of a post

This support ticket is created 3 years, 9 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 2 replies, has 2 voices.

Last updated by pierre-yvesC 3 years, 9 months ago.

Assisted by: Christian Cox.

Author
Posts
#2000777

Hi,

Is there a way to assign a different User of a post when editing/creating the post?

Many thx

#2000819

Hello, I assume you mean you would like to change the post author when creating or editing a post with Forms. In wp-admin, you can choose the post author of a post in the post editor screen. If you cannot see the post author field in the post editor, you can activate it per post type in Toolset > Post Types. Edit the post type, find the "Sections to display when editing" configurations, and activate the Author field. Then in the post editor screen, you should see the Author field appear. If not, check in the Screen Options menu (top right corner of the screen) and confirm Author is activated here too.

If you want to set a different post author when creating or editing a post in Forms, this is not a built-in feature of Forms and requires some custom code using our Forms API. Do you want to choose the author from a list of Users like in a "select" or "radio" input field, or do you want to set the author to be the current logged-in User, or something else?

Example showing how to always set the post author to be the current logged-in User: https://toolset.com/forums/topic/split-how-to-change-the-post-author-when-using-a-front-end-edit-form/#post-1197070

To always set the post author to be one specific User other than the current logged-in User, you can replace get_current_user_id() in that code example with a specific User ID.

To create a list of Users and allow the User to select an author from any of those Users, it's a bit more complex. Another ticket here in the forums shows how you can implement a generic select field with dynamic User names from a View, then how to use the Forms API cred_save_data to update the post author using the selected User. This customization requires you to use the legacy View editor instead of the Blocks Editor to design the View of Users, because the Block Editor does not currently support User Views.

Let me know if you have questions about these customizations and I can offer more guidance.

#2000861

Thx again!