Support » Plugin: WP Referral Code » How to change – Shows a list of users current user invited

  • Resolved volshebstvo888

    (@volshebstvo888)


    Hello!
    Thanks you for the best plagin!
    I have a question. How to change shows a list of users current user invited (lists usernames by default: use hooks to change it) – I want to change it to first name and second name or email.
    If it possible.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author shalior

    (@shalior)

    Hey, you’re welcome.
    paste this snippet in you’re child theme’s functions.php file. this will show the names or email instead of username.
    hope it helps

    add_filter('wp_referral_code_invited_user_text' , function ($user_login, $user_id){
    	$user = get_userdata( $user_id );
    	if($user){
    		if (!empty( $user->first_name ) && !empty( $user->last_name)){
    			return $user->first_name . " " . $user->last_name;
    		}
    		$text = $user->user_email ?? $user_login ;
    		return esc_html( $text);
    	}
    	return $user_login;
    } , 10, 2);
    • This reply was modified 7 months, 3 weeks ago by shalior.

    Hello!
    Excelent plugin!
    Just one question, how can I show both user name and surname and email in users list?

    Thank you

    • This reply was modified 5 months, 4 weeks ago by draganaj.
    Plugin Author shalior

    (@shalior)

    Hi,
    Thanks,

    Paste this snippet in your child theme’s functions.php file. if needed, you can change line:4 to achieve other formats. right now its like:
    ‘lastname? user_email username’

    add_filter('wp_referral_code_invited_user_text' , function ($user_login, $user_id){
    	$user = get_userdata( $user_id );
    	if($user){
    		$text = $user->last_name . ' ' . $user->user_email . ' ' . $user_login;
    		return esc_html( $text );
    	}
    	return $user_login;
    } , 10, 2);
Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.