Last active
December 22, 2015 21:09
-
-
Save deltafactory/6531372 to your computer and use it in GitHub Desktop.
Standalone script for WordPress/BuddyPress to activate all users. Now, with debugging.
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
<?php | |
// Place in a file in the main folder (same as wp-load.php). | |
// Code is completely untested. Use at your own risk. | |
require( 'wp-load.php' ); | |
df_activate_all_users(); | |
function df_activate_all_users() { | |
header( 'Content-type: text/plain' ); | |
$uids = get_users( array( 'fields' => 'ID' ) ); | |
foreach( $uids as $user_id ) { | |
echo 'Updating UID '. $user_id . ': '; | |
if ( get_user_meta( $user_id, 'wafp_is_affiliate', true ) ) { | |
echo 'Hiding Affiliate'; | |
delete_user_meta( $user_id, 'last_activity' ); | |
} else { | |
echo 'Setting active'; | |
update_user_meta( $user_id, 'last_activity', time() ); | |
} | |
echo "\n"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment