Allow admin config of "logged in block" layout

austintnacious - November 1, 2009 - 22:55
Project:LoginToboggan
Version:6.x-1.6
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed
Description

Hi!

I'm not a programmer so I'm not sure if what I'm asking is possible or not.

I use the "String Overrides" module to change the wording of some parts of my site.

I also use "Login Toboggan" . . . sweet module!!!

However, I'd like to change the way the logged in block is laid out!

I also use the Util module and it's block which gives either "You are not logged in" or "You are logged in as..."

So Login Toboggan's "[username] | Log Out" becomes redundant.
I'd like to be able to configure where or not Login Toboggan's logged in block displays the logged in user's name or not.

I tried with String override to just hide the username but I guess since the username is not passed through t() string override can't touch it

Does that make sense? Or should I be asking the String Override folks to make String Overrides use Tokens instead of t()?

/**
* Theme the loggedinblock that shows for logged-in users.
*/
function theme_lt_loggedinblock(){
  global $user;
  return check_plain($user->name) .' | ' . l(t('Log out'), 'logout');
}

For the moment I've changed the above section in logintoboggan.module to

/**
* Theme the loggedinblock that shows for logged-in users.
*/
function theme_lt_loggedinblock(){
  global $user;
  return l(t('Log out'), 'logout');
}

But I don't know if that's good form or causes any kind of security issue though it does seem to work OK for what I want to do. .

#1

hunmonk - November 2, 2009 - 11:38
Status:active» fixed

what you've done is close, but not quite right. in drupal, all theme_ functions are overridable by creating a properly named theme function in the theme(s) you're using.

so if your theme is named foo, then create a function in your theme called foo_lt_loggedinblock(), and put the same code in as your adjusted version of theme_lt_loggedinblock().

#2

austintnacious - November 3, 2009 - 07:26

Thanks!

That worked a treat! And helped me understand a little more about how the whole thing works. . .

#3

System Message - November 17, 2009 - 07:30
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.