📥 My Awesome Plugin
This plugin helps you automate tasks and improve web performance.
⬇️ Download Plugin ZIP💌 Subscribe to Updates
WordPress free plugin called “Email Login Notifier” that sends an email to the user whenever a login occurs from a new device or IP address. The plugin will be easy to set up for non-coders, requiring only activation and minimal configuration. It will store known IP addresses for each user in the WordPress database and send an email if a login occurs from an unrecognized IP. The plugin will use WordPress’s built-in email functionality for reliability.
Email Login Notifier free plugin
Installation and Setup Instructions
- Download the Plugin:
- Copy the PHP code above into a file named wp-email-login-notifier.php.
- Place this file in a folder named wp-email-login-notifier.
- already done zipped
- Upload to WordPress:
- Zip the wp-email-login-notifier folder.
- In your WordPress admin dashboard, go to Plugins > Add New > Upload Plugin.
- Upload the zipped folder and click Install Now.
- Activate the Plugin:
- After installation, click Activate Plugin.
- Verify Email Settings:
- The plugin uses WordPress’s built-in wp_mail() function, which relies on your server’s email configuration.
- Ensure your WordPress site can send emails. You can test this by using a plugin like “Check & Log Email” or by triggering a password reset email.
- If emails are not sending, you may need to configure an SMTP plugin (e.g., WP Mail SMTP) to use a service like Gmail or SendGrid.
- View Known IPs (Optional):
- In the WordPress admin dashboard, a new menu item called Login IPs will appear for administrators.
- Click it to view a table of the last 50 known IP addresses used for logins, including the user, IP, and last login time.
Features
- Email Notifications: Sends an email to the user when a login occurs from a new IP address.
- Tracks Known IPs: Stores each user’s known IP addresses in a database table (wp_known_ips).
- Admin Dashboard: Administrators can view a list of known IPs and their associated users.
- Easy Setup: No coding required; just install and activate.
- Single File: All functionality is contained in one PHP file for simplicity.
- Secure: Uses WordPress best practices for database interactions and data sanitization.
How It Works
- When a user logs in, the plugin checks their IP address against a database of known IPs for that user.
- If the IP is new, it sends an email to the user’s registered email address with details of the login (IP, date, and site URL).
- The new IP is then stored in the database to prevent duplicate notifications for the same IP.
- The email includes a warning to secure the account if the login was unauthorized.
Notes
- The plugin creates a database table (wp_known_ips) to store IP addresses and login times.
- Emails are sent using the WordPress wp_mail() function, so your server must be configured to send emails.
- Only administrators can view the known IPs in the admin dashboard.
- The plugin is lightweight and compatible with WordPress 5.0 and above.
- For security, the plugin sanitizes and escapes all data to prevent vulnerabilities.