Simple Machines Community Forum

Customizing SMF => Tips and Tricks => Thema gestartet von: Elijah Bliss in Oktober 17, 2004, 12:54:43 VORMITTAG

Titel: Show username in browser status bar instead of user id number?
Beitrag von: Elijah Bliss in Oktober 17, 2004, 12:54:43 VORMITTAG
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
Titel: Re: Show username in browser status bar instead of user id number?
Beitrag von: Metho in Oktober 17, 2004, 02:51:21 VORMITTAG
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
Titel: Re: Show username in browser status bar instead of user id number?
Beitrag von: Elijah Bliss in Oktober 17, 2004, 03:09:45 VORMITTAG
Zitat von: Metho in Oktober 17, 2004, 02:51:21 VORMITTAG
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.
Titel: Re: Show username in browser status bar instead of user id number?
Beitrag von: d3v in Juni 10, 2005, 11:28:03 NACHMITTAGS
what about 1.0.4? I looked into BoardIndex.template and it no longer has the code that you pasted. Just wondering.
Titel: Re: Show username in browser status bar instead of user id number?
Beitrag von: Elijah Bliss in Juni 11, 2005, 09:32:47 NACHMITTAGS
Zitat von: d3v in Juni 10, 2005, 11:28:03 NACHMITTAGS
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
Titel: Re: Show username in browser status bar instead of user id number?
Beitrag von: d3v in Juni 11, 2005, 09:43:29 NACHMITTAGS
Cough...yeah... thanks it worked
Titel: Re: Show username in browser status bar instead of user id number?
Beitrag von: † ÐëepÇuT¹ † in Juni 21, 2005, 03:40:46 NACHMITTAGS
Horay!
Titel: Re: Show username in browser status bar instead of user id number?
Beitrag von: markd in Juli 12, 2005, 12:38:58 NACHMITTAGS
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!!
Titel: Re: Show username in browser status bar instead of user id number?
Beitrag von: rojamaia in August 27, 2005, 06:47:50 VORMITTAG

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
ZitatView the profile of
and no name.  In the topic view, there's no hoverlink at all.



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

Zitat von: Metho in Oktober 17, 2004, 02:51:21 VORMITTAG
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.


Zitat von: markd in Juli 12, 2005, 12:38:58 NACHMITTAGS
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. :)

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