Hello. How to customize the login/register block? I am using genesis theme, and I would put the block in the leaderboard. When I do it, i can't see the block. And how to get the items in inline mode. I want to get something like this:

Login | Register (for anonymous users)
Welcome xxxxx: Your account | Logout (for logged users).

I have looking for the code where the block is building but I have no found. Can you help me?

Regards.

Comments

michaelschutz’s picture

Hi,

I have the same issue, and have solved it with a short term solution by modifying the module. I know I'm not supposed to do this, but I'm not skilled enough with preprocess functions yet to know if I can override it that way in template.php.

So for now, I simply replaced the HTML markup in ajax_register.module, lines 91-96. I replaced the p and br tags and put everything in a list so that I can theme it in CSS.

Here's the whole function for ease of copy and paste. (again, I know I should be overriding this in template.php, and I plan to learn how to do it properly. Until then, I'll use this hack to get it to work for my purposes). The only changes I made were to replace the p and br tags with the ul and li tags.

This is lines 83-100 inclusive:


function ajax_get_login_block_content() {
  global $user;
  //Check if clean urls is enabled
  if (variable_get('clean_url', 0)) {
  $user_uri = l('My Account','user/'.$user->uid);
  $login_uri = l('Login', 'ajax_register/login',array('attributes'=>array('class'=>'thickbox',)));
  $register_uri = l('Register', 'ajax_register/register',array('attributes'=>array('class'=>'thickbox',)));
  $logout_uri = l('Logout','logout');
  if (user_is_anonymous()){
    $block_content = "<div id='ajax_register_block_anonymous'><ul><li>". $login_uri ."</li><li>". $register_uri ."</li></ul></div>";
    return $block_content;
  }
  else{
    $block_content = "<div id='ajax_register_block_authenticated'><ul><li>".t("Welcome ")."<span class='ajax_register_user_name'>". $user->name ."</span></li><li>". $user_uri ."</li><li>". $logout_uri ."</li></ul></div>";
    return $block_content;
	}
}
}

One other note on this - if your theme uses the Skinr module, you can set up a CSS class for a basic inline list and then configure this block to appear as an inline list by using a Skinr checkbox.

Hope that helps,
Michael.

compujohnny’s picture

Status: Active » Fixed

You can override the theming functions in your theme, the new version now supports that

schiavone’s picture

I'm only seeing four theme functions (function theme_user_login_link, theme_user_register_link, theme_user_logout_link, theme_my_account_link) that could be used in a theme override but none of them can effect the block content. Does anyone have an example of how either $block_content can be overridden or uri variables can be passed for use in a block template?

compujohnny’s picture

The block content consists of these links, so if you override these theme functions you are overriding the block content

crosputni’s picture

I had no problem getting this to work on the previous version using resolution #1, but now that I've installed the most recent version (1.5), changing the div to ul and whatnot aren't working. I'm kind of a newb with some of this - how would I override the theme functions to display inline?

Thank you in advance for any help.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.