Theme swapping

Name

Session Theme Switcher

Module type

Block

Author

Shane Elliott

Released

2007

Maintained

Limited

Languages

English

Compliance

OK

Documentation

None

Errors

None displayed

If you have a strict corporate institutional site, then there has probably been a lot of thought put into making your theme in order to achieve effective "branding". Fiddling with this might be worth your job. However, if you are not bound by such restrictions, then perhaps you are able to offer users some choice in the look and feel of your site.

The Session Theme Switcher block allows users to change the theme used on a site for the duration of their session in Moodle. The capability for switching themes is limited to teachers and administrators, but could even be extended to other users.

Getting ready

Unzip and copy the block directory into the /moodle/blocks/ directory, but don't visit the Notifications page yet. Delete the install.xml and upgrade.php files from the /moodle/blocks/session_theme/db directory, leaving the access.php file. After deleting these files, you can then visit the Notifications page.

How to do it...

With the code in place, there is another setting you need to add. Open the /moodle/config.php file. This is the global configuration file. Add the following line to the file, after the initial unset() function call.

$CFG->allowthemechangeonurl = 1;

You will then be able to add the Session Theme block from the Blocks menu. Add the block to the site root page; when added to course pages, it does change the theme, but does not return the user to the course, which could be confusing.

To allow users other than teachers and administrators to change their session theme, you can modify the permissions at Site Administration | Users | Permissions | Define roles. Editing the permissions of the "Authenticated user" role will have an effect on all users. The Switch themes permission controls the ability to use this block.

How it works...

When installed, the block allows the user to select a theme by name from a list:

How it works...

When a new theme is selected, the page reloads with the new theme appearing:

How it works...

After the user logs out and returns to the site, the theme returns to the site's nominated theme.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.135.247.68