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: 872
  • Dot Hidden: 0
  • Dot Users: 1
  • Dot 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]


NEED HELP? If you're looking for support with Simple Portal, look no further than the Support Board!

Flashchat

Started by chep, September 27, 2009, 12:33:22 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

chep

Passing on a note in case other people wanted to use something similar.

There is no need to install any other mod than Simple Portal in order to accomplish integrating Flash Chat.

1)I downloaded and installed Simple Portal today on our forum. We have about 400,000 posts and 4000 members.

2)I installed Flashchat with SMF.


3)Then I created a page using Simple Portal with an iFrame and put flashchat.php in there.

<iframe src="http://yoursite.com/smf/chat/flashchat.php" width="100%" height="600">
  <p>Your browser does not support iframes.</p>
</iframe>


4) Then I created a Block to display how many members are in chat and who they are with a link to their profile.


NOTE: Some of the information I obtained obtained directly from SMF via Settings.php such as $CONFIG. You could manually enter this information if needed.

global $CONFIG;
$result = @mysql_connect($CONFIG['dbserver'], $CONFIG['dbuser'], $CONFIG['dbpass']);


$result = mysql_query("SELECT * FROM `smf_fc_connections` WHERE `userid` != \"NULL\"");

$resultnum = mysql_num_rows($result);

if ($result)
{
echo 'Members in Chat: ' . $resultnum;
        echo '<hr>';
        while($row = mysql_fetch_array($result))
        {
            $result2 = mysql_query("SELECT * FROM `smf_members` WHERE `ID_MEMBER` ='$row[userid]'");

            $row2 = mysql_fetch_array($result2);
            if ($row2)
            {
                echo "<a href=\"http://yoursite.com/smf/index.php?action=profile;u=$row[userid]\">";
                echo $row2['memberName'];
                echo "</a><br />";
            }
         }
         if ($resultnum > 0)
         {
             echo '<hr>';
         }
}
else
{
echo 'Members in Chat: 0';
}

echo '<br /><br/><b><a href="http://yoursite.com/smf/index.php?page=chat">Link to Chat</a></b>';



Stigmartyr

Neat, I also am porting over my website to Simple Portal, but wanted to know if you were able to accomplish making it so the chat button in the menu also shows the number of users in chat.

Example: Chat [10 Users]

I am going to tackle installing this mod soon on my SMF2 site

Ardd0

If the question is multiple choice my default is "All of the above."<a href="http://www.hypercrites.org"><img border="0" src="http://www.hypercrites.org/externals/rabbtag1c.gif" width="200" height="34"></a>

[SiNaN]

The code above will result in running a query for every member. I would suggest using this code though:

global $db_prefix, $scripturl, $user_profile;

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

if (!empty($members))
{
$member_ids = loadMemberData($members);

echo 'Members in chat: ', count($member_ids), '<hr />';

foreach ($member_ids as $member)
echo '<a href="', $scripturl, '?action=profile;u=', $user_profile[$member]['ID_MEMBER'], '">', $user_profile[$member]['realName'], '</a><br />';

echo '<hr />';
}
else
echo 'Members in chat: 0';


It will just do it with 2 queries and doesn't require database information.
And slowly, you come to realize... It's all as it should be...

cme1st2302

Works great [SiNaN]!!! How would I get the users name to show up the same as their respective online color?

Chris
Admin

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

[SiNaN]

I haven't tested it, but this should will do it I hope:

global $db_prefix, $scripturl, $user_profile, $color_profile;

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

if (!empty($members))
{
$member_ids = loadMemberData($members);
sp_loadColors($member_ids);

echo 'Members in chat: ', count($member_ids), '<hr />';

foreach ($member_ids as $member)
{
if (!empty($color_profile[$member]['link']))
echo $color_profile[$member]['link'], '<br />';
else
echo '<a href="', $scripturl, '?action=profile;u=', $user_profile[$member]['ID_MEMBER'], '">', $user_profile[$member]['realName'], '</a><br />';
}

echo '<hr />';
}
else
echo 'Members in chat: 0';
And slowly, you come to realize... It's all as it should be...

cme1st2302

Works great!!!  Thanks again [SiNaN]
Admin

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

[SiNaN]

And slowly, you come to realize... It's all as it should be...

filipina

#8
Hello Sinan. I was reading this thread and trying to apply the block for my SMF 2.0 RC2 and Flash Chat 6.0 which I have installed. I also have the newest Simple Portal new install on new forum. I think I am missing a step but from reading this thread I cannot figure out what to do.

I installed your last code with php validation off and on preview I saw this.

Fatal error: Call to undefined function db_query() in /xxxxxxxx/public_html/penpal-community/Sources/PortalBlocks.php(3272) : eval()'d code on line 1

So besides the the code (which does something need to be altered for my individual site?) is there another step first before making the block.  Thanks for any assistance. 

EDIT - Maybe this is not what I need. I am just trying to have a block on Portal show users in chat I have no interest in embed of the chat room.