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: 1263
  • 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]


Installation errors? Mod incompatibilities? Upgrade problems? Make your way over to the Install and Upgrade Support board for all your solutions!

Stats Block w/ Users in Chat (FlashChat)

Started by cme1st2302, February 27, 2009, 02:30:35 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

cme1st2302

I found the following code for a Stats block (see attached pic) at tinyportal.net and was wondering what I would have to do to get it to work on SimplePortal. 

global $context, $db_prefix, $settings, $options, $scripturl, $txt, $user_info, $modSettings;

    $bullet = '<img src="'.$settings['images_url'].'/TPdivider.gif" alt="" border="0" style="margin:0 2px 0 0;" />';
$bullet2 = '<img src="'.$settings['images_url'].'/TPdivider2.gif" alt="" border="0" style="margin:0 2px 0 0;" />';
$bullet3 = '<img src="'.$settings['images_url'].'/TPdivider3.gif" alt="" border="0" style="margin:0 2px 0 0;" />';
$bullet4 = '<img src="'.$settings['images_url'].'/tpgoto.gif" alt="" border="0" style="margin:0 2px 0 0;" />';
$bullet5 = '<img src="'.$settings['images_url'].'/tpmodule2.gif" alt="" border="0" style="margin:0 2px 0 0;" />';
echo'

<div class="smalltext" style="font-family: verdana, arial, sans-serif;">';

       if(isset($context['TPortal']['userbox']['stats']))
   // members stats
            echo '
                 <img src="'.$settings['images_url'].'/icons/members.gif" style="margin: 0;" align="bottom" alt="" />
                 <a href="'.$scripturl.'?action=mlist"><b>'.$txt[19].'</b></a>
                 <br />'.$bullet.$txt[488].': ' , isset($modSettings['memberCount']) ? $modSettings['memberCount'] : $modSettings['totalMembers'] , '
                 <br />'.$bullet.$txt['tp-latest']. ': <a href="', $scripturl, '?action=profile;u=', $modSettings['latestMember'], '"><b>', $modSettings['latestRealName'], '</b></a>';
       if(isset($context['TPortal']['userbox']['stats_all']))

global $db_prefix,$modSettings;
$today = strtotime("24 hours ago");
date('j') == 1 ? $thismonth = $today : $thismonth = strtotime(date('F') . ' 1');
date('l') == 'Sunday' ? $thisweek = $today : $thisweek = strtotime('last Sunday');
date('M') == 'January' ? $thisyear = $thismonth : $thisyear = strtotime('January 1');
$query = db_query("SELECT
COUNT(dateRegistered > $thisyear OR NULL) as year,
COUNT(dateRegistered > $thismonth OR NULL) as month,
COUNT(dateRegistered > $thisweek OR NULL) as week,
COUNT(dateRegistered > $today OR NULL) as today
FROM {$db_prefix}members
WHERE is_activated = 1", __FILE__, __LINE__);
$row = mysql_fetch_assoc($query);

settype($row['today'], "integer");
settype($row['week'], "integer");
settype($row['month'], "integer");

echo '<br />',$bullet,'New This Month: ', $row['month'],'<br />';
echo $bullet,'New This Week: ', $row['week'],'<br />';
echo $bullet,'New Today: ', $row['today'];

   // more stats
            echo '
                  <hr /><img src="'.$settings['images_url'].'/icons/info.gif" style="margin: 0;" align="bottom" alt="" />
                 <a href="'.$scripturl.'?action=stats"><b>'.$txt['tp-stats'].'</b></a>
                 <br />'.$bullet.$txt[489].': '.$modSettings['totalMessages']. '
  <br />'.$bullet. $txt[490].': '.$modSettings['totalTopics']. '
  <br />'.$bullet.$txt['tp-mostonline-today'].': '.$modSettings['mostOnlineToday'].'
  <br />'.$bullet.$txt['tp-mostonline'].': '.$modSettings['mostOnline'].'<br />
  ('.timeformat($modSettings['mostDate']).')
  ';

       if(isset($context['TPortal']['userbox']['online'])){
   // add online users
            echo '<hr /><img src="'.$settings['images_url'].'/icons/online.gif" style="margin: 0;" align="bottom" alt="" />
                 <a href="'.$scripturl.'?action=who"><b>'.$txt[158].'</b></a><br />';

            $online = ssi_whosOnline('array');
   echo $bullet.$txt['tp-users'].': '.$online['num_users'];
   echo '<br />'.$bullet.$txt['tp-guests'].': '.$online['guests'];
  // --- Begin FlashChat Integration ---
   echo '<br />', $bullet, 'In Chat: ', $online['num_chat'];
   // --- End FlashChat Integration ---
   echo '<br />'.$bullet.$txt['tp-total'].': '.$online['total_users'].'<hr />
<div style="width: 100%; ' , $online['num_users']>14 ? 'height: 23ex;overflow: auto;' : '' ,'">';

      foreach($online['users'] as $user){
echo $bullet2 , $user['hidden'] ? '<i>' . $user['link'] . '</i>' : $user['link'];
echo '<br />';
   }
echo '</div>';
      // --- Begin FlashChat Integration ---
echo '
<hr />
<img src="/chat.png"><a href="'.$scripturl.'?action=chat"> <b>Users in Chat</b></a><br />
<div style="width: 100%; ', ($online['num_chat'] > 14 ? 'height: 23ex;overflow: auto;' : ''), '">';
foreach ($online['users_chat'] as $user)
{
echo '
', $bullet2, $user['link'], ' (', (!$user['chat']['room']['public'] ? $txt['fc_private_room'] : $user['chat']['room']['name']), ')
<br />';
}
echo '
</div>';
   // --- End FlashChat Integration ---
         }
echo '</div>

</div>';


Alternatively if this can't be done I would like to add the users in chat to my who's online block but make it look like it belongs there. I currently have a block under my who's online block for users in chat but it does not fit well visually speaking. My site is www.eastcoastastro.com.

Thanks in advance,
Chris
Admin

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

fl4pj4ck

#1
and what chat are you using? is it flashchat AJAXchat? (https://blueimp.net/ajax/)

it works flawlessly with SMF, here's linky to my site -> http://polacywlimerick.com/forum/index.php?action=chat

I am too looking for block that will show how many users are in the chat
anyone can help us?

cme1st2302

Yes I am using FlashChat.  The link you provided is for Ajax Chat though.  I currently have a block that shows the users in chat (for FlashChat) but I do not like the way it looks.  you can check it out on my site www.eastcoastastro.com

Chris
Admin

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

cme1st2302

So I would like to go with my alternate plan which is to add the users in chat to the Who's Online Block.  I got as far as adding the "Users in Chat" to the block but I can not figure out how to add the users names under that just like it is shown for people online.  Please see the attached pic for reference.

Chris
Admin

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

cme1st2302

Admin

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

Killer-B

Quote from: cme1st2302 on February 27, 2009, 10:26:53 PM
Yes I am using FlashChat.  The link you provided is for Ajax Chat though.  I currently have a block that shows the users in chat (for FlashChat) but I do not like the way it looks.  you can check it out on my site www.eastcoastastro.com

Chris

Hey Chris - Sorry I don't have any answers... but just visited your eastcoast site  and looks good -

Can I ask 2 things?

Where or what code did you use for the left box - showing members in chat? (that's what brought me here today) so good to see someone doing it - I found some "old code" for like 1.1.2 but don't think that'll work - I'm using Ajax - I had FlashChat going but my host puked at us as it's a CPU hog... Users didnt like it much either (on another site)

#2) is - I also saw your scrolling members/staff - very cool - May I ask how you did this as well?

Speaking of scrolling - I used to have a cool scroller with MKP for my RSS news (see center block RSS news) but is now static...

Any suggestions how to get that to scroll/hover/stop?

Thanks in advance!

KB

Chat: www.f-1chat.com/forum/chat (yet to install any linkage to it in portal)

Main www.f-1chat.com

thanks!

cme1st2302

Hey KB,
  Thanks for the kind comments, I'm glad you like it. It was a lot of hard work but I'm happy with the end result.  Now for the goods!!

Code for Users in Chat
global $boardurl;
echo '
<fontcolor="#0000FF"><iframe fontcolor="0000FF" frameborder="0" height="100" src="', $boardurl, '/chat/info_embedded.php" style=" width: 100%; margin: 0; padding: 0; border: 0; overflow: hidden;" scrolling="no" border="0" allowtransparency="true"></iframe>';


Code for Scrolling Staff
[code]global $scripturl, $db_prefix;

$intro_message = "The people who keep this ship afloat.";
$defaultColor = "#666666";

$query = db_query(
    "SELECT realName, ID_MEMBER, ID_GROUP
     FROM {$db_prefix}members
     WHERE ID_GROUP = 1
        OR ID_GROUP = 2
        OR ID_GROUP = 3
     ORDER BY realName", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($query)) {
  $rank[$row['ID_MEMBER']] = $row['ID_GROUP'];
  $name[$row['ID_MEMBER']] = $row['realName'];
}
$grpcolor=array();
$query = db_query(
    "SELECT ID_GROUP, groupName, onlineColor
     FROM {$db_prefix}membergroups
     WHERE ID_GROUP = 1
        OR ID_GROUP = 2
        OR ID_GROUP = 3
     ORDER BY ID_GROUP", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($query)) {
  $grpnme[$row['ID_GROUP']] = $row['groupName'];
  if ($row['onlineColor'] > '')
    $grpcolor[$row['ID_GROUP']] = $row['onlineColor'];
  else
    $grpcolor[$row['ID_GROUP']] = $defaultColor;
}

// Begin scrolling script
echo '
<style type="text/css">

#marqueecontainer{
position: relative;
width: 95%; /*marquee width */
height: 150px; /*marquee height */
overflow: hidden;
padding: 2px;
padding-left: 4px;
}

</style>

<script language="javascript" type="text/javascript">

/***********************************************
* Cross browser Marquee II-
Admin

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

cme1st2302

I forgot that I edited my info_embedded.php file to get the result that you see on my page.  If no one is in the chat it tells you such.  If you need to know the edits just let me know.

Chris
Admin

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

J-Bird

Quote from: cme1st2302 on February 27, 2009, 11:57:24 PM
So I would like to go with my alternate plan which is to add the users in chat to the Who's Online Block.  I got as far as adding the "Users in Chat" to the block but I can not figure out how to add the users names under that just like it is shown for people online.  Please see the attached pic for reference.

Chris

Me too  :nervous-happy:

Add me to the list of Flashchat users hoping to get Users in Chat added to the block, or a new block with same.

BTW Chris, I like the scrolling staff code. Is there a way to turn off the scroll though where it just displays without the scrolling?

cme1st2302

Admin

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

cme1st2302

J-Bird,
  I have the code for the users in chat block.  The only thing is I had to modify the chat/info_embedded.php file to get it the way I like it.  It only shows the users names in chat and nothing else, and if no one is in the chat room it shows "No users currently in chat!!"

Let me know if you want to know how.
Admin

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

noelleon69

Quote from: J-Bird on March 15, 2009, 09:55:18 PM
Me too  :nervous-happy:

Add me to the list of Flashchat users hoping to get Users in Chat added to the block, or a new block with same.

BTW Chris, I like the scrolling staff code. Is there a way to turn off the scroll though where it just displays without the scrolling?
Me three! :D I want to have a Users in Chat in the Who's Online block as well if possible.

noelleon69

I was thinking, there is a flashchat integration mod for SMF. The thing is to list users in chat is just one of the changes that the mod does, so I can't really determine which codes to pluck out and use as I'm no coding expert.

Maybe those with coding skills can take a look at what this mod changes and can help us extract out the codes that can be used to achieve our objective. Instead of actually writing the codes from scratch as that would be a lot to ask honestly, and I don't actually expect someone to do that unless they are familiar with flashchat.

Here is the mod: http://custom.simplemachines.org/mods/index.php?mod=611


cme1st2302

I figured I would visit an old topic of mine with an update.  I finally figured out how to add the users in chat (FlashChat) to the Who's online list.  I modified the PortalBlocks.php file and the below pics are the result.  I also attached the PortalBlocks.php file if you want to use it.

Chris
Admin

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

tietacs

#15
I tried to use your portalblocks file but it messed up some of my other blocks.

I then copied the code around the 'who's online' bit and inserted it into my portalblocks.

However the chat now won't login... thoughts.

Update: got round this by creating an html block, in it I put an iframe in and embedded the flashchat - info_embedded.php. I then went into the info_embedded file and editted the display settings at the bottom to fit in with my theme.

Very simple!

<iframe src="chat/info_embedded.php" width="170px" height="100%" align="center" frameborder="0"></iframe>

Stigmartyr

How can we make this block work with Ajax Chat? :)

Scanlite

#17
Hi all,

I tried this mod using Chris's portalblock.php but only realised later Chris's file is for an earlier version of smf!

Would anyone have a modified portalblock.php for smf 2.0 please!
Thank You
Dave