Skip Navigation

[Resolved] Auto duplicate frontend submission forms posts to all languages

This thread is resolved. Here is a description of the problem and solution.

Problem:

The issue here is that the user want their post to duplicate to their other languages when a form is submitted.

Solution:

This can be done by using the code below.


function quick_duplicate_save_data_action( $post_id, $form_data ){
$forms = array( 2283, 2303, 2304 );
if ( in_array($form_data['id'],$forms) ){
    global $sitepress;
    do_action( 'wpml_make_post_duplicates', $post_id);
  }
}
add_action( 'cred_save_data', 'quick_duplicate_save_data_action', 10, 2 );

All that you need to do is change the ids in the array to match the id of the forms that you want this code to affect.

[edit] Note that the above will create WPML duplicates, which means the posts are synched and the "translations" cannot be independently edited except in the back-end when converting from duplicates to translations. The code above can be updated to do this automatically when the "duplicates" are first created. See https://toolset.com/forums/topic/edit-independently-in-front-end-ro-en-title-content-of-duplicated-posts/#post-1239002
[/edit]

This support ticket is created 6 years 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
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 15 replies, has 3 voices.

Last updated by valentinP-3 5 years, 12 months ago.

Assisted by: Shane.

Author
Posts
#1205407

My issue is resolved now. Thank you!