You are here

function themekey_ui_user_insert in ThemeKey 7

Same name and namespace in other branches
  1. 7.3 themekey_ui.module \themekey_ui_user_insert()
  2. 7.2 themekey_ui.module \themekey_ui_user_insert()

Implementation of hook_user_insert()

Parameters

unknown_type $edit:

unknown_type $account:

unknown_type $category:

1 call to themekey_ui_user_insert()
themekey_ui_user_update in ./themekey_ui.module
Implementation of hook_node_update()

File

./themekey_ui.module, line 367
ThemeKey UI is an extension for ThemeKey

Code

function themekey_ui_user_insert(&$edit, $account, $category) {
  if (user_access('assign theme to own nodes') && variable_get('themekey_ui_author', 0) && !empty($edit['themekey_ui_theme'])) {
    if (db_select('themekey_ui_author_theme', 't')
      ->fields('t')
      ->condition('uid', $account->uid)
      ->execute()
      ->rowCount()) {
      db_update('themekey_ui_author_theme')
        ->fields(array(
        'uid' => $account->uid,
        'theme' => $edit['themekey_ui_theme'],
      ))
        ->condition('uid', $account->uid)
        ->execute();
    }
    else {
      db_insert('themekey_ui_author_theme')
        ->fields(array(
        'uid' => $account->uid,
        'theme' => $edit['themekey_ui_theme'],
      ))
        ->execute();
    }
    if (isset($account->themekey_ui_theme) && $edit['themekey_ui_theme'] != $account->themekey_ui_theme) {

      // theme settings changed
      // fast deletion of page cache (truncate)
      cache_clear_all('*', 'cache_page', TRUE);
    }
    $edit['themekey_ui_theme'] = NULL;
  }
}