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

[TUT] Creating sweet chat rooms for your SMF using SimplePortal

Started by Mick., March 21, 2012, 12:57:25 PM

Previous topic - Next topic

0 Members and 3 Guests are viewing this topic.

Mick.

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

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:
$txt['who_viewing_page'] = ' are in this chat room.';


In sourcedir/PortalPages.php

Find:
   global $smcFunc, $context, $txt, $scripturl, $sourcedir, $user_info;

Replace with:
        global $smcFunc, $context, $txt, $scripturl, $sourcedir, $user_info, $settings;


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

Replace with:
          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.
<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:
'search' => array(
'title' => $txt['search'],
'href' => $scripturl . '?action=search',
'show' => false,
'sub_buttons' => array(
),
),


Add after:

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

[SiNaN]

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

Mick.

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

AngelinaBelle

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?

Mick.

Quote from: AngelinaBelle on March 22, 2012, 03:48:05 PM
That's a nice tutorial.  Are you back to using SimplePortal again?
All my sites use SP :nervous-happy: but one.

Saffzuk

I have used this and it works perfectly with SMF 2.0.2 and SP 2.3.5  :nervous-happy:

mlthmp

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