grabbing users online for

Started by SA™, August 17, 2008, 04:20:27 AM

Previous topic - Next topic

SA™

a certain action

ie

im in arcade now i have a separate list for users in arcade and it will so there  possible?
http://samods.github.io/SAChatBar/

Xbox Live: smokerthecheese 360 or xbone
My Work
Piano Movers / Delivery service
QuoteMy allies are dead.
I'm 'bout to be too.
Zombies are chasing me.
F*** it, I'm screwed -___-

Nathaniel

When you view the list of users online, you can see which actions/topics/boards they are viewing, so it should be possible to make a list just for one action.

Have a look at the code from the 'Who.php' source file, this infomation is stored in the '{$db_prefix}log_online' table. I can help you do it, if you need some help. ;)
SMF Friend (Former Support Specialist) | SimplePortal Developer
My SMF Mods | SimplePortal

"Quis custodiet ipsos custodes?" - Who will Guard the Guards?

Please don't send me ANY support related PMs. I will just delete them.

SA™

thank you for the offer if you can help thatl be fab ive been sitting here for hours trying to figar it out

can you help please
http://samods.github.io/SAChatBar/

Xbox Live: smokerthecheese 360 or xbone
My Work
Piano Movers / Delivery service
QuoteMy allies are dead.
I'm 'bout to be too.
Zombies are chasing me.
F*** it, I'm screwed -___-

SA™

#3
ok i kinda got this working with a little help from jeza at smf arcade

the code im using

// heres the bullits duck lol
    $bullet2 = '<img src="'.$settings['images_url'].'/TPdivider2.gif" alt="" border="0" style="margin:0 2px 0 0;" />';
   //its ok now bullits have flown by stand up again lol
               require("SSI.php");
               $online = ssi_whosOnline('array');
      foreach($online['users'] as $user){
 

   $result = db_query("
      SELECT url
      FROM {$db_prefix}log_online
      WHERE ID_MEMBER = {$user['id']}",__FILE__, __LINE__);
     
      $checkit = mysql_fetch_assoc($result);
      $data = @unserialize($checkit['url']);
      if($data['action']=='arcade')
      echo $bullet2 , $user['hidden'] ? '<i>' . $user['link'] . '</i>' : $user['link'];  echo ' ';
      }

unset($data);


It kinda works, but seems to be one click away. Maybe the log url is updated AFTER you enter the arcade? could there be somthing missing?

you can see what im trying to do here
http://sleepy-arcade.ath.cx/dev/index.php?action=forum
look for users in arcade in info center
http://samods.github.io/SAChatBar/

Xbox Live: smokerthecheese 360 or xbone
My Work
Piano Movers / Delivery service
QuoteMy allies are dead.
I'm 'bout to be too.
Zombies are chasing me.
F*** it, I'm screwed -___-

[SiNaN]

I can't see a problem with codes. What is the problem with it?
Former SMF Core Developer | My Mods | SimplePortal

SA™

it seems to be a click away not a biggie realy but would like to know why
http://samods.github.io/SAChatBar/

Xbox Live: smokerthecheese 360 or xbone
My Work
Piano Movers / Delivery service
QuoteMy allies are dead.
I'm 'bout to be too.
Zombies are chasing me.
F*** it, I'm screwed -___-

Nathaniel

Well, below is the code that I tested:
require_once('SSI.php');

// Heres the bullits duck lol
$bullet2 = '<img src="'.$settings['images_url'].'/aim.gif" alt="" border="0" style="margin:0 2px 0 0;" />';
// Its ok now bullits have flown by stand up again lol
$online = ssi_whosOnline('array');
foreach($online['users'] as $user)
{
   
$result = db_query("
SELECT url
FROM {$db_prefix}log_online
WHERE ID_MEMBER = $user[id]",__FILE__, __LINE__);

$checkit = mysql_fetch_assoc($result);
$data = @unserialize($checkit['url']);
if($data['action']=='arcade')
echo $bullet2 , $user['hidden'] ? '<i>' . $user['link'] . '</i>' : $user['link'];  echo ' ';
unset($data);
}


It worked perfectly...
SMF Friend (Former Support Specialist) | SimplePortal Developer
My SMF Mods | SimplePortal

"Quis custodiet ipsos custodes?" - Who will Guard the Guards?

Please don't send me ANY support related PMs. I will just delete them.

[SiNaN]

writelog() function does not update the log_online table every second. It waits some time to pass cause of performace issues. So there is nothing wrong with your code.
Former SMF Core Developer | My Mods | SimplePortal

SA™

#8
ok thanks one more questin hope you can help

im trying to put an else statment there so when no onbe is in the arcade it will show now players insead of a blanck box not sure if else is the way to go i was just tryin to go from another mod and i was getting unexepted t else errors

:d

oh and one more lol

can you right that above code for smf 2 please i cant do that eather thank you
http://samods.github.io/SAChatBar/

Xbox Live: smokerthecheese 360 or xbone
My Work
Piano Movers / Delivery service
QuoteMy allies are dead.
I'm 'bout to be too.
Zombies are chasing me.
F*** it, I'm screwed -___-

Nathaniel

This code for SMF 1.1.5:
require_once('SSI.php');

//    Heres the bullits duck lol
$bullet2 = '<img src="'.$settings['images_url'].'/aim.gif" alt="" border="0" style="margin:0 2px 0 0;" />';
//   Its ok now bullits have flown by stand up again lol
$online = ssi_whosOnline('array');
$arcade_users = array();
foreach($online['users'] as $user)
{
   
   $result = db_query("
      SELECT url
      FROM {$db_prefix}log_online
      WHERE ID_MEMBER = $user[id]",__FILE__, __LINE__);

   $checkit = mysql_fetch_assoc($result);
   $data = @unserialize($checkit['url']);
   if($data['action']=='arcade')
   {
      echo $bullet2 , $user['hidden'] ? '<i>' . $user['link'] . '</i>' : $user['link'];  echo ' ';
      $arcade_users[] = $user;
   }
   unset($data);
}

//   No arcade users?
if(empty($arcade_users))
   echo 'Blah';


Change the database query to this code for SMF 2 Beta:
    $result = $smcFunc['db_query']('','
        SELECT url
        FROM {db_prefix}log_online
        WHERE id_member = {int:user_id}',
        array(
            'user_id' => $user['id'],
        )
    );
SMF Friend (Former Support Specialist) | SimplePortal Developer
My SMF Mods | SimplePortal

"Quis custodiet ipsos custodes?" - Who will Guard the Guards?

Please don't send me ANY support related PMs. I will just delete them.

SA™

works a treat thank you

can you help with this

im trying to put an else statment there so when no onbe is in the arcade it will show now players insead of a blanck box not sure if else is the way to go i was just tryin to go from another mod and i was getting unexepted t else errors
http://samods.github.io/SAChatBar/

Xbox Live: smokerthecheese 360 or xbone
My Work
Piano Movers / Delivery service
QuoteMy allies are dead.
I'm 'bout to be too.
Zombies are chasing me.
F*** it, I'm screwed -___-

Nathaniel

#11
Its already in the code that I posted. :P

See this:
//   No arcade users?
if(empty($arcade_users))
{
     // Insert 'else' code here. ;)
}


If you want help with the specific code inside the 'else' statement, then you will have to describe it a bit more. ;)
SMF Friend (Former Support Specialist) | SimplePortal Developer
My SMF Mods | SimplePortal

"Quis custodiet ipsos custodes?" - Who will Guard the Guards?

Please don't send me ANY support related PMs. I will just delete them.

SA™

thanks works great didnt see that last time:D
http://samods.github.io/SAChatBar/

Xbox Live: smokerthecheese 360 or xbone
My Work
Piano Movers / Delivery service
QuoteMy allies are dead.
I'm 'bout to be too.
Zombies are chasing me.
F*** it, I'm screwed -___-

SA™

i know you said this code was ok but its giving this error


Undefined index: action

Line: 171

line 171 =  if($data['action']=='arcade')

whole code

require_once('SSI.php');

//    Heres the bullits duck lol
$bullet2 = '<img src="'.$settings['images_url'].'/aim.gif" alt="" border="0" style="margin:0 2px 0 0;" />';
//   Its ok now bullits have flown by stand up again lol
$online = ssi_whosOnline('array');
$arcade_users = array();
foreach($online['users'] as $user)
{
   
   $result = db_query("
      SELECT url
      FROM {$db_prefix}log_online
      WHERE ID_MEMBER = $user[id]",__FILE__, __LINE__);

   $checkit = mysql_fetch_assoc($result);
   $data = @unserialize($checkit['url']);
   if($data['action']=='arcade')
   {
      echo $bullet2 , $user['hidden'] ? '<i>' . $user['link'] . '</i>' : $user['link'];  echo ' ';
      $arcade_users[] = $user;
   }
   unset($data);
}

http://samods.github.io/SAChatBar/

Xbox Live: smokerthecheese 360 or xbone
My Work
Piano Movers / Delivery service
QuoteMy allies are dead.
I'm 'bout to be too.
Zombies are chasing me.
F*** it, I'm screwed -___-

[SiNaN]

Find:

   if($data['action']=='arcade')

Replace:

   if(isset($data['action']) && $data['action'] == 'arcade')
Former SMF Core Developer | My Mods | SimplePortal

SA™

http://samods.github.io/SAChatBar/

Xbox Live: smokerthecheese 360 or xbone
My Work
Piano Movers / Delivery service
QuoteMy allies are dead.
I'm 'bout to be too.
Zombies are chasing me.
F*** it, I'm screwed -___-

SA™

need a little help again with this im setting it up so it shows what they are doing in the arcade ie if they are playing a game it will show the thumbnail of that game now if there veiwing the arcade index it still show  the image wich should be only there if they are playing a game how can i hide the image for veiwing arcade index?

you can problay see what i mean here
http://waynesworld.kicks-ass.net/forum2/index.php?action=arcade

right at the bottom


my code

function wdmboard_ArcadeStatsonline()
{
global $txt, $context,$settings;
require_once('SSI.php');

//    Heres the bullits duck lol
$bullet2 = '<img src="'.$settings['images_url'].'/aim.gif" alt="" border="0" style="margin:0 2px 0 0;" />';
//   Its ok now bullits have flown by stand up again lol
$online = ssi_whosOnline('array');
$arcade_users = array();
foreach($online['users'] as $user)
{
   
   $result = db_query("
      SELECT url
      FROM {$db_prefix}log_online
      WHERE ID_MEMBER = $user[id]",__FILE__, __LINE__);

   $checkit = mysql_fetch_assoc($result);
   $data = @unserialize($checkit['url']);
   if($data['action']=='arcade')
   {
      echo $bullet2 , $user['hidden'] ? '<i>' . $user['link'] . ' </i>' : $user['link'];   echo ' <a href="',$scripturl , '?action=arcade;sa=play;game=' . $context['arcade']['game']['id'],'"><img " border="0" src="',$context['arcade']['game']['thumbnail'],'" width="20" height="20"  alt=" Playing ',$context['arcade']['game']['name'],' on Arcade"/></a>';
    $arcade_users[] =  $user;
   }
   unset($data);
}

//   No arcade users?
if(empty($arcade_users))
   echo 'no players playing at the moment';
// end wdmboard_statsonline

}
http://samods.github.io/SAChatBar/

Xbox Live: smokerthecheese 360 or xbone
My Work
Piano Movers / Delivery service
QuoteMy allies are dead.
I'm 'bout to be too.
Zombies are chasing me.
F*** it, I'm screwed -___-

Advertisement: