Skip to main content
Tweeted twitter.com/StackDrupal/status/922665504556412930
replaced http://drupal.stackexchange.com/ with https://drupal.stackexchange.com/
Source Link

I'm willing to change the user-profile-item.tpl.php template provided by the user module.

I've created a new template file. Now my question is:

  1. Where do I put the new template user-profile-item.tpl.php template file? I've created a custom module, should I place it right in the custom module's directory?
  2. Do I need anything to do so that Drupal picks up my template file instead of the default template file?

PS I got this linklink did not understand. Sorry I'm a newbie :(

EDIT:

I solved this using preprocessors, I figured out that I can use preprocessors easily without changing template file. I wrote following preprocessor in my module to achieve what I was looking for.

function MYMODULE_preprocess_user_profile(&$vars){
//    dsm($vars); // prints nice debugging information
    $vars['user_profile']['charity_link'] = array(
    '#markup' => l('Add Charity!', 'my/custom/link' . arg(1)),
    '#weight' => 10
    );
}

I'm willing to change the user-profile-item.tpl.php template provided by the user module.

I've created a new template file. Now my question is:

  1. Where do I put the new template user-profile-item.tpl.php template file? I've created a custom module, should I place it right in the custom module's directory?
  2. Do I need anything to do so that Drupal picks up my template file instead of the default template file?

PS I got this link did not understand. Sorry I'm a newbie :(

EDIT:

I solved this using preprocessors, I figured out that I can use preprocessors easily without changing template file. I wrote following preprocessor in my module to achieve what I was looking for.

function MYMODULE_preprocess_user_profile(&$vars){
//    dsm($vars); // prints nice debugging information
    $vars['user_profile']['charity_link'] = array(
    '#markup' => l('Add Charity!', 'my/custom/link' . arg(1)),
    '#weight' => 10
    );
}

I'm willing to change the user-profile-item.tpl.php template provided by the user module.

I've created a new template file. Now my question is:

  1. Where do I put the new template user-profile-item.tpl.php template file? I've created a custom module, should I place it right in the custom module's directory?
  2. Do I need anything to do so that Drupal picks up my template file instead of the default template file?

PS I got this link did not understand. Sorry I'm a newbie :(

EDIT:

I solved this using preprocessors, I figured out that I can use preprocessors easily without changing template file. I wrote following preprocessor in my module to achieve what I was looking for.

function MYMODULE_preprocess_user_profile(&$vars){
//    dsm($vars); // prints nice debugging information
    $vars['user_profile']['charity_link'] = array(
    '#markup' => l('Add Charity!', 'my/custom/link' . arg(1)),
    '#weight' => 10
    );
}
how i solved it later
Source Link
Shafiul
  • 1.2k
  • 6
  • 30
  • 40

I'm willing to change the user-profile-item.tpl.php template provided by the user module.

I've created a new template file. Now my question is:

  1. Where do I put the new template user-profile-item.tpl.php template file? I've created a custom module, should I place it right in the custom module's directory?
  2. Do I need anything to do so that Drupal picks up my template file instead of the default template file?

PS I got this link did not understand. Sorry I'm a newbie :(

EDIT:

I solved this using preprocessors, I figured out that I can use preprocessors easily without changing template file. I wrote following preprocessor in my module to achieve what I was looking for.

function MYMODULE_preprocess_user_profile(&$vars){
//    dsm($vars); // prints nice debugging information
    $vars['user_profile']['charity_link'] = array(
    '#markup' => l('Add Charity!', 'my/custom/link' . arg(1)),
    '#weight' => 10
    );
}

I'm willing to change the user-profile-item.tpl.php template provided by the user module.

I've created a new template file. Now my question is:

  1. Where do I put the new template user-profile-item.tpl.php template file? I've created a custom module, should I place it right in the custom module's directory?
  2. Do I need anything to do so that Drupal picks up my template file instead of the default template file?

PS I got this link did not understand. Sorry I'm a newbie :(

I'm willing to change the user-profile-item.tpl.php template provided by the user module.

I've created a new template file. Now my question is:

  1. Where do I put the new template user-profile-item.tpl.php template file? I've created a custom module, should I place it right in the custom module's directory?
  2. Do I need anything to do so that Drupal picks up my template file instead of the default template file?

PS I got this link did not understand. Sorry I'm a newbie :(

EDIT:

I solved this using preprocessors, I figured out that I can use preprocessors easily without changing template file. I wrote following preprocessor in my module to achieve what I was looking for.

function MYMODULE_preprocess_user_profile(&$vars){
//    dsm($vars); // prints nice debugging information
    $vars['user_profile']['charity_link'] = array(
    '#markup' => l('Add Charity!', 'my/custom/link' . arg(1)),
    '#weight' => 10
    );
}
Source Link
Shafiul
  • 1.2k
  • 6
  • 30
  • 40

Override Another module's Template file using my Custom Module (Drupal 7)

I'm willing to change the user-profile-item.tpl.php template provided by the user module.

I've created a new template file. Now my question is:

  1. Where do I put the new template user-profile-item.tpl.php template file? I've created a custom module, should I place it right in the custom module's directory?
  2. Do I need anything to do so that Drupal picks up my template file instead of the default template file?

PS I got this link did not understand. Sorry I'm a newbie :(