Saltar navegación

[Resuelto] Use «cred_save_data» with other forms

Este hilo está resuelto. Aquí tiene una descripción del problema y la solución.

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 hace 3 años, 10 meses. 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)

Este tema contiene 2 respuestas, tiene 2 mensajes.

Última actualización por martinB-16 hace 3 años, 10 meses.

Asistido por: Minesh.

Autor
Mensajes
#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

Idiomas: Inglés (English )

Zona horaria: 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!