Simple Machines Community Forum

Customizing SMF => Tips and Tricks => Topic started by: Elijah Bliss on October 17, 2004, 12:54:43 AM

Title: Show username in browser status bar instead of user id number?
Post by: Elijah Bliss on October 17, 2004, 12:54:43 AM
In YaBB, when you moused over a unser screen name any where in the forum,
in the status bar you were able to see their username. This came in handy for me
as an admin to track who was who since my users change their screenname everyday.

(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.blaqowned.com%2Fhtml%2F2004%2Fbb%2FJD%2Fuploads%2FBlaqBoard%2Ffiles%2FJD%2Fid.jpg&hash=bdba9da56ca33c7982fc33e9d6995c376e361f19)

instead of showing u=2506 show u=Elijah Bliss or username=Elijah Bliss
Title: Re: Show username in browser status bar instead of user id number?
Post by: Metho on October 17, 2004, 02:51:21 AM
How about this instead? Shows their member name on hover.
In BoardIndex.php
FIND:
if (!empty($row['onlineColor']))
$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '" style="color: ' . $row['onlineColor'] . ';">' . $row['realName'] . '</a>';
else
$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['realName'] . '</a>';

REPLACE WITH: if (!empty($row['onlineColor']))
$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '" title="' . $row['memberName'] . '" style="color: ' . $row['onlineColor'] . ';">' . $row['realName'] . '</a>';
else
$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '" title="' . $row['memberName'] . '">' . $row['realName'] . '</a>';
Easier than messing with linky stuff and more visually useful in my opinion.

- Methonis
Title: Re: Show username in browser status bar instead of user id number?
Post by: Elijah Bliss on October 17, 2004, 03:09:45 AM
Quote from: Metho on October 17, 2004, 02:51:21 AM
How about this instead? Shows their member name on hover.
In BoardIndex.php
FIND:
if (!empty($row['onlineColor']))
$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '" style="color: ' . $row['onlineColor'] . ';">' . $row['realName'] . '</a>';
else
$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['realName'] . '</a>';

REPLACE WITH: if (!empty($row['onlineColor']))
$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '" title="' . $row['memberName'] . '" style="color: ' . $row['onlineColor'] . ';">' . $row['realName'] . '</a>';
else
$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '" title="' . $row['memberName'] . '">' . $row['realName'] . '</a>';
Easier than messing with linky stuff and more visually useful in my opinion.

- Methonis

Thanks, this will suffice.
Title: Re: Show username in browser status bar instead of user id number?
Post by: d3v on June 10, 2005, 11:28:03 PM
what about 1.0.4? I looked into BoardIndex.template and it no longer has the code that you pasted. Just wondering.
Title: Re: Show username in browser status bar instead of user id number?
Post by: Elijah Bliss on June 11, 2005, 09:32:47 PM
Quote from: d3v on June 10, 2005, 11:28:03 PM
what about 1.0.4? I looked into BoardIndex.template and it no longer has the code that you pasted. Just wondering.

Sources/BoardIndex.php
Title: Re: Show username in browser status bar instead of user id number?
Post by: d3v on June 11, 2005, 09:43:29 PM
Cough...yeah... thanks it worked
Title: Re: Show username in browser status bar instead of user id number?
Post by: † ÐëepÇuT¹ † on June 21, 2005, 03:40:46 PM
Horay!
Title: Re: Show username in browser status bar instead of user id number?
Post by: markd on July 12, 2005, 12:38:58 PM
To make the registered username appear in the hover globally (meaning in Posts & PMs)..

In Sources/Load.Php:

look for..

// What a monstrous array...
        $memberContext[$user] = array(
                'username' => &$profile['memberName'],
                'name' => &$profile['realName'],
                'id' => &$profile['ID_MEMBER'],
                'is_guest' => $profile['ID_MEMBER'] == 0,
                'is_buddy' => $profile['buddy'],
                'is_reverse_buddy' => in_array($ID_MEMBER, $buddy_list),
                'buddies' => $buddy_list,
                'title' => !empty($modSettings['titlesEnable']) ? $profile['usertitle'] : '',
                'href' => $scripturl . '?action=profile;u=' . $profile['ID_MEMBER'],
                'link' => '<a href="' . $scripturl . '?action=profile;u=' . $profile['ID_MEMBER'] . '" title="' . $txt[92] . ' ' .  $profile['realName'] . '">' . $profile['realName'] . '</a>',


and replace the 'link' line with:


                 'link' => '<a href="' . $scripturl . '?action=profile;u=' . $profile['ID_MEMBER'] . '" title="' . $txt[92] . ' ' .  $profile['memberName'] . '">' . $profile['realName'] . '</a>',


basically you're changing the first occurence of $profile['realName'] in the line to $profile['memberName'].

Works for almost all versions of SMF including the newly released Beta 3 Public.

enjoy.
-markd

edit:  the horizontal scroll bar didn't appear for me (using Firefox) in the replacement code section when I viewed my post, but be sure to copy and paste that ENTIRE line, not just what you see in the box.. it scrolls completely to the right!!
Title: Re: Show username in browser status bar instead of user id number?
Post by: rojamaia on August 27, 2005, 06:47:50 AM

thanks for this mod!  it worked for me.  it's really good and it enables us to monitor our members who keep on changing their display names  :D


actually, i tried this code change in almost every link on my source files.  it worked everywhere, except in the MessageIndex.php on the part where you view who_is_viewing the page or the topic.

if (!empty($row['showOnline']) || allowedTo('moderate_forum'))
$context['view_members_list'][] = empty($row['showOnline']) ? '<i><a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '" title="' . $txt[92] . ' ' .  $row['memberName'] . '">' . $row['realName'] . '</a></i>' : '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '" title="' . $txt[92] . ' ' .  $row['memberName'] . '">' . $row['realName'] . '</a>';
$context['view_members'][] = array(
'id' => $row['ID_MEMBER'],
'username' => $row['memberName'],
'name' => $row['realName'],
'href' => $scripturl . '?action=profile;u=' . $row['ID_MEMBER'],
'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '" title="' . $txt[92] . ' ' .  $row['memberName'] . '">' . $row['realName'] . '</a>',
'hidden' => empty($row['showOnline']),



In the board view, it only says
QuoteView the profile of
and no name.  In the topic view, there's no hoverlink at all.



Title: Re: Show username in browser status bar instead of user id number?
Post by: hcfwesker on August 05, 2010, 10:44:59 PM
I know this is like 5 years old.   But can anyone update these for smf 1.1.11

Quote from: Metho on October 17, 2004, 02:51:21 AM
How about this instead? Shows their member name on hover.
In  Sources/BoardIndex.php
FIND:
if (!empty($row['onlineColor']))
$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '" style="color: ' . $row['onlineColor'] . ';">' . $row['realName'] . '</a>';
else
$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['realName'] . '</a>';

REPLACE WITH: if (!empty($row['onlineColor']))
$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '" title="' . $row['memberName'] . '" style="color: ' . $row['onlineColor'] . ';">' . $row['realName'] . '</a>';
else
$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '" title="' . $row['memberName'] . '">' . $row['realName'] . '</a>';
Easier than messing with linky stuff and more visually useful in my opinion.

- Methonis

Doesn't work at all for 1.1.11 , still showing the member ID number in the URL bar.


Quote from: markd on July 12, 2005, 12:38:58 PM
To make the registered username appear in the hover globally (meaning in Posts & PMs)..

In Sources/Load.Php:

look for..

// What a monstrous array...
        $memberContext[$user] = array(
                'username' => &$profile['memberName'],
                'name' => &$profile['realName'],
                'id' => &$profile['ID_MEMBER'],
                'is_guest' => $profile['ID_MEMBER'] == 0,
                'is_buddy' => $profile['buddy'],
                'is_reverse_buddy' => in_array($ID_MEMBER, $buddy_list),
                'buddies' => $buddy_list,
                'title' => !empty($modSettings['titlesEnable']) ? $profile['usertitle'] : '',
                'href' => $scripturl . '?action=profile;u=' . $profile['ID_MEMBER'],
                'link' => '<a href="' . $scripturl . '?action=profile;u=' . $profile['ID_MEMBER'] . '" title="' . $txt[92] . ' ' .  $profile['realName'] . '">' . $profile['realName'] . '</a>',


and replace the 'link' line with:


                 'link' => '<a href="' . $scripturl . '?action=profile;u=' . $profile['ID_MEMBER'] . '" title="' . $txt[92] . ' ' .  $profile['memberName'] . '">' . $profile['realName'] . '</a>',


basically you're changing the first occurence of $profile['realName'] in the line to $profile['memberName'].

^^ this one did work, but colored names (including staff) all went to the regular default member link color.

These are 2 necessities for our forum and was thrilled to find them.  they just need an updated touch, please. :)

Title: Re: Show username in browser status bar instead of user id number?
Post by: Masterd on August 09, 2010, 08:34:24 AM
What about this (http://custom.simplemachines.org/mods/index.php?mod=636)?
Title: Re: Show username in browser status bar instead of user id number?
Post by: hcfwesker on August 10, 2010, 10:00:46 PM
Amazing.  thanx, bro :)