You are here

function themekey_user_profile_uid2profile_theme in ThemeKey 7

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

Set custom theme from given user id (uid)

Parameters

$uid user id:

Return value

null|string

1 string reference to 'themekey_user_profile_uid2profile_theme'
themekey_user_profile_themekey_properties in ./themekey_user_profile.module
Implements hook_themekey_properties().

File

./themekey_user_profile.module, line 130
ThemeKey User Profile allows the user to select a personal theme in her user profile. This theme will be used to render the pages instead of the theme the administrator configured as soon as the user logs in.

Code

function themekey_user_profile_uid2profile_theme($uid) {
  $custom_theme =& drupal_static('themekey_custom_theme', '');
  $theme = db_select('users', 'u')
    ->fields('u', array(
    'theme',
  ))
    ->condition('uid', $uid)
    ->execute()
    ->fetchField();
  if ('default' != $theme) {
    if (themekey_check_theme_enabled($theme)) {
      $custom_theme = $theme;
      return 'static';
    }
  }
  return NULL;
}