How to modify access controls for Walled Gardens: Revision

Last updated by Ed Lyons

This page will contain information about various ways of modifying access controls for Walled Gardens

Contents

1.  Removing access levels

2.  Changing names of access levels

3.  Changing ordering of access options

 

Removing Access Levels

There are two ways to do this:  remove an access level totally, or make it so it isn't displayed.  Let's do the "make it so it isn't displayed" option first.  This is about rendering the HTML without the thing you don't want.

The file we want to override is in (starting with the web root)  /views/default/input/access.php

You don't want to edit that, but create a plugin that does it.  Not too hard.  Follow the usual directions for creating a plugin, (create a plugin directory, and have two files under that (manifest.xml and start.php) and then create the directory structure: /views/default/input) and then create the file to override it: access.php

You're going to copy the original file to this one, then make changes.  You'll notice there are two sections of code.  The first one gets the access levels, then second one renders it in HTML.  You can, if you really, really know what you're doing - unset members of the access array in the PHP section.  But, instead, we're going to focus on the HTML rendering section.

The key section is the loop:

foreach($vars['options'] as $key => $option) {
        if ($key != $vars['value']) {
            echo "<option value=\"{$key}\">". htmlentities($option, ENT_QUOTES, 'UTF-8') ."</option>";
        } else {
            echo "<option value=\"{$key}\" selected=\"selected\">". htmlentities($option, ENT_QUOTES, 'UTF-8') ."</option>";
        }

Let's say that you wanted to get rid of the "Private" option.  You could make this the first line of the loop:

if ($key == 0 && $option == 'Private') { continue; }

This would skip over rendering that option in HTML and the user would never see it.  You have to test the index number and the option otherwise you'll knock out the 0th index of the group permissions setup page.  This way, it will be OK on that page.

(to be continued here...)