Main Menu
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 log in.

Who's Online

  • Dot Guests: 1242
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.

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]


If you're interested in helping other members with support requests, consider joining the Community Support Helpers group.

Display if somebody is chatting in Who's Online block

Started by Zirc, January 06, 2010, 06:07:57 PM

Previous topic - Next topic

0 Members and 4 Guests are viewing this topic.

Zirc

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

Stigmartyr

 :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.

[SiNaN]

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...

Zirc


cme1st2302

#4
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
Admin

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

Zirc

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.

[SiNaN]

Quote from: cme1st2302 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

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.

Quote from: Zirc 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.

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...

Stigmartyr


[SiNaN]

Oops, forgot to note: It's Sources/PortalBlocks.php file.
And slowly, you come to realize... It's all as it should be...

Stigmartyr


cme1st2302

Admin

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

Normally

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?

ccbtimewiz

Yes, do this instead:

   $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);

[SiNaN]

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...

Stigmartyr

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.

[SiNaN]

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...

filipina

#16
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
$stats = ssi_whosOnline('array');

Replace With
      $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
$user['link'], '</li>';

Replace With
$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


$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

[SiNaN]

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...


sekhon

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 .  :(