- Patch #38981 by Robert: add permission to enable/disbale theme switching by users.

4.7.x
Dries Buytaert 2005-11-30 11:09:38 +00:00
parent 0f6067fc84
commit b8ae0b3218
4 changed files with 56 additions and 46 deletions

View File

@ -47,7 +47,7 @@ function system_help($section) {
* Implementation of hook_perm().
*/
function system_perm() {
return array('administer site configuration', 'access administration pages');
return array('administer site configuration', 'access administration pages', 'select different theme');
}
/**
@ -159,7 +159,10 @@ function system_test() {
*/
function system_user($type, $edit, &$user, $category = NULL) {
if ($type == 'form' && $category == 'account') {
if (user_access('select different theme')) {
$themes = list_themes();
if (count($themes) > 1) {
ksort($themes);
// Reset to follow site default theme if user selects the site default
@ -183,6 +186,8 @@ function system_user($type, $edit, &$user, $category = NULL) {
}
$form['themes']['theme'] = array('#type' => 'radios', '#options' => $options, '#default_value' => $edit['theme'] ? $edit['theme'] : variable_get('theme_default', 'bluemarine'));
}
}
if (variable_get('configurable_timezones', 1)) {
$zones = _system_zonelist();

View File

@ -47,7 +47,7 @@ function system_help($section) {
* Implementation of hook_perm().
*/
function system_perm() {
return array('administer site configuration', 'access administration pages');
return array('administer site configuration', 'access administration pages', 'select different theme');
}
/**
@ -159,7 +159,10 @@ function system_test() {
*/
function system_user($type, $edit, &$user, $category = NULL) {
if ($type == 'form' && $category == 'account') {
if (user_access('select different theme')) {
$themes = list_themes();
if (count($themes) > 1) {
ksort($themes);
// Reset to follow site default theme if user selects the site default
@ -183,6 +186,8 @@ function system_user($type, $edit, &$user, $category = NULL) {
}
$form['themes']['theme'] = array('#type' => 'radios', '#options' => $options, '#default_value' => $edit['theme'] ? $edit['theme'] : variable_get('theme_default', 'bluemarine'));
}
}
if (variable_get('configurable_timezones', 1)) {
$zones = _system_zonelist();

View File

@ -1820,7 +1820,7 @@ function user_help($section) {
<ul>
<li>view your <a href="%user">user page</a>.</li>
<li>administer user at <a href="%admin-user">administer &gt;&gt; user</a>.</li>
<li>allow users to select themes from their user account by enabling themes in <a href="%admin-themes">administer &gt;&gt; themes</a>.</li>
<li>allow users who have the "select different theme" permission to select themes from their user account by enabling themes in <a href="%admin-themes">administer &gt;&gt; themes</a>.</li>
<li>read user profile help at <a href="%admin-help-profile">administer &gt;&gt; help &gt;&gt; profile</a>.</li>
<li>read about distributed authentication in the system module help at <a href="%admin-help-system">administer &gt;&gt; help &gt;&gt; system</a>.</li>
</ul>

View File

@ -1820,7 +1820,7 @@ function user_help($section) {
<ul>
<li>view your <a href="%user">user page</a>.</li>
<li>administer user at <a href="%admin-user">administer &gt;&gt; user</a>.</li>
<li>allow users to select themes from their user account by enabling themes in <a href="%admin-themes">administer &gt;&gt; themes</a>.</li>
<li>allow users who have the "select different theme" permission to select themes from their user account by enabling themes in <a href="%admin-themes">administer &gt;&gt; themes</a>.</li>
<li>read user profile help at <a href="%admin-help-profile">administer &gt;&gt; help &gt;&gt; profile</a>.</li>
<li>read about distributed authentication in the system module help at <a href="%admin-help-system">administer &gt;&gt; help &gt;&gt; system</a>.</li>
</ul>