3

Is there a hook in WP to access meta data of a user JUST after they have registered and meta data has been added to the database?

I was reading to use profile_update, but wouldn't that be invoked every time they update their profile? I just want something to occur the moment that they have registered, and the users meta has been entered in to the database.

Please let me know,

Thanks!

Tre

3

You can use user_register

add_action('user_register', 'wpse42506_user_register', 10, 3);
function wpse42506_user_register( $user_ID ) {
    // do stuff here
}

If you want to just use the user information, you can use get_userdata http://codex.wordpress.org/Function_Reference/get_userdata

If you need more control, you can initiate a new WP_User http://codex.wordpress.org/Class_Reference/WP_User

| improve this answer | |
  • Yeah, I was looking at that too. But someone said that it won't give me access to meta values like first name and last name, so I didn't try. Was that false? – tr3online Feb 16 '12 at 4:01
  • It passes the $user_ID. So you will have access to everything about the user. I updated my answer with more information – Evan Yeung Feb 16 '12 at 4:02
  • Cool, I'll have a look. I guess that post I read was a lie :\ Or miss-informed. Thanks! – tr3online Feb 16 '12 at 4:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.