Ignore:
Timestamp:
Mar 26, 2010, 3:16:54 PM (14 years ago)
Author:
plg
Message:

feature 1514: make the "deactivate" action inactive if there is no active
theme left.

bug fixed: when setting the default theme, make sure at least one user will
be updated.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/include/themes.class.php

    r5340 r5382  
    118118        }
    119119
     120        // you can't deactivate the last theme
     121        if (count($this->db_themes_by_id) <= 1)
     122        {
     123          array_push(
     124            $errors,
     125            l10n('Impossible to deactivate this theme, you need at least one theme.')
     126            );
     127          break;
     128        }
     129
    120130        if ($theme_id == get_default_theme())
    121131        {
     
    228238  function set_default_theme($theme_id)
    229239  {
     240    global $conf;
     241   
    230242    // first we need to know which users are using the current default theme
    231243    $default_theme = get_default_theme();
     
    237249  WHERE theme = "'.$default_theme.'"
    238250;';
    239     $user_ids = array_from_query($query, 'user_id');
     251    $user_ids = array_unique(
     252      array_merge(
     253        array_from_query($query, 'user_id'),
     254        array($conf['guest_id'], $conf['default_user_id'])
     255        )
     256      );
    240257
    241258    // $user_ids can't be empty, at least the default user has the default
Note: See TracChangeset for help on using the changeset viewer.