I have two template override - user-profile.tpl.php and views-view-fields--myviewname.tpl.php. To take effect those templates, I had to place them into the default enabled theme.

The main problem is that I use the default theme "bartik" and I got to place them into "themes/bartik/templates/" to let the drupal theme system know them.
I know it is not a good idea because it is just like hacking. I should use a custom theme or sub-theme from bartik, but I don't want to write any theme.

The only clue is that I have a custom module and I shall put them into that module ( sites/all/modules/mymodule/templates ). Then, I shall make a theme suggestion to let the theme system use them.

How can I do this or any better idea?

  • have you cleared the cache ? Because some times it creates problem if cache is not cleared Sep 20, 2012 at 6:23

2 Answers 2


when you create a sub-theme you do not need to create any "new" template, but you can change something from the "main-theme". So try to create a new sub-theme and put that files into sub-theme.



I resolved this using hook_theme_registry_alter(). I placed my theme files in sites/all/modules/mymodule/theme and then altered the theme registry with the hook.

function mymodule_theme_registry_alter(&$theme_registry){
    if( isset($theme_registry['user_profile']) ){
        $theme_registry['user_profile']['template'] = drupal_get_path('module', 'mymodule').'/theme/user-profile';
        $theme_registry['user_profile']['theme path'] = drupal_get_path('module', 'mymodule').'/theme';
  • You have overridden the theme registry not suggesting new theme. Jan 6, 2013 at 9:03
  • Yes, but this is how I resolved. If you have better solution, please post it as answer. You are welcome.
    – Sithu
    Jan 6, 2013 at 9:26

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.