Skip Navigation

[Resolved] Use “cred_save_data” with other forms

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

Problem: Use "cred_save_data" with other forms

Solution: No. "cred_save_data" hook belongs to Toolset forms and it will only triggered when you submit the form that is created using Toolset.

If you are using another plugins using which you created user form, you should check with that plugin support if they offer any hook that you should use to hook your custom code.

Relevant Documentation:

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 2 replies, has 2 voices.

Last updated by martinB-16 2 months, 4 weeks ago.

Assigned support staff: Minesh.

Author
Posts
#1995399

Hi,

I have code that works with a user-form generated in toolset (ID 3110).

I would also like to use this code for a user-form that was not created with Toolset (ID 3437).
Unfortunately, it doesn't work there.

What can that be?

<?php
/**
 * New custom code snippet (replace this with snippet description).
 */

toolset_snippet_security_check() or die( 'Direct access is not allowed' );

// Put the code of your snippet below this comment.

add_action('cred_save_data','func_update_benutzer_address_custom_field_value',10,2);
function func_update_benutzer_address_custom_field_value($user_id,$form_data) {

     // if a specific form
    	$forms = array( 3437, 3110, );
    	if ( in_array( $form_data['id'], $forms) ) 
        {
        $street = get_user_meta($user_id, 'wpcf-benutzer_strasse', true);
        $zip = get_user_meta($user_id, 'wpcf-benutzer_plz', true);
        $city= get_user_meta($user_id, 'wpcf-benutzer_ort', true);
	$address = $street.", ".$zip.", ".$city ;    
 
      	update_user_meta($user_id, 'wpcf-benutzer_test', $address);
        }
}
#1995711

Minesh
Supporter

Languages: English (English )

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

Hello. Thank you for contacting the Toolset support.

"cred_save_data" hook belongs to Toolset forms and it will only triggered when you submit the form that is created using Toolset.

If you are using another plugins using which you created user form, you should check with that plugin support if they offer any hook that you should use to hook your custom code.

#1996785

My issue is resolved now. Thank you!