0

Hi i have created a custom hook in my own themeplate

function mytheme_theme() {
  $items = array();

  $items['user_pass'] = array(
    'render element' => 'form',
    'path' => drupal_get_path('theme', 'mytheme') . '/templates',
    'template' => 'user-reset',
    'preprocess functions' => array(
      'mytheme_preprocess_user_pass'
    ),
  );
  return $items;
}

function mytheme_preprocess_user_pass(&$vars) {
  $vars['intro_text'] = t('This is my super awesome reg form');
}

This is the code in user-reset.tpl.php

<p><?php print render($intro_text); ?></p>
<div class="yourtheme-user-login-form-wrapper">
  <?php print drupal_render_children($form) ?>
</div>

after the user register. an activation link will send to the user email
example: http://www.mysite.com/user/reset/98/1366527945/qr6sEqrJwpWjQ11sxQPpitIHosg3_-Iv1s08yrKlnYk

Problem is:

When user trying to click the link, the page give me an error "The page isn't redirecting properly"

is there anything i missed on my own theme?

cherrs

  • What exactly are you trying to achieve with your custom code? – rooby Apr 21 '13 at 7:59
  • what is in user-reset.tpl.php and why is that the template name for the user_pass theme item? Is your intro text actually displaying on the form and is the user_pass form displaying as it should? – rooby Apr 21 '13 at 8:06
  • <code> Hi this the code inside user-reset.tpl.php <p><?php print render($intro_text); ?></p> <div class="yourtheme-user-login-form-wrapper"> <?php print drupal_render_children($form) ?> </div> </code> i just want to customize the message on the reset password page.. thanks – Monski Apr 21 '13 at 8:21
  • You can't put code in comments. Also, check the edit I made to your question, it has the correct syntax for code. – rooby Apr 21 '13 at 8:23
1

Not sure exactly what is wrong with your code (I will check it out in a min), but if the purpose is just to add some text to the password reset form, I would do it in one of these ways:

  1. Add a custom block with the text you want to add and assign it to the user register page.
  2. Add a custom module and use hook_form_alter to add custom markup. Like so:
/**
 * Implements hook_form_FORM_ID_alter().
 */
function MYMODULE_form_user_pass_alter(&$form, &$form_state) {
  $form['intro_text'] = array(
    '#markup' => '<p class="intro-text">' . t('This is my super awesome reg form') . '</p>',
    '#weight' => -10,
  );
}
|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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