1

This is the code for my templates.php.

<?php
    function operationscheck_theme_theme() {
    $items = array();
    $items['user_login'] = array(
   'render element' => 'form',
   'path' => drupal_get_path('theme', 'operationscheck_theme') . '/templates',
   'template' => 'user-login',
    'preprocess functions' => array(
   'operationscheck_theme_preprocess_user_login'
   ),
);
    $items['user_pass'] = array(
   'render element' => 'form',
   'path' => drupal_get_path('theme', 'operationscheck_theme') . '/templates',
   'template' => 'user-pass',
   'preprocess functions' => array(
   'operationscheck_theme_preprocess_user_pass'
  ),
);
 $items['user_register_form'] = array(
'render element' => 'form',
'path' => drupal_get_path('theme', 'operationscheck_theme') . '/templates',
'template' => 'user-register-form',
'preprocess functions' => array(
'operationscheck_theme_preprocess_user_register_form'
 ),
);
return $items;
}
?>

<?php
   function operationscheck_theme_preprocess_user_login(&$vars) {
      $vars['intro_text'] = t('This is my awesome login form');
    }

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

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

 function operationscheck_theme_theme(&$existing, $type, $theme, $path) {
  $hooks = operationscheck_theme_theme($existing, $type, $theme, $path)
  $hooks['user_login_block'] = array(
 'template' => 'user-login',
 'arguments' => array('form' => NULL)
 );

// @TODO: Needs detailed comments. Patches welcome!
return $hooks;
}

function operationscheck_theme_preprocess_user_login_block(&$variables) {
  $variables['intro_text'] = t('This is my awesome login formX');
  $variables['rendered'] = drupal_render($variables['form']);
}
 ?>

This is the code for user-login.tpl.php.

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

But when I am flushing the cache, it is still returning the format of old page.tpl.php rather than the simple user login form page. Every file is in its correct place.

Do I have to write an if condition to redirect to this user-login.tpl.php?

  • I did this ALSO drupal.stackexchange.com/questions/36054/… – Nuk Jan 20 '14 at 16:32
  • Why not using hook_form_alter? There is also an example code by the link. – t1gor Jan 20 '14 at 16:35
  • Hi t1gor, Form is there by default just i am not able to redirect to it – Nuk Jan 20 '14 at 16:41
  • I am not sure I am following - do you need to redirect the form submitted data to another handler? In this case using hook_form_alter will allow you to modify the submit function to handle the form. – t1gor Jan 20 '14 at 16:43
  • Well its not that . I am creating a custom theme in which i have a page.tpl.php . SO when i logout from there i need to be redirected to a login page . Thats whats not working friend . hope you understood me now . waiting for response – Nuk Jan 20 '14 at 16:48

Your Answer

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

Browse other questions tagged or ask your own question.