function add_expiration_stamp($user, $username, $password)
 {
     // Check we have a user by this point
     if (is_a($user, 'WP_User')) {
         // We have a user, which we should if the standard authentication worked and passed it through
         $expiration = get_user_meta($user->ID, '_shrkey_password_expiration_start', true);
         if (empty($expiration)) {
             // Check if we need to set a timestamp
             $expirationperiod = shrkey_get_option('_shrkey_expirepassword_expirationperiod', 0);
             if ($expirationperiod > 0) {
                 // We have a period - set the stamp
                 update_user_meta($user->ID, '_shrkey_password_expiration_start', time());
             }
         } else {
             // We have an expiration - so check if it is over our limit and if so expire the password for the next login
             $expirationperiod = shrkey_get_option('_shrkey_expirepassword_expirationperiod', 0);
             if ($expirationperiod > 0) {
                 // We have a period - set check the stanp
                 if (strtotime($expirationperiod . ' days', $expiration) <= time()) {
                     // We have expired
                     shrkey_set_usermeta_oncer($user->ID, '_shrkey_password_expired', time());
                 }
             }
         }
     }
     // return the user object
     return $user;
 }
 function process_user_queue_action()
 {
     $action = $this->current_action();
     if ($action) {
         switch ($action) {
             case 'userexpirepassword':
                 check_admin_referer('userexpirepassword');
                 if (isset($_GET['user']) && is_numeric($_GET['user'])) {
                     shrkey_set_usermeta_oncer((int) $_GET['user'], '_shrkey_password_expired', time());
                     wp_safe_redirect(add_query_arg('passwordexpirationmsg', 1, wp_get_referer()));
                 } else {
                     wp_safe_redirect(add_query_arg('passwordexpirationmsg', 2, wp_get_referer()));
                 }
                 break;
             case 'bulkuserexpirepassword':
                 if (is_multisite() && is_network_admin()) {
                     check_admin_referer('bulk-users-network');
                     if (isset($_POST['allusers'])) {
                         foreach ($_POST['allusers'] as $user) {
                             shrkey_set_usermeta_oncer((int) $user, '_shrkey_password_expired', time());
                         }
                     }
                 } else {
                     check_admin_referer('bulk-users');
                     if (isset($_GET['users'])) {
                         foreach ($_GET['users'] as $user) {
                             shrkey_set_usermeta_oncer((int) $user, '_shrkey_password_expired', time());
                         }
                     }
                 }
                 wp_safe_redirect(add_query_arg('passwordexpirationmsg', 3, wp_get_referer()));
                 exit;
                 break;
         }
     }
     // This is to attempt to add in some bulk operations - bit of a hack, but no hook or filter to add in our own at the moment
     add_action('all_admin_notices', array(&$this, 'start_object_to_modify_bulk'), 99);
 }