Sauter la navigation

[Résolu] Use « cred_save_data » with other forms

Ce fil est résolu. Voici une description du problème et la solution proposée.

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 support ticket is created Il y a 3 années et 10 mois. 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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

Ce sujet contient 2 réponses, a 2 voix.

Dernière mise à jour par martinB-16 Il y a 3 années et 10 mois.

Assisté par: Minesh.

Auteur
Publications
#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

Les langues: Anglais (English )

Fuseau horaire: 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!