Skip Navigation

[Resolved] Automatically trigger a new post when a new user is created

This support ticket is created 6 years, 1 month 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
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

This topic contains 2 replies, has 2 voices.

Last updated by Ben 6 years, 1 month ago.

Assisted by: Nigel.

Author
Posts
#1122341

Ben

Is there a way to create an automatic trigger so a new post (of a certain CPT) is created when a new user is registered through a front end form?

#1122691

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi Ben

For this you would need to use the Forms API, probably the cred_save_data hook (https://toolset.com/documentation/programmer-reference/cred-api/#cred_save_data).

This is triggered when a form has been submitted and the content created. The same hook is run both on post forms (when the post is published) and user forms (when the user is registered). The documentation linked to above assumes a post form (i.e. the first argument is shown as post_id, but it could equally be user_id).

Your code would use wp_insert_post to publish a post: https://developer.wordpress.org/reference/functions/wp_insert_post/

#1122698

Ben

Thank you Nigel.

I will have a look into this now.