/[drupal]/contributions/modules/role_theme_switcher/role_theme_switcher.install
ViewVC logotype

Diff of /contributions/modules/role_theme_switcher/role_theme_switcher.install

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.3.2.3, Thu Apr 23 15:21:13 2009 UTC revision 1.3.2.4, Fri Jul 3 14:26:04 2009 UTC
# Line 8  function role_theme_switcher_uninstall() Line 8  function role_theme_switcher_uninstall()
8    $themes = list_themes();    $themes = list_themes();
9    
10    foreach ($roles as $id => $role)    foreach ($roles as $id => $role)
11    {      variable_del(strtolower('role_theme_switcher_'.$id.'_theme'));
     $role_name = str_replace(' ', '_', $role);  
     variable_del(strtolower($role_name).'_theme');  
   }  
12  }  }
13    
14  function role_theme_switcher_install()  function role_theme_switcher_install()
# Line 19  function role_theme_switcher_install() Line 16  function role_theme_switcher_install()
16    // Set the weight of the module to -2 so it is loaded BEFORE any other regular module, that could also switch themes    // Set the weight of the module to -2 so it is loaded BEFORE any other regular module, that could also switch themes
17    db_query("UPDATE {system} SET weight = -2 WHERE name = 'role_theme_switcher'");    db_query("UPDATE {system} SET weight = -2 WHERE name = 'role_theme_switcher'");
18  }  }
19    
20    
21    /**
22     * Variable names are changed
23     * Was: <role_name>_theme
24     * Now: role_theme_switcher_<role_id>_theme
25     * Thus we avoid translation collisions, when Role Names were translated
26     */
27    function role_theme_switcher_update_6001()
28    {
29      $roles = user_roles();
30    
31      // Get all themes
32      $themes = list_themes();
33      $themes_list = array_merge(array(t('Default')), array_keys($themes));
34    
35      // Copy value from old variable to a new one, and delete old variable
36      foreach ($roles as $id => $role)
37      {
38        $assigned_theme = str_replace(' ', '_', $role).'_theme';
39        $val = variable_get(strtolower($assigned_theme), '');
40    
41        if (!empty($val))
42          variable_set('role_theme_switcher_'.$id.'_theme', $val);
43    
44        variable_del($assigned_theme);
45      }
46    
47      $ret[] = array('success' => TRUE, 'query' => 'Changed names of old ROLE THEME SWITCHER variables');
48    
49      return $ret;
50    }

Legend:
Removed from v.1.3.2.3  
changed lines
  Added in v.1.3.2.4

  ViewVC Help
Powered by ViewVC 1.1.2