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: 124
  • Total: 124

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

Quote from: warhonowicz on February 13, 2008, 08:04:40 PM
cheers, have added the post count to it, just in case anyone is interested



Could this block be made to scroll?

Regards,

Wilsy.
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>";


limogal

Quote from: JPDeni on October 06, 2006, 02:29:32 PM
With any luck, this should work. This is a slight alteration of the "Top Posters" block, but I changed the start and stop times.
global $db_prefix, $scripturl;

$starttime = time() - (24 * 60 * 60);
$endtime = time(); 
$number_to_list = 9; // (one less than you want to list)

$count= array();
$poster_number = array();
$query = db_query(
    "SELECT posterName, {$db_prefix}messages.ID_MEMBER, ID_GROUP
     FROM {$db_prefix}members
     JOIN {$db_prefix}messages
     ON {$db_prefix}members.ID_MEMBER = {$db_prefix}messages.ID_MEMBER
     WHERE posterTime > $starttime
     AND posterTime < $endtime", __FILE__, __LINE__);

while ($row = mysql_fetch_assoc($query))
{
  if (!isset($count[$row['posterName']]))
    $count[$row['posterName']] = 0;
  ++$count[$row['posterName']];
    $poster_number[$row['posterName']] = $row['ID_MEMBER'];
}

arsort($count);
$list_number = 0;
foreach ($count as $key => $value)
{
  echo '<a class="normaltext" href="' . $scripturl . '?action=profile;u=' . $poster_number[$key] . '">' . $key . '</a> | ' . $value . '<br />';
  ++$list_number;
  if ($list_number > $number_to_list) 
    break;
}


I think the problem last night was that I was putting in too many quotes. We'll see if this works.
hello Im tryin to learn all this stuff and Im totally confused what the right code to add to block would be by all the well I forgot this and if you do that lol can you please post the code exactly the way it should be so I can just add it till i learn all this scripting alittle bit better.
Thanks  a bunch and happy easter !

JPDeni

I'm not sure I understand what you're trying to say. I had to insert my own punctuation. :)

But, from the look of the code you posted, it is complete. Have you tried it?

wyvern

This is a nice block.  But it displays the usernames of members - not the chosen 'Display Name'.

I'm hopeful its an easy change... but I am not up to the task today...

JPDeni

Change


"SELECT posterName,


to


"SELECT realName,

wyvern

#35
Thank you.

edit:

For completeness, the entire code for the block using Display Names:

global $db_prefix, $scripturl;

$starttime = time() - (24 * 60 * 60);
$endtime = time(); 
$number_to_list = 9; // (one less than you want to list)

$count= array();
$poster_number = array();
$query = db_query(
    "SELECT realName, {$db_prefix}messages.ID_MEMBER, ID_GROUP
     FROM {$db_prefix}members
     JOIN {$db_prefix}messages
     ON {$db_prefix}members.ID_MEMBER = {$db_prefix}messages.ID_MEMBER
     WHERE posterTime > $starttime
     AND posterTime < $endtime", __FILE__, __LINE__);

while ($row = mysql_fetch_assoc($query))
{
  if (!isset($count[$row['realName']]))
    $count[$row['realName']] = 0;
  ++$count[$row['realName']];
    $poster_number[$row['realName']] = $row['ID_MEMBER'];
}

arsort($count);
$list_number = 0;
foreach ($count as $key => $value)
{
  echo '<span class="smalltext"><a href="' . $scripturl . '?action=profile;u=' . $poster_number[$key] . '">' . $key . '</a>    ' . $value . '</span><br />';
  ++$list_number;
  if ($list_number > $number_to_list) 
    break;
}

blouogies

Quote from: wyvern on March 26, 2008, 03:32:11 PM
Thank you.

edit:

For completeness, the entire code for the block using Display Names:

global $db_prefix, $scripturl;

$starttime = time() - (24 * 60 * 60);
$endtime = time(); 
$number_to_list = 9; // (one less than you want to list)

$count= array();
$poster_number = array();
$query = db_query(
    "SELECT realName, {$db_prefix}messages.ID_MEMBER, ID_GROUP
     FROM {$db_prefix}members
     JOIN {$db_prefix}messages
     ON {$db_prefix}members.ID_MEMBER = {$db_prefix}messages.ID_MEMBER
     WHERE posterTime > $starttime
     AND posterTime < $endtime", __FILE__, __LINE__);

while ($row = mysql_fetch_assoc($query))
{
  if (!isset($count[$row['realName']]))
    $count[$row['realName']] = 0;
  ++$count[$row['realName']];
    $poster_number[$row['realName']] = $row['ID_MEMBER'];
}

arsort($count);
$list_number = 0;
foreach ($count as $key => $value)
{
  echo '<span class="smalltext"><a href="' . $scripturl . '?action=profile;u=' . $poster_number[$key] . '">' . $key . '</a>    ' . $value . '</span><br />';
  ++$list_number;
  if ($list_number > $number_to_list) 
    break;
}

Thanks for displaying the total code!
This is a awesome block thanks guys!!!

This website is proudly hosted on Crocweb Cloud Website Hosting.