• Resolved Tulesi

    (@tulesi)


    I followed the extra tag creation example and attempted to create an extra tag to greet new registered user with their first name:

    add_filter('wpbe_tags', 'add_my_tags');
    function add_my_tags( $tags ) {
    global $current_user;
    get_currentuserinfo();
    $tags['first_name'] = $current_user->user_firstname;
    return $tags;
    }

    This generates this tag:

    %first_name%

    The issue is it picks up the current user variable which belongs to admin instead of the newly registered user.

    Can you please help modify this function?

    Thank you in advance

    https://wordpress.org/plugins/wp-better-emails/

Viewing 1 replies (of 1 total)
  • Plugin Author Nicolas Lemoine

    (@nlemoine)

    Hi Tulesi,

    You’re getting the current logged in user because you’re using global $current_user which returns the current logged in user, not the user you’re sending the email.

    If you want to achieve this, you should directly modify the content of the new registration email. Or use a plugin such as “SB Welcome editor”.

Viewing 1 replies (of 1 total)

The topic ‘Tag for first name . Can you help edit this function?’ is closed to new replies.