Title: wrong code
Last modified: August 19, 2022

---

# wrong code

 *  [stephenbolu](https://wordpress.org/support/users/stephenbolu/)
 * (@stephenbolu)
 * [3 years, 10 months ago](https://wordpress.org/support/topic/wrong-code-2/)
 * pls help me to check this login notifcation code
 * i try inputting it but it did not work pls check and correct it
 *     ```
       add_action( 'wp_login', 'my_user_login_email', 10, 2 );
   
       function my_user_login_email( $user_login, $user ) {
   
        wp_mail( $user->user_email, 'Login Notification ' . $user_login, 'Dear $user_login, 
   
       We noticed a recent login to your STEPHEN EXCHANGE account with the following details:
   
       IP Address: 
       Date and Time:
   
       If this was you, you may ignore this message 😅. If this wasn’t you, please log into your Stephen Exchange account immediately to change your password. We recommend you take the following steps:
   
       1: Click on the "MENU" and select "SETTING"
   
       2: Click on the Gear ⚙️ in the right Conner on your profile picture and click on "MY ACCOUNT"
   
       3: scroll down and click on "CHANGE PASSWORD" put the current payment and the new password then confirm your new password and click on "UPDATE PASSWORD"
   
       We're always here to help if you need it. You can visit contact us via support@stephenexchange.com for more information 
   
       Best,
       STEPHEN EXCHANGE TEAM ' . um_user_profile_url( $user->ID ) );
       }
       ```
   
 * and help me to add the ip address of each user and date and time
 * thanks

Viewing 5 replies - 1 through 5 (of 5 total)

 *  [missveronica](https://wordpress.org/support/users/missveronicatv/)
 * (@missveronicatv)
 * [3 years, 10 months ago](https://wordpress.org/support/topic/wrong-code-2/#post-15933114)
 * [@stephenbolu](https://wordpress.org/support/users/stephenbolu/)
 * You can try this code snippet:
 *     ```
       add_action( 'wp_login', 'my_user_login_email', 10, 2 );
   
       function my_user_login_email( $user_login, $user ) {
   
           $time_format = get_option( 'date_format' ) . ' ' . get_option( 'time_format' );
           $date_time = date_i18n( $time_format, current_time( 'timestamp' ));
           $headers = array( 'Content-Type: text/html; charset=UTF-8' );
   
           $message = "Dear " . esc_attr( $user_login ) . ",
           <br><br>We noticed a recent login to your STEPHEN EXCHANGE account with the following details:    
           <br><br>IP Address: " . esc_attr( um_user_ip()) .
           "<br>Date and Time: " . esc_attr( $date_time ) .
           "<br><br>If this was you, you may ignore this message 😅. 
           <br>If this wasn’t you, please log into your Stephen Exchange account immediately to change your password. 
           <br><br>We recommend you to take the following steps:    
           <br>1: Click on the \"MENU\" and select \"SETTING\"    
           <br>2: Click on the Gear ⚙️ in the right Corner on your profile picture and click on \"MY ACCOUNT\"    
           <br>3: Scroll down and click on \"CHANGE PASSWORD\" put the current password and the new password then confirm your new password and click on \"UPDATE PASSWORD\"    
           <br><br>We're always here to help if you need it. 
           <br>You can contact us via <a href=\"mailto:support@stephenexchange.com\">support@stephenexchange.com</a> for more information.    
           <br><br>Best,
           <br><a href=\"" . esc_url( um_user_profile_url( $user->ID )) . "\">STEPHEN EXCHANGE TEAM</a>";
   
           wp_mail( $user->user_email, 'Login Notification ' . esc_attr( $user_login ), $message, $headers ); 
       }
       ```
   
 *  Moderator [Jan Dembowski](https://wordpress.org/support/users/jdembowski/)
 * (@jdembowski)
 * Forum Moderator and Brute Squad
 * [3 years, 10 months ago](https://wordpress.org/support/topic/wrong-code-2/#post-15933171)
 * [@stephenbolu](https://wordpress.org/support/users/stephenbolu/) Can you please
   not make duplicate topics again? It makes it harder for volunteers to support
   you when you do that.
 * I archived that latest duplicate topic.
 *  Thread Starter [stephenbolu](https://wordpress.org/support/users/stephenbolu/)
 * (@stephenbolu)
 * [3 years, 10 months ago](https://wordpress.org/support/topic/wrong-code-2/#post-15933197)
 * Okay thanks you guys are very helpful 🥰🥰🥰🥰
 *  Thread Starter [stephenbolu](https://wordpress.org/support/users/stephenbolu/)
 * (@stephenbolu)
 * [3 years, 10 months ago](https://wordpress.org/support/topic/wrong-code-2/#post-15933246)
 * but when i login to my site i did not recevice any notifcation buy before am 
   receing the login notifcartion
 *  [missveronica](https://wordpress.org/support/users/missveronicatv/)
 * (@missveronicatv)
 * [3 years, 10 months ago](https://wordpress.org/support/topic/wrong-code-2/#post-15933491)
 * [@stephenbolu](https://wordpress.org/support/users/stephenbolu/)
 * Install the “Check & Log Email” plugin and log and view all emails sent from 
   WordPress.
 * Note that many email clients considers emails where email from-address and to-
   address are equal to be spam.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘wrong code’ is closed to new replies.

 * ![](https://ps.w.org/ultimate-member/assets/icon-256x256.png?rev=3160947)
 * [Ultimate Member – User Profile, Registration, Login, Member Directory, Content Restriction & Membership Plugin](https://wordpress.org/plugins/ultimate-member/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/ultimate-member/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/ultimate-member/)
 * [Active Topics](https://wordpress.org/support/plugin/ultimate-member/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ultimate-member/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ultimate-member/reviews/)

 * 7 replies
 * 3 participants
 * Last reply from: [missveronica](https://wordpress.org/support/users/missveronicatv/)
 * Last activity: [3 years, 10 months ago](https://wordpress.org/support/topic/wrong-code-2/#post-15933491)
 * Status: not resolved