displayed_user->id ) return false; if ( 'admin' == $bp->current_component && 'delete-user' == $bp->current_action ) { // Check the nonce check_admin_referer( 'delete-user' ); $errors = false; do_action( 'bp_core_before_action_delete_user', $errors ); if ( bp_core_delete_account( $bp->displayed_user->id ) ) { bp_core_add_message( sprintf( __( '%s has been deleted from the system.', 'buddypress' ), $bp->displayed_user->fullname ) ); } else { bp_core_add_message( sprintf( __( 'There was an error deleting %s from the system. Please try again.', 'buddypress' ), $bp->displayed_user->fullname ), 'error' ); $errors = true; } do_action( 'bp_core_action_delete_user', $errors ); if ( $errors ) bp_core_redirect( $bp->displayed_user->domain ); else bp_core_redirect( $bp->loggedin_user->domain ); } } add_action( 'bp_actions', 'bp_core_action_delete_user' ); /** * Returns the user_id for a user based on their username. * * @package BuddyPress Core * @param $username str Username to check. * @return false on no match * @return int the user ID of the matched user. */ function bp_core_get_random_member() { global $bp; if ( isset( $_GET['random-member'] ) ) { $user = bp_core_get_users( array( 'type' => 'random', 'per_page' => 1 ) ); bp_core_redirect( bp_core_get_user_domain( $user['users'][0]->id ) ); } } add_action( 'bp_actions', 'bp_core_get_random_member' ); ?>