mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-07-11 18:56:10 +09:00
Improves the code that clears passwords in database
This commit is contained in:
@@ -270,19 +270,24 @@
|
||||
}
|
||||
|
||||
/***
|
||||
*** @secure passwords
|
||||
*** @secure passwords
|
||||
*** Updated by Bo Carlson (bo@fictiontribe.com) to clear fields in DB without looping users. Much faster.
|
||||
***/
|
||||
add_action('um_admin_do_action__um_passwords_secured', 'um_admin_do_action__um_passwords_secured');
|
||||
function um_admin_do_action__um_passwords_secured( $action ){
|
||||
global $ultimatemember;
|
||||
global $ultimatemember; //ultimate member global object
|
||||
global $wpdb; //Wordpress DB object
|
||||
|
||||
//die if admin can't manage options
|
||||
if ( !is_admin() || !current_user_can('manage_options') ) die();
|
||||
|
||||
$users = get_users();
|
||||
foreach( $users as $user ) {
|
||||
delete_user_meta( $user->ID, 'confirm_user_password' );
|
||||
update_user_meta( $user->ID, 'submitted', '' );
|
||||
}
|
||||
|
||||
|
||||
//remove all confirm_user_password from DB
|
||||
$wpdb->delete($wpdb->usermeta,['meta_key'=>'confirm_user_password']);
|
||||
|
||||
//then reset submitted
|
||||
$wpdb->update($wpdb->usermeta,['meta_value'=>''],['meta_key'=>'submitted']);
|
||||
|
||||
//then set flag that update is complete and redirect to admin home
|
||||
update_option( 'um_passwords_secured', 1 );
|
||||
exit( wp_redirect( admin_url() ) );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user