SimplePortal

Customization => Blocks and Modifications => Block Requests => Topic started by: MUSTAFAINE on September 03, 2009, 03:57:17 AM

Title: Online Friends Block
Post by: MUSTAFAINE on September 03, 2009, 03:57:17 AM
(http://www.spinabifidaturkey.com/images/uservar.bmp)

(http://www.spinabifidaturkey.com/images/useryok.bmp)

Code: [Select]
global $scripturl, $db_prefix, $user_info, $txt, $modSettings;

// 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']);
$friend_bullet = '<img src ="buddy_useron.gif"> ';


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>' . $friend_bullet.$user['link'] . '</i>' : $friend_bullet.$user['link'], $user['is_last'] ? '' : '<br> ';

}
else
        echo '<img src ="buddy_useroff.gif"> Çevrim İçi Arkadaşınız Yok'

Please check this codes its working in tinyportal if can we set it for simpleportal this ll be good..
Title: Re: Online Friends Block
Post by: Sordell Media on November 04, 2009, 09:07:22 PM
Tried adding this code, and received error "Syntax error in block code. Please check the code."
Would really like to add something like this, I've had a quick read over the code and cant see anything obviously wrong with it, but then I'm at work so somewhat distracted.
Title: Re: Online Friends Block
Post by: ccbtimewiz on November 05, 2009, 12:44:22 AM
This was built for SMF 1.1. Would you like me to update it for SMF 2.0?
Title: Re: Online Friends Block
Post by: Sordell Media on November 05, 2009, 02:36:32 AM
Ah, seeing MUSTAFAINE's listed SMF version I thought it'd work with 2.0

If you could that would be awesome, as I actually registered here specifically to look for such a mod :D
SimplePortal 2.3.8 © 2008-2024, SimplePortal