get_names(); foreach ($roleNames as $role => $roleName) { $roleObj = $wp_roles->get_role($role); if (is_array($rolePerms) && in_array($role, $rolePerms)) { /* Bug in PHP code: if I use $wp_roles->add_cap() instead of calling add_cap() on a Role object the object does not get updated - the updates below which ask the Role objects for their state are thus out of sync until the next page reload. bad: $wp_roles->add_cap($role, 'can_runPHP'); */ $roleObj->add_cap('can_runPHP', true); } else { $roleObj->add_cap('can_runPHP', false); } } // I'd prefer to use this wp_redirect, but WP has already sent headers... /* $to = $_SERVER['REQUEST_URI'] . '&updated=true'; wp_redirect($to); */ echo '
'; _e('Update completed successfully.', 'runPHP'); echo '