Navigation überspringen

[Gelöst] cred save data user form

This support ticket is created vor 5 Jahren, 4 Monaten. 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)

Dieses Thema enthält 1 Antwort, hat 1 Stimme.

Zuletzt aktualisiert von olivierF vor 5 Jahren, 4 Monaten.

Assistiert von: Christian Cox.

Author
Artikel
#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);
    }
}