'Disable swfAddress when logged in as a node administrator' option
amcc - March 23, 2009 - 13:25
| Project: | SWFAddress |
| Version: | 6.x-1.x-dev |
| Component: | User interface |
| Category: | feature request |
| Priority: | minor |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
I've found it useful to have swf replacement disabled when i'm editing and adding nodes - this makes it easier to stay in the admin section and work as a moderator for the site. I've modified the module as below to do this - if anyone finds this useful then perhaps it could be good to stick it in the module.
Added a tickbox and variable in this function - swfaddress_admin_form():
<?php
$form['swfaddress_admin_disable'] = array(
'#type' => 'checkbox',
'#title' => t('Disable if logged in as a node administrator'),
'#description' => t('If checked this will turn off Flash replacement if logged in with administer node permissions'),
'#default_value' => variable_get('swfaddress_admin_disable', FALSE)
);
?>Changed the logic in this function - swfaddress_init() where the javascript gets added:
<?php
// Converted from the old hook_menu($may_cache) by chok.
//&& (variable_get('swfaddress_replacement_enabled', FALSE) && !user_access('administer nodes'))
if (variable_get('swfaddress_replacement_enabled', FALSE)
&& variable_get('clean_url', 0) == 1
&& _swfaddress_path_permitted()
// I've added the line below...
&& (!variable_get('swfaddress_admin_disable', FALSE) || !user_access('administer nodes'))
) {
// It is vitally important that swfobject.js be included before SWFAddress!
?>
#1
Great improvement of usability! Thanks, I’ve been looking exactly for this :-)