TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,966
  • Latest: safir45
Stats
  • Total Posts: 195,990
  • Total Topics: 21,323
  • Online today: 1,050
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 656
  • Total: 656

Buddy list php block

Started by cepsi, February 08, 2009, 08:45:59 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

cepsi

Hi,

ive got a php block which lists all my online buddies (i think i got it from here but had a look in the snippets and couldnt find it)
my question is, is there somewhere in that can be altered that instead of showing the buddies all grouped up (pic 1) can i show them in a line as the stats block does with the bullets (pic 2)

Pic 1


Pic 2




global $scripturl, $db_prefix, $user_info, $txt;

// Load the users online right now.
$result = db_query("
SELECT
lo.ID_MEMBER, lo.logTime, mem.realName, mem.memberName, mem.showOnline,
mg.onlineColor, mg.ID_GROUP
FROM {$db_prefix}log_online AS lo
LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = lo.ID_MEMBER)
LEFT JOIN {$db_prefix}membergroups AS mg ON (mg.ID_GROUP = IF(mem.ID_GROUP = 0, mem.ID_POST_GROUP, mem.ID_GROUP))", __FILE__, __LINE__);

$return['users'] = array();
$return['buddies'] = 0;
$show_buddies = !empty($user_info['buddies']);

while ($row = mysql_fetch_assoc($result))
{
        if (in_array($row['ID_MEMBER'], $user_info['buddies']) && (!empty($row['showOnline']) || allowedTo('moderate_forum')))
{

$return['buddies']++;
// Some basic color coding...
if (!empty($row['onlineColor']))
$link = '<b><a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '" style="color: ' . $row['onlineColor'] . ';">' . $row['realName'] . '</a></b>';
else
$link = '<b><a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['realName'] . '</a></b>';

$return['users'][$row['logTime'] . $row['memberName']] = array(
'id' => $row['ID_MEMBER'],
'username' => $row['memberName'],
'name' => $row['realName'],
'group' => $row['ID_GROUP'],
'href' => $scripturl . '?action=profile;u=' . $row['ID_MEMBER'],
'link' => $link,
'hidden' => empty($row['showOnline']),
'is_last' => false,
);
}
}
mysql_free_result($result);

if (!empty($return['users']))
{
krsort($return['users']);
$userlist = array_keys($return['users']);
$return['users'][$userlist[count($userlist) - 1]]['is_last'] = true;
        foreach ($return['users'] as $user)
        echo $user['hidden'] ? '<i>' . $user['link'] . '</i>' : $user['link'], $user['is_last'] ? '' : ', ';
}
else
        echo 'No Buddies Online';



(i will keep looking for teh snippet so i can credit the source and original post if its here)

EDIT: found it, its one of JPDeni's ORIGINAL POST

as usual thx for any help or guidance ;)

Link to my site: http://www.thepokerpod.com
SMF version: SMF ver. 1.1.7
TP version: TP ver.1.0.5
Theme name and version: Dark_4

JPDeni


if (!empty($return['users']))
{
krsort($return['users']);
        echo '<ul>';
        foreach ($return['users'] as $user) {
                echo '<li>';
        echo $user['hidden'] ? '<i>' . $user['link'] . '</i>' : $user['link'];
                echo '</li>';
        }
        echo '</ul>';
}
else
        echo 'No Buddies Online';

cepsi



This website is proudly hosted on Crocweb Cloud Website Hosting.