Uutiset:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu
Advertisement:

Working With Shoutbox

Aloittaja Old Lynx, tammikuu 06, 2008, 04:21:07 IP

« edellinen - seuraava »

Old Lynx

Hi guys

I've managed to setup the SMF Shoutbox mod, with awesome help from babjudi and mac3lore (thanks guys)

and Now I want to know how to do a few edits with the Shoutbox:

1) How do I clear the Shoutbox ? (so that it is clean, and all messages are deleted)

2) @ the top of the Shoutbox it says [ SMF Shoutbox ] >> How do I change that to my forum's name ?

I would be very greatful if some kind person can help me with this.

Thanks

Old Lynx


perro88

#2
Lainaus käyttäjältä: Ciwan - tammikuu 06, 2008, 04:21:07 IP
Hi guys

I've managed to setup the SMF Shoutbox mod, with awesome help from babjudi and mac3lore (thanks guys)

and Now I want to know how to do a few edits with the Shoutbox:

1) How do I clear the Shoutbox ? (so that it is  clean, and all messages are deleted)

2) @ the top of the Shoutbox it says [ SMF Shoutbox ] >> How do I change that to my forum's name ?

I would be very greatful if some kind person can help me with this.

Thanks


1) I'm a noob programmer but tested some code(probably not very well implemented  but well that's what I was able to do in half hour :P. well try this
search for on the file sources/sboxDB.php:
  <script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
    function kill() { return confirm("' . $txt['sbox_KillShout'] . '"); }
and add after:
function killall() { return confirm("' . $txt['sbox_KillallShout'] . '"); }
you will need to insert this line on default/languages/sbox.english.php
$txt['sbox_KillallShout'] = 'Do you want to kill all the shouts?';
search on the same sboxDB.php file:
for some like:
case 'kill':   ...........(few lines till)...... break;
then replace all that code for

   case 'kill':
    if  (!empty($_REQUEST['kill']) && ($context['user']['is_admin']) || ($modSettings['sbox_ModsRule'] && count(boardsAllowedTo('moderate_board'))>0)) {
      if(intval($_REQUEST['kill'])!=-1)
  {
   $sql = 'DELETE FROM ' . $db_prefix . 'sbox_content WHERE id=' . intval($_REQUEST['kill']);
        db_query($sql, __FILE__, __LINE__);
   }
else

db_query("DELETE FROM {$db_prefix}sbox_content", __FILE__, __LINE__); 
       
   
    }

    break;

on the same file search for:
if ($context['user']['is_admin']) {
  if ($modSettings['sbox_DoHistory'] == '1') {
    echo "\n";
    if (file_exists($sbox_HistoryFile)) {
      echo '[<a href="' . str_replace($boarddir, $boardurl, $sbox_HistoryFile) . '" target="_blank">' . $txt['sbox_History'] . '</a>]';
      echo ' [<a href="' . $_SERVER['PHP_SELF'] . '?action=clearhist" class="Kill" onClick="return clearHist();">' . $txt['sbox_HistoryClear'] . '</a>] ';
    } else {
      echo '[' . $txt['sbox_HistoryNotFound'] . '] ';
    }
  }

and add after it:
echo '[<a class="Kill" onClick="return killall();" href="' . $_SERVER['PHP_SELF'] . '?action=kill&kill=-1">clear all</a>]';

this will create a small link after clear history with the name  "clear all"(NOTE: The link also will be showed when 0 shouts are on the shoutbox but will work ok if you click :P. this can be changed easely but have to add a unnecessary query or use one query made after the "clear all" link so that should bring more changes). when you click it will show a popup message with that string added before on the languages file. if you click yes it should delete the shouts on the shoutbox :P
                 

Advertisement: