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

Recent

Welcome to TinyPortal. Please login or sign up.

March 28, 2024, 08:30:51 AM

Login with username, password and session length
Members
Stats
  • Total Posts: 195,104
  • Total Topics: 21,212
  • Online today: 174
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 0
  • Guests: 167
  • Total: 167

Random User Block

Started by Xarcell, November 08, 2005, 09:25:52 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

houston

Oh Crap know what have I done.

Lookat what has happened.

Fatal error: Call to undefined function: ssi_whosrecent() in /home/eaglebay/public_html/forum/Sources/Load.php(1643) : eval()'d code(32) : eval()'d code on line 1

IchBin

You're going to have to call your host and have them reinstall the operating system... :P
What exactly did you do to get that error? What kind of block? What did you put in the block?

houston

#12
Quote from: IchBinâââ,¬Å¾Ã,¢ on November 13, 2005, 04:53:22 AM
You're going to have to call your host and have them reinstall the operating system... :P
What exactly did you do to get that error? What kind of block? What did you put in the block?

I inserted the code that I posted a couple of posts back into the SSI.php file where suggested by Sakuragi Then build a phpblock and inserted this code

ssi_whosRecent

It gave me a parse error in the block.

I went back to the phpblock and edited it and replaced

ssi_whosRecent with with ssi_whosRecent();

That when I got the fatal error.

I have a recent back up of my forum. Could I just reload the files from the back up? And if So which ones.

Everything else works except TP.


This is the error that I am getting in the smf error logs

http://www.eaglebaycamp.com/forum/index.php?action=tpadmin;blockeditl=39 
Block does not exist

Thanks

bloc

Be very accurate in the name of the function. It seems you have uppercase/lowercase mix in the function name, but when you call it you use all lowercase.

houston

Thanks to Xarcell, I was able to get into the DB and delete the wayward block.

Pierse

Works Great!ÂÃ,  Thanks for the idea!  Would even be cool to be part of the stats (Users Online)

elpvn

I like this solution from Senkusha in SMF community

Quote from: SenkushaHere is the code to add the avatars to the listing. Note this code is for all Online members:

Open BoardIndex.php and find:


// 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, mg.groupName
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 = mem.ID_GROUP OR (mem.ID_GROUP = 0 AND mg.ID_GROUP = mem.ID_POST_GROUP))", __FILE__, __LINE__);

$context['users_online'] = array();
$context['list_users_online'] = array();
$context['online_groups'] = array();
$context['num_guests'] = 0;
$context['num_users_hidden'] = 0;
while ($row = mysql_fetch_assoc($result))
{
if (!isset($row['realName']))
{
$context['num_guests']++;
continue;
}
elseif (empty($row['showOnline']))
{
$context['num_users_hidden']++;
continue;
}


Replace it with the following code:

// Load the users online right now.
$result = db_query("
SELECT
lo.ID_MEMBER, lo.logTime, mem.realName, mem.memberName, mem.showOnline, mem.avatar,
mg.onlineColor, mg.ID_GROUP, mg.groupName
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 = mem.ID_GROUP OR (mem.ID_GROUP = 0 AND mg.ID_GROUP = mem.ID_POST_GROUP))", __FILE__, __LINE__);


$context['users_online'] = array();
$context['list_users_online'] = array();
$context['online_groups'] = array();
$context['num_guests'] = 0;
$context['num_users_hidden'] = 0;
while ($row = mysql_fetch_assoc($result))
{
if (!isset($row['realName']))
{
$context['num_guests']++;
continue;
}
elseif (empty($row['showOnline']))
{
$context['num_users_hidden']++;
continue;
}
// The user Avatar...
if ($row['avatar'] == '')
$link = '&nbsp;<br>';
elseif (strtoupper(substr($row['avatar'],0,7)) == 'HTTP://')
$link = '<img src="' . $row['avatar'] . '" height="40"><br>';
else
$link = '<img src="' . $modSettings['avatar_url'] . '/' . $row['avatar'] . '" height="40"><br>';

// Some basic color coding...
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>';



And delete the following (repeated lines at the bottom now):

// Some basic color coding...
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>';


Now if you want to limit this query to only five members, change this:

$result = db_query("
SELECT
lo.ID_MEMBER, lo.logTime, mem.realName, mem.memberName, mem.showOnline, mem.avatar,
mg.onlineColor, mg.ID_GROUP, mg.groupName
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 = mem.ID_GROUP OR (mem.ID_GROUP = 0 AND mg.ID_GROUP = mem.ID_POST_GROUP))", __FILE__, __LINE__);


to this:

   $result = db_query("
SELECT
lo.ID_MEMBER, lo.logTime, mem.realName, mem.memberName, mem.showOnline, mem.avatar,
mg.onlineColor, mg.ID_GROUP, mg.groupName
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 = mem.ID_GROUP OR (mem.ID_GROUP = 0 AND mg.ID_GROUP = mem.ID_POST_GROUP)) LIMIT 5", __FILE__, __LINE__);


That should do the trick for you.Ã,  Make sure you make a backup copy of the BoardIndex.php file!Ã,  I have tested this on my board, but since I only had myself active at the time, I can not gauntee that it works.

Let me know if you have any problems.

That's works very well !Ã,  :)

Xarcell

Anyway to do this by membergroup?

firefly

I tried, as per Houston's effort, to use Sakuragi's code and call it in a php block - taking care to follow Bloc's advice on case - yet had the same error, which reported the wrong case. It's easy to delete the error: reinstate the orginal code and delete the block in the db. But as to why it failed, I don't know. Perhaps a working example of the modded SSI would be useful.

Mitch

Ok I would like to go about doing this but I am pretty braindead when it comes to this kind of thing.

I need some one who will either do it for me or at least talk me through it.