Skip Navigation

[Gelöst] Use „cred_save_data“ with other forms

Dieser Thread wurde gelöst. Hier ist eine Beschreibung des Problems und der Lösung.

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 vor 3 Jahren, 8 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.

Heute stehen keine Supporter zur Arbeit im Werkzeugsatz-Forum zur Verfügung. Sie können gern Tickets erstellen, die wir bearbeiten werden, sobald wir online sind. Vielen Dank für Ihr Verständnis.

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)

Dieses Thema enthält 2 Antworten, hat 2 Stimmen.

Zuletzt aktualisiert von martinB-16 vor 3 Jahren, 8 Monaten.

Assistiert von: Minesh.

Author
Artikel
#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

Sprachen: Englisch (English )

Zeitzone: 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!