collapse

* Simple Portal Archived Forum

This is an Archive Forum.

The content in this forum may be out-of-date or have been superseded by newer information, and links in forum pages to other sites may not work.
This forum contains archives for future reference.

Visit our thread at Simple Machines Forum for current support.

SMF 2.1 users: EhPortal is a ported version of Simple Portal specifically designed for the SMF 2.1 branch.
Please visit web-develop.ca to download EhPortal and for its support.

* User Info

 
 
Welcome, Guest. Please login or register.

* Who's Online

  • Dot Guests: 222
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.

* Shoutbox

Refresh History
  • Shoutbox is not for support!
  • {OCS}MasterSeal: Yup, Still adore SP
    April 21, 2019, 07:08:06 PM
  • {OCS}MasterSeal: STILL love SP :)
    November 24, 2018, 05:05:50 AM
  • ♦ Ninja ZX-10RR ♦: <3 aegersz
    September 13, 2018, 03:36:09 PM
  • aegersz: I STILL <3 LOVE SimplePortal
    September 13, 2018, 07:11:39 AM
  • aegersz: o LOVE you guys - Simple Portal rocks !
    May 09, 2018, 05:18:59 AM
  • Chen Zhen: our apologies for the site being down.. please read server issues topic
    March 22, 2018, 05:32:38 AM
  • {OCS}MasterSeal: LOL PLEASE forget I just posted that. I found the answer in my own dang post back in 2015. lol sorry!
    July 04, 2017, 10:47:55 PM
  • {OCS}MasterSeal: I know this SB isnt' for support, but I just have a general question. Who would I contact to find out where SP stores its block info? Is it DB driven or files? I searched the site but came up with nothing. probably my fault any insight is appreciated.
    July 04, 2017, 10:43:36 PM
  • ♦ Ninja ZX-10RR ♦: Excuse me but what does Simpleportal have to deal with that?
    February 05, 2017, 08:21:14 PM
  • WhiteEagle: of course IMHO that site appears to be dead :(
    February 04, 2017, 01:08:05 PM
  • WhiteEagle: If I can get that, then I'll use it for that site...
    February 04, 2017, 01:07:35 PM
  • WhiteEagle: decided to not use SMF for any projects, unless I can get a copy of the premium version of the fanfiction archive plugin
    February 04, 2017, 01:06:54 PM
  • expertdecisions: cloudflare
    January 28, 2017, 08:01:47 AM
  • aegersz: SM release 2.0.13 !
    January 12, 2017, 06:00:13 AM
  • raffo: Tks Emanuele, even if I didn't understand the fix :D
    November 07, 2016, 02:01:20 AM
  • emanuele: [link]
    November 01, 2016, 12:43:50 PM
  • emanuele: raffo: the English support board is a good place. ;)
    November 01, 2016, 12:43:38 PM
  • raffo: Where can I find the fix for the shoutbox?
    November 01, 2016, 05:06:09 AM
  • {OCS}MasterSeal: To the SP team, I make a point to come here and thank you as much as possible for your work.  so again, THANK YOU!
    October 28, 2016, 10:38:05 AM
  • emanuele: That's indeed funny, the limit is present only in the patch and not the full install.
    October 22, 2016, 06:14:58 PM

* Recent Posts

Adding Forums Button to Nav bar by jirapon
[August 01, 2019, 09:07:12 AM]


Re: Board Icons by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 04:03:41 PM]


MOVED: Czech translation???? by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 03:04:51 PM]


Board Icons by jirapon
[July 30, 2019, 07:28:44 AM]


Re: Thankyou Simpleportal, by ♦ Ninja ZX-10RR ♦
[July 29, 2019, 09:41:29 AM]

Thanks for having an interest with our portal. If you have any requests for features, have a look at the Feature Requests board.

Author Topic: Display if somebody is chatting in Who's Online block  (Read 10801 times)

0 Members and 2 Guests are viewing this topic.

Offline Zirc

  • Jr. Member
  • **
  • Posts: 53
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Display if somebody is chatting in Who's Online block
« on: January 06, 2010, 06:07:57 PM »
Okay i'm gonna post this here first and see if anybody has any ideas before looking elsewhere.
I have AjaxChat Integration 3.2.1, SMF 1.1.11 and SimplePortal 2.3.1 and am looking for some sort of custom code I guess.

What I would like to do is display in the Who's Online block of SimplePortal (chatting) next to a users name if they are in AjaxChat.  I think this should be fairly simple but since my php knowledge is limited I can't figure out the code.  I imagine all it needs to do is get the UserID for the person online and then query the ajaxchat_online table to see if they are the same then output the text (chatting) and if the UserID is not in ajaxchat_online it would not display anything.  Seems pretty straightforward but i'm not sure how to go about it.

My forums are at http://www.tholeweb.com/forums if you need to take a look.

Any help would be great! Thanks

Offline Stigmartyr

  • Jr. Member
  • **
  • Posts: 72
  • Gender: Male
  • SMF Version: 2 RC2
  • SP Version: 2.3.1
Re: Display if somebody is chatting in Who's Online block
« Reply #1 on: January 21, 2010, 06:24:46 PM »
 :thumbsup: Yes please!  I second his motion.  I left behind flash chat in favor of Ajax Chat and I would really like this feature as well.

Offline [SiNaN]

  • Mr. SimplePortal
  • Developer
  • *
  • Posts: 6782
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: Display if somebody is chatting in Who's Online block
« Reply #2 on: January 22, 2010, 09:36:16 AM »
Code: (Find) [Select]
$stats = ssi_whosOnline('array');
Code: (Replace) [Select]
$stats = ssi_whosOnline('array');
$chat_users = chatOnlineUsers();

Code: (Find) [Select]
$user['link'], '</li>';
Code: (Replace) [Select]
$user['link'], in_array($user['id'], $chat_users) ? ' [In Chat]' : '', '</li>';
You can change [In Chat] text as you like.
And slowly, you come to realize... It's all as it should be...

Offline Zirc

  • Jr. Member
  • **
  • Posts: 53
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Display if somebody is chatting in Who's Online block
« Reply #3 on: January 22, 2010, 03:39:54 PM »
Thanks Sinan that works perfectly!!!

Offline cme1st2302

  • Full Member
  • ***
  • Posts: 117
  • Gender: Male
    • East Coast Astro
  • SMF Version: 1.1.11
  • SP Version: 2.3.2
Re: Display if somebody is chatting in Who's Online block
« Reply #4 on: January 22, 2010, 09:22:30 PM »
Thanks I have been looking for this as well but I was wondering how I would get it to work with FlashChat. 

One question though, if you make these changes wouldn't they be lost the next time there is an update to SP?

Chris
« Last Edit: January 22, 2010, 09:38:58 PM by cme1st2302 »
Admin

He who waits for perfect conditions sees nothing!!
SMF Version: 1.1.11
SimplePortal Version: 2.3.1

Offline Zirc

  • Jr. Member
  • **
  • Posts: 53
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Display if somebody is chatting in Who's Online block
« Reply #5 on: January 22, 2010, 10:24:17 PM »
I'm not positive on how the updates to SP work but I'd imagine any custom modifications to the code would be lost.  I myself have all my forum files backed up in a separate directory before I make any changes just to be safe and then you would have a copy you could get the modification from if it is lost.  Or you could just make a text file and copy these code changes into it and any others you do so you have a record of the changes.

Offline [SiNaN]

  • Mr. SimplePortal
  • Developer
  • *
  • Posts: 6782
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: Display if somebody is chatting in Who's Online block
« Reply #6 on: January 23, 2010, 12:43:34 PM »
Thanks I have been looking for this as well but I was wondering how I would get it to work with FlashChat. 

One question though, if you make these changes wouldn't they be lost the next time there is an update to SP?

Chris

For Flashchat:

Code: (Find) [Select]
$stats = ssi_whosOnline('array');
Code: (Replace) [Select]
$stats = ssi_whosOnline('array');

global $db_prefix;

$request = db_query("
SELECT userid
FROM {$db_prefix}fc_connections
WHERE userid > 0", __FILE__, __LINE__);
$chat_users = array();
while ($row = mysql_fetch_assoc($request))
$chat_users[] = $row['userid'];
mysql_free_result($request);

Code: (Find) [Select]
$user['link'], '</li>';
Code: (Replace) [Select]
$user['link'], in_array($user['id'], $chat_users) ? ' [In Chat]' : '', '</li>';
You can change [In Chat] text as you like.

I'm not positive on how the updates to SP work but I'd imagine any custom modifications to the code would be lost.  I myself have all my forum files backed up in a separate directory before I make any changes just to be safe and then you would have a copy you could get the modification from if it is lost.  Or you could just make a text file and copy these code changes into it and any others you do so you have a record of the changes.

Yeah, you'll lose your edits on updates. At some point I was hoping to make each block as separate files, so only the really updates blocks will updated and others won't be affected. The best I can suggest now is logging your edits so you can apply them after an update.
And slowly, you come to realize... It's all as it should be...

Offline Stigmartyr

  • Jr. Member
  • **
  • Posts: 72
  • Gender: Male
  • SMF Version: 2 RC2
  • SP Version: 2.3.1
Re: Display if somebody is chatting in Who's Online block
« Reply #7 on: January 23, 2010, 01:24:16 PM »
Pardon my ignorance, but which file do I edit?

Offline [SiNaN]

  • Mr. SimplePortal
  • Developer
  • *
  • Posts: 6782
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: Display if somebody is chatting in Who's Online block
« Reply #8 on: January 23, 2010, 01:26:14 PM »
Oops, forgot to note: It's Sources/PortalBlocks.php file.
And slowly, you come to realize... It's all as it should be...

Offline Stigmartyr

  • Jr. Member
  • **
  • Posts: 72
  • Gender: Male
  • SMF Version: 2 RC2
  • SP Version: 2.3.1
Re: Display if somebody is chatting in Who's Online block
« Reply #9 on: January 23, 2010, 01:30:17 PM »
Fantastic, thank you.  It works!

Offline cme1st2302

  • Full Member
  • ***
  • Posts: 117
  • Gender: Male
    • East Coast Astro
  • SMF Version: 1.1.11
  • SP Version: 2.3.2
Re: Display if somebody is chatting in Who's Online block
« Reply #10 on: January 23, 2010, 09:30:31 PM »
Thanks again [SiNaN]  works great!!!
Admin

He who waits for perfect conditions sees nothing!!
SMF Version: 1.1.11
SimplePortal Version: 2.3.1

Offline Normally

  • Jr. Member
  • **
  • Posts: 53
  • Gender: Male
  • SMF Version: 2.0.2
  • SP Version: 2.3.5
Re: Display if somebody is chatting in Who's Online block
« Reply #11 on: January 24, 2010, 04:33:11 PM »
I get the following fault message:
Fatal error:  Call to undefined function  db_query() in /home/kaarten/domains/kaartenleggen.nl/public_html/lenormandkaarten/Sources/PortalBlocks.php on line 318

Any idea?

Offline ccbtimewiz

  • Hero Member
  • *****
  • Posts: 2185
  • Gender: Male
  • $("div.content:dd").hide();
  • SMF Version: None
  • SP Version: None
  • Elkarte Version: None
  • EhPortal Version: None
Re: Display if somebody is chatting in Who's Online block
« Reply #12 on: January 24, 2010, 06:24:47 PM »
Yes, do this instead:

Code: [Select]
   $request = $smcFunc['db_query']('', "
      SELECT userid
      FROM {db_prefix}fc_connections
      WHERE userid > 0");

   $chat_users = array();
   while ($row = $smcFunc['db_fetch_assoc']($request))
      $chat_users[] = $row['userid'];
   $smcFunc['db_free_result']($request);

Offline [SiNaN]

  • Mr. SimplePortal
  • Developer
  • *
  • Posts: 6782
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: Display if somebody is chatting in Who's Online block
« Reply #13 on: January 28, 2010, 11:30:24 AM »
The code I gave was for SMF 1.1 versions. If you are using SMF 2.0 versions, replace the query with the one ccbtimewiz gave above.
And slowly, you come to realize... It's all as it should be...

Offline Stigmartyr

  • Jr. Member
  • **
  • Posts: 72
  • Gender: Male
  • SMF Version: 2 RC2
  • SP Version: 2.3.1
Re: Display if somebody is chatting in Who's Online block
« Reply #14 on: January 28, 2010, 07:10:36 PM »
Funny Im using SMF 2.0 RC2 and it works with the code I used.  Well as of the date that I posted it worked, I am using whatever code was available at that time.

Offline [SiNaN]

  • Mr. SimplePortal
  • Developer
  • *
  • Posts: 6782
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: Display if somebody is chatting in Who's Online block
« Reply #15 on: January 29, 2010, 11:54:23 AM »
That was for the ones using Flashchat. I believe you are using AjaxChat Integration.
And slowly, you come to realize... It's all as it should be...

Offline filipina

  • Semi Newbie
  • *
  • Posts: 12
  • SMF Version: 2 RC2
  • SP Version: 2.3.1
Re: Display if somebody is chatting in Who's Online block
« Reply #16 on: February 26, 2010, 09:25:31 PM »
Hello!  SMF 2.0 RC2 and Flashchat 6.06 installed. I tried to piece together what is written here 1.1.11 v/s 2.0 RC2 for my Portal block but I am getting parse errors. Do I have something wrong here, could someone please help me. It would be greatly appreciated  :)

Find
Code: [Select]
$stats = ssi_whosOnline('array');
Replace With
Code: [Select]
      $stats = ssi_whosOnline('array');

      global $db_prefix;

      $request = $smcFunc['db_query']('', "
          SELECT userid
          FROM {db_prefix}fc_connections
          WHERE userid > 0");

      $chat_users = array();
      while ($row = $smcFunc['db_fetch_assoc']($request))
          $chat_users[] = $row['userid'];
      $smcFunc['db_free_result']($request);

Find
Code: [Select]
$user['link'], '</li>';
Replace With
Code: [Select]
$user['link'], in_array($user['id'], $chat_users) ? ' [In Chat]' : '', '</li>';
I get


Fatal error: Function name must be a string in /xxxxxxxx/public_html/penpal-community/Sources/PortalBlocks.php on line 319

-----------------------------------------------------------


So then I thought I found an error here    ['db_query']('', "       so i tried this
 
Code: [Select]
$stats = ssi_whosOnline('array');

global $db_prefix;

       $request = $smcFunc['db_query']('', '
          SELECT userid
          FROM {db_prefix}fc_connections
          WHERE userid > 0");

       $chat_users = array();
       while ($row = $smcFunc['db_fetch_assoc']($request))
          $chat_users[] = $row['userid'];
       $smcFunc['db_free_result']($request);

And got fatal error line 325 and the page wouldn't load LOL
« Last Edit: February 27, 2010, 01:08:12 AM by filipina »

Offline [SiNaN]

  • Mr. SimplePortal
  • Developer
  • *
  • Posts: 6782
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: Display if somebody is chatting in Who's Online block
« Reply #17 on: February 27, 2010, 03:55:16 AM »
For Flashchat and SMF 2.0:

Code: (Find) [Select]
$stats = ssi_whosOnline('array');
Code: (Replace) [Select]
$stats = ssi_whosOnline('array');

global $smcFunc;

$request = $smcFunc['db_query']('', '
SELECT userid
FROM {db_prefix}fc_connections
WHERE userid > 0');
$chat_users = array();
while ($row = $smcFunc['db_fetch_assoc']($request))
$chat_users[] = $row['userid'];
$smcFunc['db_free_result']($request);

Code: (Find) [Select]
$user['link'], '</li>';
Code: (Replace) [Select]
$user['link'], in_array($user['id'], $chat_users) ? ' [In Chat]' : '', '</li>';
You can change [In Chat] text as you like.
And slowly, you come to realize... It's all as it should be...

Offline filipina

  • Semi Newbie
  • *
  • Posts: 12
  • SMF Version: 2 RC2
  • SP Version: 2.3.1
Re: Display if somebody is chatting in Who's Online block
« Reply #18 on: February 27, 2010, 02:03:43 PM »
Thanks so much [SiNaN] worked perfectly :)

Offline sekhon

  • Semi Newbie
  • *
  • Posts: 8
  • SMF Version: 2.0.1
  • SP Version: 2.3.4
Re: Display if somebody is chatting in Who's Online block
« Reply #19 on: January 30, 2012, 01:39:11 PM »
i am using Flashchat 6 and smf 2.0.2

i am bit confused , which file i need to edit with the above code @ [SiNaN]

i want to show block of chat users of FlashChat 6 .  :(

Offline sekhon

  • Semi Newbie
  • *
  • Posts: 8
  • SMF Version: 2.0.1
  • SP Version: 2.3.4
Re: Display if somebody is chatting in Who's Online block
« Reply #20 on: January 30, 2012, 01:59:27 PM »
 <!-- Flashchat Who is -->
<p><iframe height="100" frameborder="0" src="chat/info_embedded.php" style="width: 100%; margin: 0; padding: 0; border: 0; overflow: hidden;" scrolling="no" border="0" allowtransparency="true"></iframe></p>
<!-- End Flashchat who is --> 


the above is best solution i ever get.

Thanks to allllllllllllllllllllllll  ;D