I'm using the Chaos tools display suite module to create a 'mini_teaser' view mode for my user profiles, but I can't seem to get drupal to read a custom template 'user-profile__mini_teaser.tpl.php' in my theme folder. In my user preprocess function, I'm adding theme suggestions, but they don't seem to work. Any ideas?

2 Answers 2


It's hard to tell without seeing your code but off the top of my head your preprocess function should look something like this:

function MYTHEME_preprocess_user_profile(&$vars) {
  if ($vars['view_mode'] == 'mini_teaser') {
    $vars['theme_hook_suggestions'][] = 'user_profile__mini_teaser';

Or a more generic solution:

function MYTHEME_preprocess_user_profile(&$vars) {
  $vars['theme_hook_suggestions'][] = 'user_profile__' . $vars['view_mode'];
  • Just tried this, but the $vars['view_mode'] value appears to be located in $vars['elements']['#view_mode']. Found by dpm($vars); in the preprocess function. Mar 13, 2015 at 13:43

Normally you would replace the underscores from

$variables['theme_hook_suggestions'][] = 'user_profile__mini_teaser'; 

with hyphens in the template file name:

i.e, rename template file to:


After clearing theme registry cache, see if that, or a similar underscore / hyphen filename adjustment helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.