Skip to content

Instantly share code, notes, and snippets.

@deltafactory
Last active December 22, 2015 21:09
Show Gist options
  • Save deltafactory/6531278 to your computer and use it in GitHub Desktop.
Save deltafactory/6531278 to your computer and use it in GitHub Desktop.
BuddyPress snippet to remove "affiliate" users from the list of active users.
<?php
//Code is completely untested, may contain errors.
function affiliate_user_stealth_mode() {
if ( ! is_user_logged_in() )
return;
$user = wp_get_current_user();
if ( get_user_meta( $user->ID, 'affiliate', true ) ) {
remove_action( 'wp_head', 'bp_core_record_activity' );
delete_user_meta( $user->ID, 'last_activity' );
}
}
add_action( 'init', 'affiliate_user_stealth_mode' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment