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
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

NancyDru - December 30, 2008 - 23:07
Assigned to:Anonymous» NancyDru
Status:active» postponed

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

NancyDru - January 1, 2009 - 20:56

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

cap60552 - January 23, 2009 - 02:28

THANK YOU! That's exactly the code I was looking for!

#4

NancyDru - February 19, 2009 - 17:19

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

-Anti- - April 12, 2009 - 19:43

Can I ask a further question about this....

The code from the docs is:

<?php
global $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

 
 

Drupal is a registered trademark of Dries Buytaert.