Search code examples
phpdrupalauthenticationdrupal-7

How to create an url that redirects another login template Drupal 7?


I need help with this, I want to have an url like this: "mysite.com/catalog/login" that should shows a different login template not like the common D7 login page: mysite.com/login ...

I been spending time creating blocks that not render the php function: drupal_render() and using some preprocess functions in the template.php


Solution

  • You could use drupal_render(drupal_get_form('user_login_block')); on a seperate page from the standard /user page like your /catalog/login.

    You could also modify that form (e.g., change some fields, add attributes like additional classes for styling, etc) using the form alter hook like MYMODULE_form_user_login_alter(&$form, &$form_state, $form_id) { }.

    It depends a bit on whether you are just intending to render the login form in a different location or whether you want to change it significantly. It is also possible to login a user programmatically from a form you make yourself. Here is a stackoverflow response with more details on how to do that: https://drupal.stackexchange.com/questions/5825/how-do-i-programmatically-log-in-a-user