Real name in main menu
mansspams - December 20, 2008 - 01:16
| Project: | RealName |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | NancyDru |
| Status: | postponed |
Jump to:
Description
Hi,
Thanks for this module. It works everywhere fine in D6.8. Only place its not working is in Main menu header and it looks like its not supposed (previous versions also didnt replace that header). Is this planned or there are some design issues with menu header? Or maybe its just me?

#1
This is a problem with core not using theme('username',...) in the user module. See my addition to #73813: Main Navigation Box should allow for greater flexibility in customization (user.module).
Since I cannot encourage core hacks, I can't tell you to make this change. But I can say that I first tested in on a 6.x system.
#2
Aha, you are allowed to change your theme code! So I changed this line in block.tpl.php from
<h2><?php print $block->subject ?></h2>to
<h2><?php global $user; print $block->module == 'user' ? theme('username', $user) : $block->subject ?></h2>#3
THANK YOU! That's exactly the code I was looking for!
#4
Someone posted slightly better code on the handbook page, so you might want to look at that. I still need to see if there is a way to intercept that code.
#5
Can I ask a further question about this....
The code from the docs is:
<?phpglobal $user;
print ($block->module == 'user' && $block->subject == $user->name) ? theme('username', $user) : $block->subject
?>
I've no idea what that means... I don't know php. Anyway...
My theme block.tpl.php currently contains:
<h2 class="title"><?php print $block->subject ?></h2>How can I give the new realnames script the class of 'title'?
Thanks.
EDIT:
I wasn't getting the desired result simply inserting the new script was because the heading became a
link and wasn't being styled. Doh! I had to add a h2.title a entry to style.css