How can I tell Omega I want to override user login/register pages, use a custom tpl and feed variables to it? This is what I tried:


function mycustomtheme_theme(&$existing, $type, $theme, $path) {
  $hooks = omega_theme($existing, $type, $theme, $path);

  $hooks['user_login'] = array(
    'template' => 'user-login',
    'arguments' => array('form' => NULL),
  );
  
  $hooks['user_register'] = array(
    'template' => 'user-register',
    'arguments' => array('form' => NULL),
  );  

  return $hooks;
}

function mycustomtheme_preprocess_user_login(&$vars) {
  unset($vars['form']['pass']['#description']);
  $vars['form']['submit']['#prefix'] = '<div id="edit-submit-wrapper">';
  $vars['form']['submit']['#suffix'] = '</div>';
  $vars['rendered'] = drupal_render($vars['form']);
}

Two things: in the TPL, Drupal won't print that rendered var. It does make it into the array. Commenting out those changes brings the form back. Two, should I move this into preprocess-user-login.inc? I could not get that to pick up either.

How can I override this page and feed/change page variables?

Comments

kevinquillen’s picture

Scratch that, I had a typo in my var in the TPL. I still can't make it run from a .inc file in the preprocess folder, I would like to so I can keep template.php clean. What did I miss?

ebeyrent’s picture

Rosamunda’s picture

Thankd for the link, but how do you do that in D6?
I´ve tried what ebeyrent did, but the form is unaffected.
This is my tpl template:

<div id="registration_form">
  <div class="field">
    <?php
      print drupal_render($form['account']['name']); // prints the username field
    ?>
  </div>
  <div class="field">
    <?php
      print drupal_render($form['account']['pass']); // print the password field
    ?>
  </div>
  <div class="field">
    <?php
        print drupal_render($form['submit']); // print the submit button
      ?>
    </div>
  </div>
</div>

Any thoughts? What is wrong with this?
Thanks for your help!
Rosamunda

marcoka’s picture

with overriding i think you want to output different markup.
take a look at:
http://drupal.org/node/173880