Sauter la navigation

[Résolu] cred save data user form

This support ticket is created Il y a 5 années et 4 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
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

Ce sujet contient 1 réponse, a 1 voix.

Dernière mise à jour par olivierF Il y a 5 années et 4 mois.

Assisté par: Christian Cox.

Auteur
Publications
#1332495

Hi,
I created a registration form with a user form. I need to store data with cred save data. I use the following code but it does not work. The id of the form is the good one (id 62) and the slug of the field is the good one (wpcf-montant-paye). I have to store a numeric data. I do not understand. Does it work differently if it's a user form.
Thanks
Olivier


add_action('cred_save_data', 'my_save_data_action_user',10,2);
function my_save_data_action_user($post_id, $form_data)
{
	 if ($form_data['id']==62)
    {    
	add_post_meta($post_id, 'wpcf-montant-paye', '0');
    }
}

add_action('cred_save_data', 'my_save_data_action',10,2);
function my_save_data_action($post_id, $form_data)
{
    if ($form_data['id']==79)
    {    
	add_post_meta($post_id, 'wpcf-projet-validation', 1);
    }
	
}
#1332763

My issue is resolved now. Thank you!
There is the code for save data from user from

add_action('cred_save_data', 'my_save_data_action_user',10,2);
function my_save_data_action_user($new_user_id, $form_data)
{
	 if ($form_data['id']==62)
    {    
	update_user_meta($new_user_id, 'wpcf-montant-paye', 0);
    }
}