function rename_role($role_name_old, $role_type = 'rs') { $role_name_new = $_POST['role-name']; if (!$role_name_old) { return; } global $wpdb; scoper_query("UPDATE {$wpdb->user2role2object_rs} SET role_name = '{$role_name_new}' WHERE role_type = '{$role_type}' AND role_name = '{$role_name_old}'"); ScoperAdminLib::schedule_role_sync(); // sync_wp_roles() will also flush cache on role rename }