By rzegwaard on
Hi all,
I need to make some modificatons to my user login block.
- Translation of the text
- Add some extra links (html)
- Layout
I can add things with the block-user.tpl.php
But how can i do the translations and lay-out?
I don't want to use the 'locale' module.
I wan't the back-end to stay in english because all examples on the web are in english and i'm already used to that.
Thanks in advance
Robert
Comments
Here is a solution
I have used the hook_form_alter to change the link of Create a new account text.
In a custom module add:
Don't forget to clear the cache to see your modification.
If you have other part of the form that you would like to change, copy the original code from http://api.drupal.org/api/function/user_login_block/6. In my example, I only have copied what I need.
Hope this will help you.
- Damien
- Damien
:: Keep Open Spirit ::
Hello Damien, I am trying to
Hello Damien,
I am trying to use your proposed approach. I am using the zen_classic theme. So I placed your code AS IS in my template.php of the theme with naming:
function zen_classic_form_alter(&$form, $form_state, $form_id)
I have cleared the cache, but nothing happens.
Could you point what am I missing?
Thanks, Yoel
I'm still trying to wrap my
I'm still trying to wrap my head around this as well, but I'm pretty sure you have to create a module and place the code above inside a module, for example call the module myCustomLogin which goes under sites/all/modules/myCustomLogin/myCustomLogin.module. You'll have to create an myCusomLogin.info as well for drupal to recognise the module.
Once you have enabled the module in the admin section, the code posted above will definitely change your login form.
That is of course very nice (that one module would make changes to the login form no matter what template your user use) but if you want to have a customized login that you place with the theme itself (ie not in the modules direcory) - I have no idea how to do that - still trying to figure that one out! :(
Hi Richard, Thanks ... that's
Hi Richard,
Thanks ... that's was obvious, simply messed around!
For me, that is good enough. But if you want everything concentrated in your theme, have a look at this article:
http://thefaultandfracture.blogspot.com/2009/04/theming-drupal-user-logi...
Do you consider this more elegant than the module solution?
Modifying user login block from theme
Here's how I did this for Drupal 7 within template.php (as in the theme file).
http://api.drupal.org/api/drupal/modules--user--user.module/function/use...
p.s. in this same function, you can change the order of elements like this:
-------------------------
For Google: Changing "Create new account" and "Forgot your password" in the user login block, in Drupal 7, by editing template.php
For Drupal
For Drupal 7
change
$form['links']['#value'] = theme('item_list', $items);
to
$form['links'] = array('#markup' => theme('item_list', array('items' => $items)));
A bit late...
I have just posted a solution to this for another group of people (in-house developers) and thought I'd share since it seems to be a fairly simple thing.
I don't know what you want to do with changing the layout, but this should help with the translations.
http://elementalmarkup.com/ramblings/theming-user-login-block
Hope it helps
And even more easily (for static text)
Add the following to your settings.php
And that'll work for any basic text that is passed through the t() function.
See http://drupal.org/node/131061 for more technical information.
subscribing. These are
subscribing. These are useful tips worth bookmarking. Thanks,
Izzy
Thanks, This a very cool
Thanks, This a very cool little feature that I have overlooked.