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

Recent

Welcome to TinyPortal. Please login or sign up.

Members
Stats
  • Total Posts: 196,004
  • Total Topics: 21,330
  • Online today: 141
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 60
  • Total: 60

Active Posters

Started by MeRcChRiS, October 06, 2006, 04:09:06 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

wilsy

Its a PHP block.

Regards,

Wilsy.

Alundra


JPDeni

I'm assuming you're using J. A. Cortina's code.

Change

SELECT  m.ID_MEMBER, COUNT(m.ID_MEMBER) as postCount
FROM ({$db_prefix}messages AS m, {$db_prefix}topics AS t, {$db_prefix}boards AS b)
WHERE m.posterTime > " . $starttime . "
AND t.ID_TOPIC = m.ID_TOPIC
AND b.ID_BOARD = t.ID_BOARD" . (!empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0 ? " AND b.ID_BOARD != $modSettings[recycle_board]" : '') . "
GROUP BY m.ID_MEMBER
ORDER BY postCount DESC LIMIT " . $list_count, __FILE__, __LINE__);


to


SELECT  m.ID_MEMBER, COUNT(m.ID_MEMBER) as postCount
FROM ({$db_prefix}messages AS m, {$db_prefix}topics AS t, {$db_prefix}boards AS b, {$db_prefix}members AS mem)
WHERE m.posterTime > " . $starttime . "
                                                   AND mem.ID_GROUP != 1
AND t.ID_TOPIC = m.ID_TOPIC
                                                   AND m.ID_MEMBER = mem.ID_MEMBER
AND b.ID_BOARD = t.ID_BOARD" . (!empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0 ? " AND b.ID_BOARD != $modSettings[recycle_board]" : '') . "
GROUP BY m.ID_MEMBER
ORDER BY postCount DESC LIMIT " . $list_count, __FILE__, __LINE__);


I think. :-) I haven't tested this, but it should work.

Alundra


Clipper107

I'm pasting the code in a PHP block but I get an error, could somebody give me the whole correct code to paste in a PHP block...... :-\

G6Cad

How about you read the topic from the start.
JP Denis clearly said her change was from JA Cortina code earlier in the topic.

JPDeni

Clipper, what code did you paste into a php block? What is the error?

warhonowicz

could this be changed to show all users logged on during the last 24 hrs (or ever) rather than users that posted together with the time they are logged on (like what the admin can see in the members list via the admin panel)?

JPDeni

This shows those logged in during the past 24 hours, in order by the most recent log in.


global $db_prefix, $scripturl;

$starttime = time() - (24 * 60 * 60);

$query = db_query(
    "SELECT memberName, lastLogin
     FROM {$db_prefix}members
     WHERE lastLogin > $starttime
     ORDER BY lastLogin DESC", __FILE__, __LINE__);

echo "<table>";
while ($row = mysql_fetch_assoc($query))
{
  echo "<tr><td>";
  echo $row['memberName'];
  echo "</td><td>";
  echo timeformat($row['lastLogin']);
  echo "</td></tr>";
}
echo "</table>";

warhonowicz

cheers, have added the post count to it, just in case anyone is interested


global $db_prefix, $scripturl;

$starttime = time() - (30 * 7 * 24 * 60 * 60);

$query = db_query(
    "SELECT memberName, lastLogin, posts
     FROM {$db_prefix}members
     WHERE lastLogin > $starttime
     ORDER BY lastLogin DESC", __FILE__, __LINE__);

echo "<table>";
while ($row = mysql_fetch_assoc($query))
{
  echo "<tr><td>";
  echo $row['memberName'];
  echo "</td><td>";
  echo " | last logged on: ";
  echo "</td><td>";
  echo timeformat($row['lastLogin']);
  echo "</td><td>"; 
  echo " | posts: ";
  echo "</td><td>";
   echo $row['posts'];
  echo "</td></tr>";
 
}
echo "</table>";

This website is proudly hosted on Crocweb Cloud Website Hosting.