Skip to content

Instantly share code, notes, and snippets.

@deltafactory
Last active December 22, 2015 21:09
Show Gist options
  • Save deltafactory/6531372 to your computer and use it in GitHub Desktop.
Save deltafactory/6531372 to your computer and use it in GitHub Desktop.
Standalone script for WordPress/BuddyPress to activate all users. Now, with debugging.
<?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