Skip Navigation

[Resolved] Allow user to set author on custom post type

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.

This topic contains 1 reply, has 2 voices.

Last updated by Waqar 4 months, 1 week ago.

Assigned support staff: Waqar.

Author
Posts
#2369685

Tell us what you are trying to do?
I would like to be able to set the author of a given post type from the front end. I would like to be able to assign the author based on a custom role of Property Owner.

Is there any documentation that you are following?
None that i can find so far.

Is there a similar example that we can see?
I can not find an example.

What is the link to your site?
hidden link

#2369801

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi,

Thank you for contacting us and I'd be happy to assist.

To set/change the post author from the front-end, you'll need a post edit form, which has a generic field, that shows all the users from the target user role ( in this case "Property Owner" ).

After the form submission, the "cred_save_data" hook can be used to change the post author, based on the selection made in that generic field.
( ref: https://toolset.com/documentation/programmer-reference/cred-api/#cred_save_data )

You'll find a good usage example for this, in this forum reply:
https://toolset.com/forums/topic/cred-form-to-select-author/#post-272508

I hope this helps and please let me know if you need any further assistance around this.

regards,
Waqar