I am wanting to user Drupal chat on my site but need a moderations list. I've found the stop word list and user stop word list is enabled in the variables but it doesn't do anything. How do I get this moderation list working. Also what is the behavior if someone uses one of the words on the list?

Comments

Hi danielson317,

Which polling method are you using?

Thanks

Howdy,

I am using the ajax method at the moment. I would eventually like to move to the node.js but that's probably a little ways down the road.

danielson317, stop word list is only available for "iFlyChat" polling method at the moment. Thanks.

In that case may I recommend this code snippet to future users who need chat moderation in the ajax system. It's pretty simple but did the job I needed.
paste into .module file around line 720. after: foreach ($messages as $message) {

      // Grab the words form the stop word list. Just a variable. Edit comma separated list in devel/variable
      $stop_word_list = explode(',', variable_get('drupalchat_stop_word_list', ''));
      // Add regex info to each word. Regex insures only standalone words are blocked. So it will block "test"
      //  but not "attest" if the word "test" is in the stop list.
      $stop_word_list = '/([^\w]|^)' . implode('([^\w]|$)/,/([^\w|^])', $stop_word_list) . '([^\w]|$)/';
      $stop_word_list = explode(',', $stop_word_list);
      // Filter the message to replace stop words with "***"
      $message->message = preg_replace($stop_word_list, '$1***$2', $message->message);