Skip Navigation

[Resolved] Grab user_id after registration

This support ticket is created 3 years, 11 months ago. 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9: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/Karachi (GMT+05:00)

This topic contains 4 replies, has 2 voices.

Last updated by RensV5812 3 years, 11 months ago.

Assisted by: Waqar.

Author
Posts
#1609977

Hey guys,

How do I grab a new user's user_id after registration? I've tried this but it didn't seem to work:

add_action( 'cred_save_data', 'auto_profile_picture', 10, 2 );
function auto_profile_picture( $new_user_id, $form_data ){
  
    if ( 3263 == $form_data['id'] ) {  // 3263 is id of registration form

		$user_id = $new_user_id;

-------- rest of code works with $user_id

Thanks,
Rens

#1610541

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi Rens,

Thank you for contacting us and I'd be happy to assist.

I've tested the code snippet that you've shared on my test website and it seems to work as expected.

Can you please make sure that the ID "3263" is the correct one for the form that you're testing with?

Note: For step-by-step custom code troubleshooting, you'll find the "WP PHP Console" plugin ( https://wordpress.org/plugins/wp-php-console/ ) very useful, as it makes PHP errors and warnings much simpler to trace.

In case the issue still persists, please share the complete code snippet along with some context around what you are expecting and what is actually happening.

regards,
Waqar

#1610557

Hi Waqar,

Thanks for the plugin suggestion! Been looking for an easy debugging solution. 🙂

I'll get testing again and let you know how it goes!

Rens

#1610655

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

You're very welcome and please let me know how it goes.

For a new question/concern, feel free to start a new ticket.

#1610739

I've figured out it's not the user id that's the problem. I've started a new ticket here: https://toolset.com/forums/topic/custom-code-doesnt-work-when-using-cred-hook/

My issue is resolved now. Thank you!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.