Loading a custom theme for drupal 7

 

in order to change the default theme for drupal 7,

you have to implement hook_custom_theme in your own module :

/**
 *
 * Implement hook_custom_theme
 *
 */
function mymodule_custom_theme(){
  global $user;
  // charging bartik theme for webmaster
  if (in_array('webmaster', $user->roles)){
    return 'bartik';
  }
}

in this example i have loaded bartik theme for the ‘webmaster’ role.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s