Hi there,

I want to theme the login block, so I searched the user.module for the function that generates it: user_login_block().

I pasted that function under my template.php, under my theme, and renamed it to mytheme_user_login_block(), but without doing any modification, it just returns an: "array" word instead the login form block.

Any idea of what can be the problem?

Thanks in advance, Simon.

Comments

vm’s picture

not how you theme a block according to this handbook page : http://drupal.org/node/104319

drof1337’s picture

Yeah basically - you're doing it a crazy way. :)

Providing you have a block.tpl.php file and you're using the phptemplate theme engine, the DIV ID for your User login block should be #block-user-0 and all iterations thereof:

#block-user-0
#block-user-0 .content
#block-user-0 .title
#block-user-0 .style_bottom (if you want to put a bottom part on your block, maybe you do, I dunno, I quite like it!)

Whack that in your stylesheet with the definitions you want under each and you're a go. If you're using a theme without a block.tpl.php, create one and put this in it:

<div id="block-<?php print $block->module .'-'. $block->delta; ?>" class="block block-<?php print $block->module ?>">  
    <h2 class="title"> <?php print $block->subject; ?> </h2>
    <div class="content">
      <?php print $block->content; ?>
    </div>
    <div class="style_bottom">
    </div>
</div>

Edit it as you see fit, but don't go mad. It provides a universal block template for all your blocks, you can add classes in there for different bits of the block (within reason).
Enjoy.

SimonVlc’s picture

Thank you boys,

but the problem is that I want to theme the form itself, not the block container. I need to add some classes to the form generation code, to enclose some form fields.

For what I know, this can´t be done theming the block, I´m right?

Kind regards, Simon.

vm’s picture

this may help: customizing the login form see: http://drupal.org/node/19855

SimonVlc’s picture

Thank you ;)!