User Registration Hook
-
Hello,
I am trying to perform actions when a user registers, specifically when they register using a specific forminator form.
I’ve tried using the hook forminator_custom_form_submit_field_data, however with this method I cannot get the user ID, and I’m not even sure the user has been created at that point.
I have also tried using the hook user_register, and setting user meta on the form submission. However, it seems that when the user_register is called, the user meta has not yet been set. Perhaps it’s just that Forminator firsts creates the user, then sets the user meta?
Here’s the code for the above method:
function dc_user_register_add_member($user_id){ // Ensure WC Memberships is installed and active if ( ! function_exists( 'wc_memberships' ) ) { divic_log_debug('No memberships'); return; } // Check if the membership should be created based on user meta $membership_on_register = get_user_meta($user_id, 'membership-on-register', true); if( !$membership_on_register ){ divic_log_debug('Not member user created: ' . $membership_on_register); return; } divic_log_debug('Created membership'); }
When I run this code I get the “Not member user created” message, but I check and the user meta is definitely getting set.
Any help would really be appreciated.
- The topic ‘User Registration Hook’ is closed to new replies.