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: 343
  • 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: [TUT] Creating sweet chat rooms for your SMF using SimplePortal  (Read 12043 times)

0 Members and 1 Guest are viewing this topic.

Offline Mick.

  • Comrade
  • *
  • Posts: 77
  • Gender: Male
  • Premium SMF Themes
    • idesignSMF
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Chat room for SMF
I will show you how to create multiple chat rooms for your SMF installation. I've never been a big fan of the normal side block shoutbox. Instead, lets use the same shoutbox blocks but add them onto custom pages with a category to different rooms and who's in it.

Lets create 5 shout boxes, 5 custom PHP pages, 5 'Bottom" shoutbox blocks, 1 HTML "Right" block.

Demo: http://www.bluedevilcustoms.com/community/index.php/page,page235.html

I've created 5 chat rooms for demo purposes.
-Entertainment
-Sports
-News
-Weather
-Teen Talk

You can create yours to suit your needs and as many as you wish.

Lets create 5 new shout boxes.
admin---->simpleportal--->shoutbox--->add shoutbox.

create as many as want. I made these...
-Entertainment
-Sports
-News
-Weather
-Teen Talk

Height: 300px  Shouts to display: 6   (I used 6 simply because i hate scroll bars).

Create 5 custom PHP pages and name them the same as your shoutboxes. That way is less confusing.
-Entertainment
-Sports
-News
-Weather
-Teen Talk

Tick no title and no body at the bottom.

Lets add the chat room title and some guts...
Code: [Select]
echo'
    <br />
          <font color="#605e5e"><font size="6" face="tahoma">Entertainment</font></font>
<hr \>
      <br \>';

global $context, $settings, $txt;

if (empty($context['SPortal']['page']['style']['no_title']))
{
echo '
<h3 class="', $context['SPortal']['page']['style']['title']['class'], '"', !empty($context['SPortal']['page']['style']['title']['style']) ? ' style="' . $context['SPortal']['page']['style']['title']['style'] . '"' : '', '><span class="left"></span>
', $context['SPortal']['page']['title'], '
</h3>';
}

if (!empty($settings['display_who_viewing']))
{
echo '
<p id="whoisviewing" class="smalltext">';

// Show just numbers...?
if ($settings['display_who_viewing'] == 1)
echo count($context['view_members']), ' ', count($context['view_members']) == 1 ? $txt['who_member'] : $txt['members'];
// Or show the actual people viewing the page?
else
echo empty($context['view_members_list']) ? '0 ' . $txt['members'] : implode(', ', $context['view_members_list']) . ((empty($context['view_num_hidden']) || $context['can_moderate_forum']) ? '' : ' (+ ' . $context['view_num_hidden'] . ' ' . $txt['hidden'] . ')');

// Now show how many guests are here too.
echo $txt['who_viewing_page'], '
</p>';
}

You can change the color, size and font to suit your needs on line 3.  Repeat this process to the other custom pages and name them accordingly.

Lets create the shout box blocks and show them in our new custom pages.
-create 'bottom' shout box.
-advanced options,.... tick the custom page where your shout box block want to appear.
-Tick no title and no body.
-Save


In Themes/default/languages/SPortal.english.php

Add at the very end:
Code: [Select]
$txt['who_viewing_page'] = ' are in this chat room.';

In sourcedir/PortalPages.php

Find:
   
Code: [Select]
global $smcFunc, $context, $txt, $scripturl, $sourcedir, $user_info;
Replace with:
       
Code: [Select]
global $smcFunc, $context, $txt, $scripturl, $sourcedir, $user_info, $settings;

Find:
       
Code: [Select]
$context['page_title'] = $context['SPortal']['page']['title'];
Replace with:
       
Code: [Select]
  if (!empty($settings['display_who_viewing']))
{
// Start out with no one at all viewing it.
$context['view_members'] = array();
$context['view_members_list'] = array();
$context['view_num_hidden'] = 0;

// Search for members who have this topic set in their GET data.
$request = $smcFunc['db_query']('', '
SELECT
lo.id_member, lo.log_time, lo.url, mem.real_name, mem.member_name, mem.show_online,
mg.online_color, mg.id_group, mg.group_name
FROM {db_prefix}log_online AS lo
LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = lo.id_member)
LEFT JOIN {db_prefix}membergroups AS mg ON (mg.id_group = CASE WHEN mem.id_group = {int:reg_id_group} THEN mem.id_post_group ELSE mem.id_group END)
WHERE INSTR(lo.url, {string:in_url_string}) > 0 OR lo.session = {string:session}',
array(
'reg_id_group' => 0,
'in_url_string' => 's:4:"page";',
'session' => $user_info['is_guest'] ? 'ip' . $user_info['ip'] : session_id(),
)
);
while ($row = $smcFunc['db_fetch_assoc']($request))
{
if (empty($row['id_member']))
continue;
if (!preg_match('~s:4:"page";s:\d+:"([^"]+)";~', $row['url'], $match) || $match[1] != $page_id)
continue;

if (!empty($row['online_color']))
$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '" style="color: ' . $row['online_color'] . ';">' . $row['real_name'] . '</a>';
else
$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['real_name'] . '</a>';

$is_buddy = in_array($row['id_member'], $user_info['buddies']);
if ($is_buddy)
$link = '<strong>' . $link . '</strong>';

// Add them both to the list and to the more detailed list.
if (!empty($row['show_online']) || allowedTo('moderate_forum'))
$context['view_members_list'][$row['log_time'] . $row['member_name']] = empty($row['show_online']) ? '<em>' . $link . '</em>' : $link;
$context['view_members'][$row['log_time'] . $row['member_name']] = array(
'id' => $row['id_member'],
'username' => $row['member_name'],
'name' => $row['real_name'],
'group' => $row['id_group'],
'href' => $scripturl . '?action=profile;u=' . $row['id_member'],
'link' => $link,
'is_buddy' => $is_buddy,
'hidden' => empty($row['show_online']),
);

if (empty($row['show_online']))
$context['view_num_hidden']++;
}

// The number of guests is equal to the rows minus the ones we actually used ;).
$context['view_num_guests'] = $smcFunc['db_num_rows']($request) - count($context['view_members']);
$smcFunc['db_free_result']($request);

// Sort the list.
krsort($context['view_members']);
krsort($context['view_members_list']);
}

$context['page_title'] = $context['SPortal']['page']['title'];



Now lets add the category block.
-Create a 'Right' HTML block and name it: "Chatroom Categories".
Lets add the code.
Code: [Select]
<br />
<font color="#605e5e"><font size="6" face="tahoma">Categories</font></font>
<hr \>
<br \>
<ul>
    <li><strong><a href="http://www.bluedevilcustoms.com/community/index.php/page,page235.html">Entertainment</a></strong></li>
    <li><strong><a href="http://www.bluedevilcustoms.com/community/index.php/page,page596.html">News</a></strong></li>
    <li><strong><a href="http://www.bluedevilcustoms.com/community/index.php/page,page4259.html">Sports</a></strong></li>
    <li><strong><a href="http://www.bluedevilcustoms.com/community/index.php/page,page1845.html">Weather</a></strong></li>
    <li><strong><a href="http://www.bluedevilcustoms.com/community/index.php/page,page4319.html">Teen Talk</a></strong</li>
</ul>

For demo purposes, im using my links. Change them with your own.
-Not collapsible
-Advanced options, select all your custom pages.
-Tick: No title no body

Now lets create a direct link and add it to your forum menu.
Open:
Sources/Subs.php

Near the bottom of the file, youll find the menu buttons.

Find:
Code: [Select]
'search' => array(
'title' => $txt['search'],
'href' => $scripturl . '?action=search',
'show' => false,
'sub_buttons' => array(
),
),

Add after:

Code: [Select]
'chat' => array(
'title' => 'Chat Rooms',
'href' => 'http://www.bluedevilcustoms.com/community/index.php/page,page2862.html',
'show' => true,
'sub_buttons' => array(
),
),
Replaced the URL with whichever chatroom you want to use as the landing page.

Thats it.  Have fun.

Offline [SiNaN]

  • Mr. SimplePortal
  • Developer
  • *
  • Posts: 6782
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: [TUT] Creating sweet chat rooms for your SMF using SimplePortal
« Reply #1 on: March 21, 2012, 01:24:24 PM »
Good. You could also try improving this code:

http://simpleportal.net/index.php?topic=10732.msg55637#msg55637
And slowly, you come to realize... It's all as it should be...

Offline Mick.

  • Comrade
  • *
  • Posts: 77
  • Gender: Male
  • Premium SMF Themes
    • idesignSMF
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: [TUT] Creating sweet chat rooms for your SMF using SimplePortal
« Reply #2 on: March 21, 2012, 03:02:59 PM »
Well hell lol....

I'll take a look. Looks cool. By looking at the pic I'd rather have the categories listed instead of drop downs.  Lol I hate drop downs .  Hahahaha

Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: [TUT] Creating sweet chat rooms for your SMF using SimplePortal
« Reply #3 on: March 22, 2012, 03:48:05 PM »
That's a nice tutorial.  Are you back to using SimplePortal again?
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?

Offline Mick.

  • Comrade
  • *
  • Posts: 77
  • Gender: Male
  • Premium SMF Themes
    • idesignSMF
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: [TUT] Creating sweet chat rooms for your SMF using SimplePortal
« Reply #4 on: March 23, 2012, 07:59:38 AM »
That's a nice tutorial.  Are you back to using SimplePortal again?
All my sites use SP :nervous-happy: but one.

Offline Saffzuk

  • Just Registered
  • Posts: 1
  • SMF Version: 2.0.2
  • SP Version: 2.3.5
Re: [TUT] Creating sweet chat rooms for your SMF using SimplePortal
« Reply #5 on: July 31, 2012, 12:36:22 PM »
I have used this and it works perfectly with SMF 2.0.2 and SP 2.3.5  :nervous-happy:

Offline mlthmp

  • Just Registered
  • Posts: 1
  • SMF Version: 2.0.4
Re: [TUT] Creating sweet chat rooms for your SMF using SimplePortal
« Reply #6 on: June 25, 2013, 07:07:49 PM »
I know this is an older topic, but does anyone know how to make this work with 2.0.4 and SP 2.3.5 ? Whenever I try to make the php pages I get " Database error in block code. Please check the code. "