function bb_upgrade_180() { if (($dbv = bb_get_option_from_db('bb_db_version')) && $dbv >= 559) { return; } global $bbdb; foreach ((array) $bbdb->get_col("SELECT ID FROM {$bbdb->users} WHERE user_status = 1") as $user_id) { bb_delete_user($user_id); } bb_update_option('bb_db_version', 559); return 'Done clearing deleted users: ' . __FUNCTION__; }
} // Find out if we have a valid email address if (isset($user_email) && !($user_email = is_email($user_email))) { $errors->add('user_email', __('Invalid email address'), array('data' => $_POST['user_email'])); } // Deal with errors for users who can edit others data if (bb_current_user_can('edit_users')) { // Get the user object $user_obj = new BP_User($user->ID); // If we are deleting just do it and redirect if (isset($_POST['delete-user']) && $_POST['delete-user'] && $bb_current_id != $user->ID) { if (!bb_current_user_can('keep_gate') && 'keymaster' == $user_obj->roles[0]) { /* Only a keymaster can delete another keymaster */ $errors->add('delete', __('You can not delete this user!')); } else { bb_delete_user($user->ID); nxt_redirect(bb_get_uri(null, null, BB_URI_CONTEXT_HEADER)); exit; } } // Store the new role $role = $_POST['role']; // Deal with errors with the role if (!isset($nxt_roles->role_objects[$role])) { $errors->add('role', __('Invalid Role')); } elseif (!bb_current_user_can('keep_gate') && ('keymaster' == $role || 'keymaster' == $user_obj->roles[0])) { $errors->add('role', __('You are not the Gate Keeper.')); } elseif ('keymaster' == $user_obj->roles[0] && 'keymaster' != $role && $bb_current_id == $user->ID) { $errors->add('role', __('You are Keymaster, so you may not demote yourself.')); } // Sanitize the profile admin keys and check for missing required data