• Hi I am using Jobroller theme and I would like to extend notification I get on email about each new user that registers. Currently I get username and email address but I would like to also get the role. There are two roles – job lister and job seeker.
    Here is the code I am using right now.
    The role part displays nothing…

    function app_new_user_notification( $user_id, $plaintext_pass = '') {
        global $app_abbr;
    
        $user = new WP_User($user_id);
        $user_login = stripslashes($user->user_login);
        $user_email = stripslashes($user->user_email);
    
        $user_role = get_the_author_meta('user_role', $user_id);
    
        $find = array('/%username%/i', '/%password%/i', '/%blogname%/i', '/%siteurl%/i', '/%loginurl%/i', '/%useremail%/i', '/%role%/i');
        $replace = array($user_login, $plaintext_pass, get_option('blogname'), get_option('siteurl'), get_option('siteurl').'/wp-login.php', $user_email, $user_role);
    
        $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
    
        if (get_option($app_abbr.'_nu_admin_email') == 'yes') {
            $message  = sprintf(__('New user registration on your site %s:'), $blogname) . PHP_EOL . PHP_EOL;
            $message .= sprintf(__('Username: %s'), $user_login) . PHP_EOL . PHP_EOL;
            $message .= sprintf(__('Registered as: %s'),  $user_role ) . PHP_EOL . PHP_EOL;
    
    		$message .= sprintf(__('Email Address: %s'), $user_email) . PHP_EOL . PHP_EOL;
    
            @wp_mail(get_option('admin_email'), sprintf(__('[%s] New User Registration'), $blogname), $message);
        }

    Hope someone can help me with this one…

    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Send user role on email’ is closed to new replies.