Textpattern plugin: switch roles

n: smd_faux_role | v: 0.20 | f: /

Documentation for the Textpattern plugin smd_faux_role by Stef Dawson follows this short message from our sponsor ;-)

Plugin list button Plugin download button Compressed plugin download button

smd_faux_role

Alter user privs at any time so you can experience the admin side as other users see it.

Author

Stef Dawson. For other software by me, or to make a donation, see the software page.

Installation / Uninstallation

Requires TXP 4.3.0+

Download the plugin from either textpattern.org, or the software page above, paste the code into the TXP Admin -> Plugins pane, install and enable the plugin. Visit the forum thread for more info or to report on the success or otherwise of the plugin.

To remove the plugin, simply delete it from the Admin->Plugins tab. Whenever you delete or disable the plugin the nominated accounts are all automatically restored to Publisher.

Usage

For security reasons you must edit the plugin code before using it. You can customise two parameters:

Users

Alter the following line to represent the user (login) name or names of your main Publisher account(s):

	$smd_faux_publish_user = '';

For example, if your main publisher login was Fred, you would change that line to read:

	$smd_faux_publish_user = 'Fred';

If you wanted to allow two users — Fred and Daphne — to alter their privs, specify them like this:

	$smd_faux_publish_user = 'Fred, Daphne';

Once that is done, save the plugin. A new tab will appear under Admin->Switch role when you are logged in as one of the nominated accounts. Use the dropdown to set this user’s privs level. It does this directly and permanently in the database.

Please note:

  • Login names are case-sensitive
  • Publisher privs will be restored to all nominated accounts when the plugin is either disabled or deleted

Dropdown position

Alter the following line to determine where you want the dropdown to appear for all nominated users:

	$smd_faux_position = '0';

If you set it to 0, the dropdown will appear in its own tab under Admin->Switch role. If you set it to anything else, the plugin assumes you are defining the x and y co-ordinates of the screen location at which you wish the dropdown to appear in the interface — on all tabs.

For example, to set the dropdown to appear on the top bar (in the classic theme at least) at 700px from the left edge of the screen:

	$smd_faux_position = '700';

To set it to appear at 750 pixels from the left and 72 pixels from the top:

	$smd_faux_position = '750, 72';

Although the dropdown is absolutely positioned (so it won’t interfere with your admin side layout) no guarantee is made that it will appear correctly in themes other than classic and remora because it depends how the author has designed the header. Experiment to find the best location. You may use negative values if required.

Changelog

  • 11 Apr 10 | 0.10 | Initial release
  • 11 Aug 10 | 0.20 | Requires TXP 4.3.0 ; publisher privs restored on logout (thanks net-carver)

Source code

If you’d rather spend time with the bytes, you’ll need to step into the view source page.

Legacy software

If, for some inexplicable reason, you need an old version of a plugin, it can probably be found on the plugin archive page.

Experimental software

If you’re feeling brave, or fancy swimming with piranhas, you can test out some of my beta code. It can be found on the plugin beta page.