SMF 2.x: Who's Online - mouse-over tip display useragent

Started by Vagrancy, August 16, 2016, 06:14:27 AM

Previous topic - Next topic

Vagrancy

Hello!

I am using a somewhat modified version of this mod: http://www.simplemachines.org/community/index.php?topic=232270.0

In Who.template.php, I have this code (extra linebreak inserted in this post):

'<span class="smalltext">(<a href="' . $scripturl . '?action=', ($member['is_guest'] ? 'trackip' : 'profile;area=tracking;sa=ip;u=' . $member['id']), ';searchip=' . $member['ip'] . '">' . $member['ip'] . '</a>', ($show != 'spiders') ? ',
' . get_browser_name($member['query']['USER_AGENT']) : '', ')</span>';
echo '


Which works wonderfully, for attempts at detecting the user's browser. It looks like this:



I want to add a mouse-over tooltip type of box to the browser-displaying text, that itself displays the entire user agent string. A much older version of that same modification (for SMF 1.x) looks something like this (linebreak again by me):

<span class="smalltext">(<b><a href="' . $scripturl . '?action=trackip;searchip=' . $member['ip'] . '" target="_blank" title="' . $member['ip'] . '" class="smalltext2">' . $member['ip'] . '</a></b>,
<acronym title="' . $member['query']['USER_AGENT'] . '">' . $member['agent'] . '</acronym>)</span>';


I am not much of a PHP coder yet, but I tried importing the syntax from the older modification into the new one, but unsurprisingly, I made some error that rendered the file unloadable.

Specifically, I tried to replace:


' . get_browser_name($member['query']['USER_AGENT']) : '', ')</span>';


with:


<acronym title="' . $member['query']['USER_AGENT'] . '">' . get_browser_name($member['query']['USER_AGENT']). '</acronym> : '', ')</span>';



Any assistance in how to correctly display the useragent as a mouse-over tooltip over the browser name?

Vagrancy

Turns out I was cosmically close. This code works:


? ', <acronym title="' . $member['query']['USER_AGENT'] . '">' . get_browser_name($member['query']['USER_AGENT']) . '</acronym>' : '', ')</span>';

Advertisement: