Settings';
array_unshift($links, $settings_link);
return $links;
}
$plugin = plugin_basename(__FILE__);
add_filter("plugin_action_links_$plugin", 'antihacker_plugin_settings_link' );
require_once (plugin_dir_path(__file__) . "settings/load-plugin.php");
require_once (plugin_dir_path(__file__) . "settings/options/plugin_options_tabbed.php");
add_filter('contextual_help', 'wptuts_contextual_help', 10, 3);
function wptuts_contextual_help($contextual_help, $screen_id, $screen)
{
$myhelp = '
Improve system security and help prevent unauthorized access to your account by ';
$myhelp .= 'restrict access to login page to whitelisted IP addresses.';
$screen->add_help_tab(array(
'id' => 'wptuts-overview-tab',
'title' => __('Overview', 'plugin_domain'),
'content' => '
' . $myhelp . '
', )); return $contextual_help; } $my_whitelist = trim(get_option('my_whitelist')); $my_whitelist = explode(PHP_EOL, $my_whitelist); $ip = trim(findip()); $admin_email = get_option( 'my_email_to' ); if (! whitelisted($ip, $my_whitelist)) { if(isset($_POST['myemail'])) { $myemail = strtolower(trim($_POST['myemail'])); } else { $myemail = ''; } add_action('login_form', 'email_display'); add_action('wp_authenticate_user', 'validate_email_field', 10, 2); function validate_email_field($user, $password) { global $myemail; if (!is_email($myemail)) return new WP_Error('wrong_email', 'Please, fill out the email field!'); else { $args = array( ); // The Query $user_query = new WP_User_Query( array ( 'orderby' => 'registered', 'order' => 'ASC' ) ); // User Loop if ( ! empty( $user_query->results ) ) { foreach ( $user_query->results as $user ) { // echo '' . $user->user_email . '
'; if(strtolower(trim($user->user_email)) == $myemail ) return $user; } } else { // echo 'No users found.'; } return new WP_Error( 'wrong_email', 'email not found!'); } return $user; } function email_display() { ?> My Wordpress user email: