How To Change User Profile In Drupal 7
I was recently tasked with theming a customized user login page in Drupal seven. I could not discover a whole lot of documentation for this so the get-go place I looked was in the core modules binder hoping to discover something similar user--login.tpl.php that I would be able to copy and put in my theme folder for an override. No such luck, I looked in /modules/user but zilch there I could utilise. Next I looked around drupal.org and found some vague references to doing this in scattered posts. This took me a several hours merely finally I pieced together code from a agglomeration of posts and came upward with a method that worked well for me.
The Code
You tin add this code to your theme's template.php file where "your_themename" is the machine proper name of your theme. Here we tell Drupal that nosotros want auser-login.tpl.php file in our theme binder.
You can now create a user-login.tpl.php and put it in your theme folder or the theme's template folder if there is one. Annotation that there are no "double dashes" in this file name every bit is typically traditional with Drupal 7 template file names.
A Few Ways to Theme it.
A trivial way to theme our custom user login is to simply render all the fields at once in your newly created user-login.tpl.php
file with this:
This is probably fine in some cases only I needed to have something more granular. For this, I impress out the individual variables at the top of myuser-login.tpl.php file to run into what's available for theming.
At present articulate your enshroud and reload /user/login and the variables should print out. You will meet a huge by and large undecipherable list of variables here. What we are looking for are the top level array items. These volition include:
Themable Output
I tin covert these into themable output every bit such:
Well, you tin can see where this is going, y'all can actually theme this page notwithstanding you want now that all the fields are separate. I too needed to add together an prototype to this page so I can practise that using the theme path for my epitome.
Again, be certain to changeyour_themename to the car proper name of your theme. I've attached the finished theme file below so to use if for Drupal seven, you lot simply need to add in your template.php code above and then theme it however you want. Notation, to achieve the screen capture above of my custom login page, I used a little module I created to remove the login tabs so I could have a more unproblematic and elegant look to the page. I was now able to print those links just in a higher place the login button.
Resource
- Customizing and Overriding User Login page, Register, and Password Reset in Drupal vi and seven
- Remove Login Tabs Module (Sandbox)
Tags
Source: https://www.dannyenglander.com/blog/customizing-user-login-page-drupal-7/
Posted by: sanchezalmle1941.blogspot.com
0 Response to "How To Change User Profile In Drupal 7"
Post a Comment