Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By Swarnendu on
Hello Everybody,
I am new to Drupal.
I want to create a login page like This
http://www.freeimagehosting.net/x2ev1
How could i do that ?
http://localhost/mydrupal/user ------------> User login
http://localhost/mydrupal/admin ------------> Admin login
http://localhost/mydrupal/ -------------> Website Front Page
Drupal version 7.19
localhost wampserver.
Is this possible to create different login page for User and Administrator. ??
If Yes Then How Could I Do That ?
I have Read this article but it is not working.. http://drupal.org/node/350634
Comments
Here we go:
1 - Add this code to your theme "template.php" file. Change all "your_themename" strings (there is two don't forget any of them) with the name of your theme. With this code we tell Drupal that we want a "user-login.tpl.php" file in our /sites/all/themes/your_themename/templates folder.
2 - Create the "user-login.tpl.php" file and put it in your /sites/all/themes/your_themename/templates folder.
3 - Render the fields in the "user-login.tpl.php" file.
4 - You can wrap the content with div's containing classes and then use CSS to style them.
Great solution, but does not work in Marinelli theme
Hi Dropthatdrop,
I tried your code, but it did not work quite smoothly. I got the http 500 error. I checked the error log and realized that the code maybe conflict with the theme I am using---Marinelli.
In the Marinelli theme, there is a theme folder which contains a file named "theme.inc". In that file, there is a function called marinelli_theme(), so if I follow your step to change the "your_themename" string, it will end up that I will use a function that is pre-declared. Any suggestion to work around?
Thank you so much!
Thanks!
Just wanted to say thank you. I was struggling trying to figure out how to do this, and this answer was exactly what I needed.
Works fine
this example worked fine to customize user login page
This is the basic
Please note this is the Login Page only (as requested in your title).
If you want the "Register Page" and the "Recover Password Page", the process is the same. Just create a "user-register.tpl.php" and "user-pass.tpl.php" files in the "templates" directory and customise them. After setting up the login page you may want to explore it.
This is the basic. From here you can keep going customising and crafting as much as you like, adding images, divs, spans, text... you name it.
But this will get you started. It worked for me in D7.21 so far but I'm only working it this last 30 minutes...
You may want to look at this link for more core templates:
http://drupal.org/node/190815
You may want to look at this link for the register template and password recovery pages:
http://drupal.org/node/350634
Good luck!
Customise Drupal login PAGE
I see so much trouble for simple things. I just scrolled for a bunch of posts how to theme the "Login Page" but actually people are theming the login block, imitating each other posts all over their blogs and websites.
Do you want to achieve a minimal designed and beautiful page like this?
Login page:
http://s10.postimg.org/42qaumbbt/login.png
Password page:
http://s22.postimg.org/lv2psotsh/password.png
1 )
Create the login and password empty page files and place them in your theme "templates" folder.
The name of the files are
page--user--login.tpl.php
andpage--user--password.tpl.php
. There's no need of all those steps of "hook", "alter", blablabla... Drupal will use those files automatically without any call or whatever.2 )
Put this code inside your files.
page--user--login.tpl.php
page--user--password.tpl.php
3 )
Done!
In thee steps. Now style your
css
as much you need and pimp your new fancy login page. "Inspect" yourhtml
output of your new login page and see how clean it is now. ; DAfterwords )
I just spent this last hour reading posts and questions about this all over the internet, and the work around in some cases are simply crazy like using the
dpm(get_defined_vars());
function, copying html and paste all of those input forms and attributes, blablabla.I didn't found a concise post like this. It's crazy!!!
Also, you will need (if you still don't have it and if you want it) to disable "label/description" and enable "placehover" for the inputs. You can do it all together like this:
PS )
Do you have the "header", "footer" and "sidebar" visible and want to remove them too? No problem.
Go to
#overlay=admin/structure/block
and click "configure". Scroll down and include this on "Show block on specific pages" option:Done!
Drupal it's incredible powerful. I think people complicate things a lot and if you see it in a simple way it will be more efficient... Most of the things you can do it inside Drupal environment.
-
Your answer is by far the BEST I seen to custom login page.
Indeed true login page (not the block/node).
Thanks a lot.
However I improved your code to include javascript placeholder for older browsers not supporting HTML5 placehold attribute.
Don't know if it's needed since most nowadays support HTML5.
However it's here for backup reasons if you need it.
Also I removed the label and included a placeholder to the E-mail recovery page...
This is how mine looks:
Login page: http://img34.imageshack.us/img34/2019/71fg.png
Recover password page: http://img24.imageshack.us/img24/7176/cdw7.png
Now will custom the css... : )
+ 1 for Dropal
hey dropal - u rock ! thx bro - in 2 minutes, you answered 8 - 10 hours of labor (plus calls to the wilderness on stack and IRC - where my chi-town peeps at?)
thx !
Hey just want to make a small
Hey just want to make a small comment that I got the error in
page--user--login.tpl.php
andpage--user--password.tpl.php
Strict warning: Only variables should be passed by reference in include()
Drupal gets mad if you don't pass stuff as variables so to resolve it you can just do
Other than that, it worked like a charm. Many thanks :)
Isn't Better Login something for you?
Hi!
Have you checked out the project Better Login? https://drupal.org/project/betterlogin
Sincerely,
Robi
Multiple role based login pages
You can use the module mentioned below to create separate login pages for different kind of roles.
https://www.drupal.org/project/role_login_page
Customize login form
Hi,
hope you are doing well.
my question is that can I customize login form as admin level.
Actually I want to that when i submit the form after submit and after inspect in browser login details should not be shown in browser.
Thanks