Clear Chatroom text function

Discuss phpwcms here, please do not post support requests, bug reports, or feature requests! Non-phpwcms questions, discussion goes in General Chat!
Post Reply
User avatar
pSouper
Posts: 1552
Joined: Tue 11. Nov 2003, 15:45
Location: London
Contact:

Clear Chatroom text function

Post by pSouper »

Hi Oliver [et al],

Apologies in advance Oliver if this is an unwelcome post - I will delete it if you ask.
----------------------
If like me you would like to clear the chatroom text without running to phpmyadmin then I have a very dirty cheap way to do it.

create a new .php... includes/inc_Lib/admin.EmptyChat.php

Code: Select all

<?PHP
/*************************************************************************************
   Copyright notice
   
   (c) 2002-2003 Oliver Georgi (oliver@phpwcms.de) // All rights reserved.
 
   This script is part of PHPWCMS. The PHPWCMS web content management system is
   free software; you can redistribute it and/or modify it under the terms of
   the GNU General Public License as published by the Free Software Foundation;
   either version 2 of the License, or (at your option) any later version.
  
   The GNU General Public License can be found at http://www.gnu.org/copyleft/gpl.html
   A copy is found in the textfile GPL.txt and important notices to the license 
   from the author is found in LICENSE.txt distributed with these scripts.
  
   This script is distributed in the hope that it will be useful, but WITHOUT ANY 
   WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
   PARTICULAR PURPOSE.  See the GNU General Public License for more details.
 
   This copyright notice MUST APPEAR in all copies of the script!
*************************************************************************************/
?>

<?php
$sql = "DELETE FROM ".DB_PREPEND."phpwcms_chat;";
if($result = mysql_query($sql, $db) or die("error Deleting Chat repository"))
echo "Chat Repository has now been cleared";
?>
then add this line to includes/inc_Lang/Backend/en/lang.inc.php at the end of the //phpwcms.php section...

Code: Select all

$BL['be_subnav_admin_EmptyChat']          = 'Clear Chat Text';
then in phpwcms.php add this new line of code directly after this existing line...
$subnav .= '<tr><td colspan="2"><img src="img/leer.gif" height="5" width="1"></td></tr>'."\n";

Code: Select all

$subnav .= '<tr><td colspan="2"><img src="img/leer.gif" height="5" width="1"></td></tr>'."\n";
$subnav .= subnavtext($BL['be_subnav_admin_EmptyChat'], "phpwcms.php?do=admin&p=12", $p, "12", 0); 
then add this new line of code directly after this existing line...
case 11: //Templates
include_once "./include/inc_tmpl/admin.templates.tmpl.php";
break;

Code: Select all

case 12:	//EmptyChat
include_once "./include/inc_lib/admin.EmptyChat.php";
break;
This works for me but you may want to back up your database first ;)
I can't support this function, accept no liability and will offer no refunds.
a new version with a warning/notification box and nicer varification will follow some day ;)
Post Reply