Created
December 15, 2018 00:05
-
-
Save greathmaster/2646d6f46ee3a74937da380fb6f5256c to your computer and use it in GitHub Desktop.
PMPro Lock Membership Levels-lock existing members. Add this to your customizations plugin and refresh the page. Recommend deleting the code snippet after the operation is complete.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
PMPro Lock Membership Levels-lock existing members. Add this to your customizations plugin and refresh the page. Recommend deleting the code snippet after the operation is complete. | |
*/ | |
function bulk_lock_all_members() | |
{ | |
global $wpdb; | |
$users = $wpdb->get_results( "SELECT ID FROM $wpdb->users" ); | |
if( $users ) { | |
foreach ( $users as $user ) { | |
update_user_meta( $user->ID, 'pmprolml', 1 ); | |
} | |
} | |
} | |
add_action( "init", "bulk_lock_all_members", 10, 0 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment