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: 272
  • 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: [SMF 2.0] Allow guests to use the Shoutbox  (Read 27694 times)

0 Members and 1 Guest are viewing this topic.

Offline ccbtimewiz

  • Hero Member
  • *****
  • Posts: 2185
  • Gender: Male
  • $("div.content:dd").hide();
  • SMF Version: None
  • SP Version: None
  • Elkarte Version: None
  • EhPortal Version: None
[SMF 2.0] Allow guests to use the Shoutbox
« on: October 05, 2011, 03:36:00 PM »
The following edits allow guests to shout in the shoutbox.

SMF version: 2.0 series
SP version: 2.3 series



Open ./Sources/PortalShoutbox.php

Find:
Code: [Select]
function sportal_create_shout($shoutbox, $shout)
{
global $smcFunc, $user_info;

Replace with:
Code: [Select]
function sportal_create_shout($shoutbox, $shout)
{
global $txt, $smcFunc, $user_info;

Find:
Code: [Select]
if (trim(strip_tags(parse_bbc($shout, false), '<img>')) === '')
return false;

Replace with:
Code: [Select]
if (trim(strip_tags(parse_bbc($shout, false), '<img>')) === '')
return false;

if ($user_info['is_guest'])
{
if (!isset($_SESSION['guest_has_shouted']))
{
$_SESSION['guest_has_shouted'] = rand(10, 1000);
$user_info['name'] = $txt['guest'] . $_SESSION['guest_has_shouted'];
$user_info['id'] = 0;
}
else
$user_info['name'] = $txt['guest'] . (!empty($_SESSION['guest_has_shouted']) ? $_SESSION['guest_has_shouted'] : rand(10, 1000));
}

Find:
Code: [Select]
if (!empty($_REQUEST['shout']))
{
checkSession('request');

is_not_guest();

Replace with:
Code: [Select]
if (!empty($_REQUEST['shout']))
{
checkSession('request');

//is_not_guest();


Open ./Sources/Subs-Portal.php

Find:
Code: [Select]
if ($user_info['is_guest'])
return false;

Replace with:
Code: [Select]
//if ($user_info['is_guest'])
//return false;

Find:
Code: [Select]
'name' => $row['member_name'],
Replace with:
Code: [Select]
'name' => (!empty($row['member_name']) ? $row['member_name'] : $txt['guest']),
Find:
Code: [Select]
'link' => $row['id_member'] ? ('<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '" title="' . $txt['on'] . ' ' . strip_tags(timeformat($row['log_time'])) . '"' . (!empty($online_color) ? ' style="color: ' . $online_color . ';"' : '') . '>' . $row['member_name'] . '</a>') : $row['member_name'],
Replace with:
Code: [Select]
'link' => $row['id_member'] ? ('<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '" title="' . $txt['on'] . ' ' . strip_tags(timeformat($row['log_time'])) . '"' . (!empty($online_color) ? ' style="color: ' . $online_color . ';"' : '') . '>' . $row['member_name'] . '</a>') : (!empty($row['member_name']) ? $row['member_name'] : $txt['guest']),


Open ./Sources/PortalBlocks.php

Find:
Code: [Select]
if (!empty($_POST['new_shout']) && !empty($_POST['submit_shout']) && !empty($_POST['shoutbox_id']) && $_POST['shoutbox_id'] == $shoutbox['id'])
{
checkSession();

is_not_guest();

Replace with:
Code: [Select]
if (!empty($_POST['new_shout']) && !empty($_POST['submit_shout']) && !empty($_POST['shoutbox_id']) && $_POST['shoutbox_id'] == $shoutbox['id'])
{
checkSession();

//is_not_guest();


Open ./Themes/default/Portal.template.php

Find:
Code: [Select]
if ($context['can_shout'])
echo '
<div class="shoutbox_input smalltext">
<input type="text" name="new_shout" id="new_shout_', $shoutbox['id'], '" class="shoutbox_input sp_float_left input_text"', $context['browser']['is_ie'] ? ' onkeypress="if (sp_catch_enter(event)) { sp_submit_shout(' . $shoutbox['id'] . ', \'' . $context['session_var'] . '\', \'' . $context['session_id'] . '\'); return false; }"' : '', ' />
<input type="submit" name="submit_shout" value="', $txt['sp_shoutbox_button'], '" class="sp_float_right button_submit" onclick="sp_submit_shout(', $shoutbox['id'], ', \'', $context['session_var'], '\', \'', $context['session_id'], '\'); return false;" />
</div>';

Replace with:
Code: [Select]
if ($context['can_shout'] || $context['user']['is_guest'])
echo '
<div class="shoutbox_input smalltext">
<input type="text" name="new_shout" id="new_shout_', $shoutbox['id'], '" class="shoutbox_input sp_float_left input_text"', $context['browser']['is_ie'] ? ' onkeypress="if (sp_catch_enter(event)) { sp_submit_shout(' . $shoutbox['id'] . ', \'' . $context['session_var'] . '\', \'' . $context['session_id'] . '\'); return false; }"' : '', ' />
<input type="submit" name="submit_shout" value="', $txt['sp_shoutbox_button'], '" class="sp_float_right button_submit" onclick="sp_submit_shout(', $shoutbox['id'], ', \'', $context['session_var'], '\', \'', $context['session_id'], '\'); return false;" />
</div>';

« Last Edit: October 06, 2011, 01:43:50 AM by Veridis Quo »

Offline Shadow Queen

  • Jr. Member
  • **
  • Posts: 62
  • Gender: Female
    • My Kingdom
  • SMF Version: 2 RC5
  • SP Version: 2.3.3
Re: [SMF 2.0] Allow guests to use the Shoutbox
« Reply #1 on: October 05, 2011, 04:23:50 PM »
Can I see a screen shoot?

Offline ccbtimewiz

  • Hero Member
  • *****
  • Posts: 2185
  • Gender: Male
  • $("div.content:dd").hide();
  • SMF Version: None
  • SP Version: None
  • Elkarte Version: None
  • EhPortal Version: None
Re: [SMF 2.0] Allow guests to use the Shoutbox
« Reply #2 on: October 05, 2011, 06:08:12 PM »

Offline Old Fossil

  • Beta Tester
  • *
  • Posts: 796
  • Gender: Male
  • SMF Version: 2.0.4
  • SP Version: 2.3.5
Re: [SMF 2.0] Allow guests to use the Shoutbox
« Reply #3 on: October 05, 2011, 06:35:17 PM »
People may want to think about this.

Is a good way for a shoutbox to be spammed.
Daily backups mean less headaches

Block Set Up

I may be no coding expert but I am willing to help where I can.

I eat Spammers for breakfast

Offline ccbtimewiz

  • Hero Member
  • *****
  • Posts: 2185
  • Gender: Male
  • $("div.content:dd").hide();
  • SMF Version: None
  • SP Version: None
  • Elkarte Version: None
  • EhPortal Version: None
Re: [SMF 2.0] Allow guests to use the Shoutbox
« Reply #4 on: October 05, 2011, 06:45:55 PM »
Well, the shoutbox by default doesn't have a really good anti-spam mechanism in the first place.

I might add my own mechanism when I update this code.

Offline ccbtimewiz

  • Hero Member
  • *****
  • Posts: 2185
  • Gender: Male
  • $("div.content:dd").hide();
  • SMF Version: None
  • SP Version: None
  • Elkarte Version: None
  • EhPortal Version: None
Re: [SMF 2.0] Allow guests to use the Shoutbox
« Reply #5 on: October 05, 2011, 06:54:35 PM »
Also, I made it so each guest has their own random ID when they comment, so you can tell them apart if you have multiple guests.

After performing my instructions in the first post, do this as well..

(note that I now include this in my post)

Open ./Sources/Subs-Portal.php

Find:
Code: [Select]
if (trim(strip_tags(parse_bbc($shout, false), '<img>')) === '')
return false;

Replace with:
Code: [Select]
if (trim(strip_tags(parse_bbc($shout, false), '<img>')) === '')
return false;

if ($user_info['is_guest'])
{
if (!isset($_SESSION['guest_has_shouted']))
{
$_SESSION['guest_has_shouted'] = rand(10, 1000);
$user_info['name'] = $txt['guest'] . $_SESSION['guest_has_shouted'];
$user_info['id'] = 0;
}
else
$user_info['name'] = $txt['guest'] . (!empty($_SESSION['guest_has_shouted']) ? $_SESSION['guest_has_shouted'] : rand(10, 1000));
}

« Last Edit: October 06, 2011, 01:42:20 AM by Veridis Quo »

Offline Shadow Queen

  • Jr. Member
  • **
  • Posts: 62
  • Gender: Female
    • My Kingdom
  • SMF Version: 2 RC5
  • SP Version: 2.3.3
Re: [SMF 2.0] Allow guests to use the Shoutbox
« Reply #6 on: October 06, 2011, 12:55:40 AM »
The screen shoots of this code you made. Look neat.

I have a Q for you. If you have few shout boxer that code will input all them? If you have one shout box hidden from guests and other have guests and members?

I'm so sorry If I get the words in the wrong order. Please forgive me

Offline ccbtimewiz

  • Hero Member
  • *****
  • Posts: 2185
  • Gender: Male
  • $("div.content:dd").hide();
  • SMF Version: None
  • SP Version: None
  • Elkarte Version: None
  • EhPortal Version: None
Re: [SMF 2.0] Allow guests to use the Shoutbox
« Reply #7 on: October 06, 2011, 01:36:26 AM »
All permissions are respected. If a guest cannot view a particular shoutbox, they cannot use it. However, if guests can see the shoutbox, they can use it no matter what other settings you have. If you want to make a read-only shoutbox to guests, then it's best not to use this code adaption.

Offline Shadow Queen

  • Jr. Member
  • **
  • Posts: 62
  • Gender: Female
    • My Kingdom
  • SMF Version: 2 RC5
  • SP Version: 2.3.3
Re: [SMF 2.0] Allow guests to use the Shoutbox
« Reply #8 on: October 06, 2011, 01:52:31 AM »
I'm just making sure. Because I am thinking to use this code on my forum.

I do thank you!

Offline ccbtimewiz

  • Hero Member
  • *****
  • Posts: 2185
  • Gender: Male
  • $("div.content:dd").hide();
  • SMF Version: None
  • SP Version: None
  • Elkarte Version: None
  • EhPortal Version: None
Re: [SMF 2.0] Allow guests to use the Shoutbox
« Reply #9 on: October 06, 2011, 02:00:16 AM »
I can write exceptions for you if you really need to make it so you have a shoutbox visible to guests but they can't use that particular one. Just let me know, it's fairly easy to hardcode in.

I'm open for other block requests or modifications to blocks via PM too if anyone has some ideas, though note that everything I write is mine, and I reserve the right to post it in public or reuse it as I see fit. I might be making an edit to the Who's Online that groups it.

Offline Tarissa

  • Just Registered
  • Posts: 1
  • SMF Version: 2.0.1
  • SP Version: 2.3.4
Re: [SMF 2.0] Allow guests to use the Shoutbox
« Reply #10 on: January 31, 2012, 12:23:37 PM »
I would really, really, like to utilize this function, but it doesn't appear to be compatible with SMF 2.0.2

Is there a way to get a version for the newest SMF?

Offline velorooms

  • Jr. Member
  • **
  • Posts: 83
    • Velorooms
  • SMF Version: 2.0.2
  • SP Version: 2.3.5
Re: [SMF 2.0] Allow guests to use the Shoutbox
« Reply #11 on: March 28, 2012, 10:24:11 AM »
any idea how to do this in 2.3.4

looked at the code and it is completely different
Admin and Owner of Velorooms.com - Using SMF 2.0.3 and Simpleportal 2.3.5

Offline Old Fossil

  • Beta Tester
  • *
  • Posts: 796
  • Gender: Male
  • SMF Version: 2.0.4
  • SP Version: 2.3.5
Re: [SMF 2.0] Allow guests to use the Shoutbox
« Reply #12 on: March 28, 2012, 12:10:38 PM »
any idea how to do this in 2.3.4

looked at the code and it is completely different

Don't you mean 2.3.5?
Daily backups mean less headaches

Block Set Up

I may be no coding expert but I am willing to help where I can.

I eat Spammers for breakfast

Offline MESSIAH

  • Semi Newbie
  • *
  • Posts: 39
  • Gender: Male
    • Forum 4 make money
  • SMF Version: 2.0.2
  • SP Version: 2.3.5
Re: [SMF 2.0] Allow guests to use the Shoutbox
« Reply #13 on: May 15, 2012, 03:37:18 PM »
Yes that would be preety well if any one change this code to 2.3.5 version.

Offline phantomm

  • Translator
  • *
  • Posts: 406
  • Gender: Male
  • Smile, tomorrow will be worse...
    • Polish ElkArte community
  • SMF Version: None
  • Elkarte Version: 1.0.5
Re: [SMF 2.0] Allow guests to use the Shoutbox
« Reply #14 on: May 16, 2012, 06:56:23 AM »
I don't know if I can post this as Package, so here is update for SP 2.3.5 :)

Open: $sourcedir/PortalShoutbox.php

Code: (Find) [Select]
if (!empty($_REQUEST['shout']))
{
checkSession('request');

is_not_guest();
Code: (Replace with) [Select]
if (!empty($_REQUEST['shout']))
{
checkSession('request');

//is_not_guest();

Open: $sourcedir/Subs-Portal.php

Code: (Find) [Select]
function sportal_create_shout($shoutbox, $shout)
{
global $smcFunc, $user_info;
Code: (Replace with) [Select]
function sportal_create_shout($shoutbox, $shout)
{
global $smcFunc, $user_info, $txt;


Code: (Find) [Select]
if (trim(strip_tags(parse_bbc($shout, false), '<img>')) === '')
return false;
Code: (Replace with) [Select]
if (trim(strip_tags(parse_bbc($shout, false), '<img>')) === '')
return false;


if ($user_info['is_guest'])
{
if (!isset($_SESSION['guest_has_shouted']))
{
$_SESSION['guest_has_shouted'] = rand(10, 1000);
$user_info['name'] = $txt['guest'] . $_SESSION['guest_has_shouted'];
$user_info['id'] = 0;
}
else
$user_info['name'] = $txt['guest'] . (!empty($_SESSION['guest_has_shouted']) ? $_SESSION['guest_has_shouted'] : rand(10, 1000));
}



Code: (Find) [Select]
if ($user_info['is_guest'])
return false;
Code: (Replace with) [Select]
//if ($user_info['is_guest'])
//return false;
      

Code: (Find) [Select]
'name' => $row['member_name'],
Code: (Replace with) [Select]
'name' => (!empty($row['member_name']) ? $row['member_name'] : $txt['guest']),


Code: (Find) [Select]
'link' => $row['id_member'] ? ('<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '" title="' . $txt['on'] . ' ' . strip_tags(timeformat($row['log_time'])) . '"' . (!empty($online_color) ? ' style="color: ' . $online_color . ';"' : '') . '>' . $row['member_name'] . '</a>') : $row['member_name'],
Code: (Replace with) [Select]
'link' => $row['id_member'] ? ('<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '" title="' . $txt['on'] . ' ' . strip_tags(timeformat($row['log_time'])) . '"' . (!empty($online_color) ? ' style="color: ' . $online_color . ';"' : '') . '>' . $row['member_name'] . '</a>') : (!empty($row['member_name']) ? $row['member_name'] : $txt['guest']),

Open: $sourcedir/PortalBlocks.php

Code: (Find) [Select]
if (!empty($_POST['new_shout']) && !empty($_POST['submit_shout']) && !empty($_POST['shoutbox_id']) && $_POST['shoutbox_id'] == $shoutbox['id'])
{
checkSession();

is_not_guest();
Code: (Replace with) [Select]
if (!empty($_POST['new_shout']) && !empty($_POST['submit_shout']) && !empty($_POST['shoutbox_id']) && $_POST['shoutbox_id'] == $shoutbox['id'])
{
checkSession();

//is_not_guest();

Open: $themedir/PortalShoutbox.template.php

Code: (Find) [Select]
if ($context['can_shout'])
echo '
<div class="shoutbox_input smalltext">
<input type="text" name="new_shout" id="new_shout_', $shoutbox['id'], '" class="shoutbox_input sp_float_left input_text"', $context['browser']['is_ie'] ? ' onkeypress="if (sp_catch_enter(event)) { sp_submit_shout(' . $shoutbox['id'] . ', \'' . $context['session_var'] . '\', \'' . $context['session_id'] . '\'); return false; }"' : '', ' />
<input type="submit" name="submit_shout" value="', $txt['sp_shoutbox_button'], '" class="sp_float_right button_submit" onclick="sp_submit_shout(', $shoutbox['id'], ', \'', $context['session_var'], '\', \'', $context['session_id'], '\'); return false;" />
</div>';
Code: (Replace with) [Select]
if ($context['can_shout'] || $context['user']['is_guest'])
echo '
<div class="shoutbox_input smalltext">
<input type="text" name="new_shout" id="new_shout_', $shoutbox['id'], '" class="shoutbox_input sp_float_left input_text"', $context['browser']['is_ie'] ? ' onkeypress="if (sp_catch_enter(event)) { sp_submit_shout(' . $shoutbox['id'] . ', \'' . $context['session_var'] . '\', \'' . $context['session_id'] . '\'); return false; }"' : '', ' />
<input type="submit" name="submit_shout" value="', $txt['sp_shoutbox_button'], '" class="sp_float_right button_submit" onclick="sp_submit_shout(', $shoutbox['id'], ', \'', $context['session_var'], '\', \'', $context['session_id'], '\'); return false;" />
</div>';

Offline KnightRaider

  • Semi Newbie
  • *
  • Posts: 40
  • Gender: Male
  • Twitch Rules
    • Interested in South Korean Drama or Japanese Drama check here
  • SMF Version: 2.0.5
  • SP Version: 2.3.5
Re: [SMF 2.0] Allow guests to use the Shoutbox
« Reply #15 on: May 25, 2012, 02:34:26 AM »
Isn't a little bit silly to allow guests to chat in the first place? Cause then you'll get spammers and idiot's flooding the shoutbox? No offense.
Yooo Korean Drama is were it is at now :D

Offline phantomm

  • Translator
  • *
  • Posts: 406
  • Gender: Male
  • Smile, tomorrow will be worse...
    • Polish ElkArte community
  • SMF Version: None
  • Elkarte Version: 1.0.5
Re: [SMF 2.0] Allow guests to use the Shoutbox
« Reply #16 on: May 25, 2012, 03:43:54 AM »
I'm sure that if someone wants to make this edits knows what is he doing :)

But if I remember correctly, there is mod (at SMF Mod Site) for blocking bots before they enter site? Then maybe this can be used as some kind of 'anti-spam'  :E

Offline Cal

  • Semi Newbie
  • *
  • Posts: 15
  • Gender: Female
    • Seiryuu RPG Resources
  • SMF Version: 2.0.2
  • SP Version: 2.3.5
Re: [SMF 2.0] Allow guests to use the Shoutbox
« Reply #17 on: May 25, 2012, 09:37:32 AM »
Isn't a little bit silly to allow guests to chat in the first place? Cause then you'll get spammers and idiot's flooding the shoutbox? No offense.

It depends on what your board is for.  In the RP community, guests expect to be able to interact with a site before they decide to join, so guest shouts are incredibly important.  It's not the best option in every situation, but I think it's up to the admin to make that choice.  :)

Offline velorooms

  • Jr. Member
  • **
  • Posts: 83
    • Velorooms
  • SMF Version: 2.0.2
  • SP Version: 2.3.5
Re: [SMF 2.0] Allow guests to use the Shoutbox
« Reply #18 on: February 04, 2013, 12:46:17 PM »
its something that site owners will or wont use. We are discussing it as we have shoutboxes dedicated to races when they happen, that always have a moderator present so are looking if its a viable option to bring in new members who hopefully then register.

but its not without its pitfalls.

Useful for specific events with a dedicated shoutbox and moderation, total clustermess for unmoderated shoutboxes.
Admin and Owner of Velorooms.com - Using SMF 2.0.3 and Simpleportal 2.3.5

Offline [SiNaN]

  • Mr. SimplePortal
  • Developer
  • *
  • Posts: 6782
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: [SMF 2.0] Allow guests to use the Shoutbox
« Reply #19 on: August 14, 2013, 02:33:03 PM »
Hi
Just reopening the old issue of the shoutbox -I  need help
I need to allow guests to see the shoutbox activity without ability of shouting
By me guests can not see the shoutbox
Any advice is appreciated.
Regards
Ilya

You just need to give permission to guests too (both for the shoutbox and block) and they will be able to see the shoutbox but they won't be able to shout. (like we have here)
And slowly, you come to realize... It's all as it should be...