Forums

Theme My Login
[resolved] Get email after user activaction (4 posts)

  1. substa
    Member
    Posted 6 months ago #

    Hello,

    I'm trying to implement a custom function with
    add_action( 'tml_new_user_activated', 'tml_new_user_activated' );
    to register the new user to the newsletter...

    How can I get the user email immediately after the activation inside "tml_new_user_activated" function?

    I thought to use a query to retrieve the email of the last user activated, but I hope there is a better way ;)

    Thanks,
    Giovanni

    http://wordpress.org/extend/plugins/theme-my-login/

  2. Jeff Farthing
    Member
    Posted 6 months ago #

    The user ID is passed into the callback function. You can obtain the user_email with that.

    function tml_new_user_activated( $user_id ) {
        $user = get_user( $user_id );
        // Access e-mail with $user->user_email
    }
    add_filter( 'tml_new_user_activated', 'tml_new_user_activated' );
  3. substa
    Member
    Posted 6 months ago #

    Ok, the function to use is get_userdata, and not get_user, but it works! :)
    Thank you Jeff ;)

  4. Jeff Farthing
    Member
    Posted 6 months ago #

    Yea, you're right.

Reply

You must log in to post.

About this Plugin

About this Topic