forked from Frug/AJAX-Chat
-
Notifications
You must be signed in to change notification settings - Fork 0
Mod Wall
Philip Nicolcev edited this page Feb 26, 2014
·
2 revisions
Open lib/class/CustomAJAXChat.php and add the following before the last closing bracket } at the end of the file:
NOTE: If you have already added another custom command, you should add only the case for '/wall' to your existing parseCustomCommands function override.
function parseCustomCommands($text, $textParts) { switch($textParts[0]) { case '/wall': if($this->getUserRole()==AJAX_CHAT_ADMIN || $this->getUserRole() == AJAX_CHAT_MODERATOR) { $text = str_replace('/wall','',$text); $users=$this->getCustomUsers(); // Had to change my Yii call, this may breaks… :/ switch($this->getUserRole()) { // BBCode colors for the roles case AJAX_CHAT_ADMIN: $col="blue"; break; case AJAX_CHAT_MODERATOR: $col="orange"; break; } foreach($users as $id=>$user) { $this->insertChatBotMessage( $this->getPrivateMessageID($id), '[color=red][i]'.$this->getLang("wall").'[/i][/color]|[color='.$col.'][b]'.$this->getUserName().'[/b][/color]: '.$text ); } } else { $this->insertChatBotMessage( $this->getPrivateMessageID(), '/error CommandNotAllowed '.$textParts[0] ); } return true; break; default: return false; } }
Useful to send out maintenance messages:
/wall Installing PHP and Apache update, chat may act funky.
In the logs, it apepars as a message to each seperate user, making it possible to also send this to private channels.
Thanks to Ingwie Phoenix for this mod.