SimplePortal
Customization => Blocks and Modifications => Topic started by: phantomm on September 24, 2012, 12:35:32 PM
-
Hey,
I have at one site few users that I have to ban from using Shoutbox, but I didn't wanted to create new group (I have them already too much...).
So I made extremely simple bans for SP Shoutbox.
(http://img89.imageshack.us/img89/9096/generalsettingst.png)
(http://img37.imageshack.us/img37/281/myboard.png)
Before editing any file remember to make backup!
Here's what I came up with :D
1. Open ./Themes/default/languages/SPortal.english.php:
?>
$txt['sp_shoutbox_you_are_banned'] = 'You are banned in Shoutbox';
?>
2. Open ./Themes/default/languages/SPortalAdmin.english.php:
?>
$txt['sp_shoutbox_bans_enable'] = 'Enable bans in Shoutbox';
$txt['sp_shoutbox_banned_users'] = 'Banned users';
$txt['sp_shoutbox_banned_users_desc'] = 'Add user ID\'s separated with comma, without spaces';
?>
3. Open ./Themes/default/PortalShoutbox.template.php:
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>';
if ($context['can_shout'] && !empty($modSettings['sp_shoutbox_bans_enable']) && !empty($modSettings['sp_shoutbox_banned_users']) && in_array($user_info['id'], explode(',', ''.$modSettings['sp_shoutbox_banned_users'].'')))
{
echo '
<div class="shoutbox_input smalltext">
<input type="text" name="new_shout" class="shoutbox_input sp_float_left input_text" disabled="disabled" readonly="readonly" value="', $txt['sp_shoutbox_you_are_banned'], '"/>
</div>';
}
elseif ($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>';
}
function template_shoutbox_embed($shoutbox)
{
global $context, $scripturl, $settings, $txt;
function template_shoutbox_embed($shoutbox)
{
global $context, $scripturl, $settings, $txt;
global $user_info, $modSettings;
5. Open ./Sources/PortalAdminMain.php:
array('check', 'sp_resize_images'),
array('check', 'sp_resize_images'),
'',
array('check', 'sp_shoutbox_bans_enable'),
array('text', 'sp_shoutbox_banned_users', 'subtext' => $txt['sp_shoutbox_banned_users_desc']),
and that's it :)
Now you can go to Administration Center » Configuration » General Settings and ban people >:-D
-
It looks great, I'll move the topic to Blocks and Modifications for you. :)
-
I thought that I posted in correct board... Thanks for moving ;)
-
You posted in the correct board, when a modification or block has been reviewed, it'll be moved to this board by a team member. :)
-
ah.. good to know :)
-
I approve this :applause:
-
Nice mod phantomm :)
-
Can you make this as package to download please?
-
I'm going to write real mod for this, because now, when this is only template edits user can use "inspect element" feature available in all browsers to add HTML code and send messages.. Now when I look at this code I think 'How could I even post it here..."