BuddyDev

Search

[Resolved] WordPress User Login Notifier

  • Participant
    Level: Master
    Posts: 222
    Mike (DesignServe) on #26171

    Hi Brajesh,

    I love the plugin WordPress User Login Notifier. It is so useful for troubleshooting my site and seeing what issues users are having so that I can help out.

    1 – Would it be possible to add the user’s email address into the notifications so that I don’t have to go in the site to search and find them, then copy the email address to my email program if I want to email them? (I can’t click email addresses for mailto links because I use different browsers and email clients for work purposes, the work ones have to be the defaults).

    2 – I considered that I would like to send a ‘help’ email to them if they fail to log in. It would tell them how to get help like changing their password or use my contact form for example. However, we don’t want that to be sent to spammers. I leave it here as an idea for you. Perhaps a backend place where we could see a log of the notifications and click to send automated canned responses would be an idea (a premium version perhaps).

    Thanks,
    Mike

  • Keymaster
    (BuddyDev Team)
    Posts: 24697
    Brajesh Singh on #26175

    Hi Mike,
    Thank you for using the plugin.
    1. Please add following code to your bp-custom.php

    
    
    /**
     * Append User email to the admin notifications messages by the WordPress user login Notifier.
     *
     * @param string  $message message.
     * @param WP_User $user user object.
     *
     * @return string
     */
    function wpul_custom_append_user_email_to_message( $message, $user ) {
    	return $message . '\n Email:' . $user->user_email . '\n';
    }
    
    add_filter( 'wpuln_failed_login_admin_email_message', 'wpul_custom_append_user_email_to_message', 10, 2 );
    add_filter( 'wpuln_successful_login_admin_email_message', 'wpul_custom_append_user_email_to_message', 10, 2 );
    
    

    That will add email to the message.

    2. Thank you for the suggestion. At the moment, we do not store the log at all. It may be a helpful feature in future.

    Regards
    Brajesh

  • Participant
    Level: Initiated
    Posts: 4
    Meet on #51317
    This reply has been marked as private.
  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115
    Ravi on #51329

    Hello,

    Welcome to the BuddyDev forums. Please try the following way:

    
    
    // For filtering user email subject.
    add_filter( 'wpuln_successful_login_user_email_subject', function ( $subject, $user ) {
    	return $subject;
    }, 10, 2 );
    // For filtering user email message.
    add_filter( 'wpuln_successful_login_user_email_message', function ( $message, $user ) {
    	return $message;
    }, 10, 2 );
    
    

    please let me know if it helps.

    Regards
    Ravi

    • This reply was modified 11 months, 2 weeks ago by Ravi.
  • Participant
    Level: Initiated
    Posts: 4
    Meet on #51354

    // For filtering user email message.
    add_filter( ‘wpuln_successful_login_user_email_message’, function ( $message, $user ) {
    return $message;
    }, 10, 2 );

    function custom_login_email_message( $message, $user ) {
    // Modify the $message as needed
    $modified_message = ‘<p>New Content</p>’;
    return $modified_message;
    }
    add_filter( ‘wpuln_successful_login_user_email_message’, ‘custom_login_email_message’, 10, 2 );

    I am using like this so I also need to send
    // Additional headers
    $headers = array(
    ‘Content-Type: text/html; charset=UTF-8’,
    );

    How to do that

  • Participant
    Level: Initiated
    Posts: 4
    Meet on #51355

    And also I want to trigger an email if it is logged in with the new ip

  • Keymaster
    (BuddyDev Team)
    Posts: 24697
    Brajesh Singh on #51370

    Hi Meet,
    for your last question(about trigger), we do not log the user’s login details anywhere. So, it is not feasible to compare the ips unless it is stored somewhere.

    It’s a great suggestion though and we would love to have it in near future.

    Regards
    Brajesh

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115
    Ravi on #51377

    Hello Meet,

    Please try the following to send custom headers:

    
    add_filter( 'wpuln_successful_login_admin_email_headers', function ( $headers ) {
    	$headers[] = 'Content-Type: text/html; charset=UTF-8';
    
    	return $headers;
    } );
    
    

    Please let me know if it helps or not.

    Regards
    Ravi

  • Participant
    Level: Initiated
    Posts: 4
    Meet on #51390

    Thanks Ravi and Brajesh
    For a great support

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115
    Ravi on #51395

    You are welcome.

You must be logged in to reply to this topic.

This topic is: resolved