mme42
01-26-2010, 03:56 PM
I have a simple str_replace plug to replace certain words/urls with a message in posts. The plug-in is fine. But, the problem is that it also fires in private messages and usernotes because they use the postbit_display_complete also. But, I only want to use this plug in posts.
I've tried other hook locations (from looking that hooks available in debug mode) but I can't find another one that works, and it seems like postbit_display_complete would be correct anyway. Here is the plug for reference:
$filterthese = array('word1', 'word2', 'word3', 'word4');
$replacement = 'censored';
if (!in_array($forum['forumid'], array(1,2,3,4))) $this->post['message'] = str_ireplace($filterthese, $replacement, $this->post['message']);
Is there a different hook that I could use? Or is there a different way to do this so that the plug-in only replaces text in posts and not anywhere else?
Thanks. :D
I've tried other hook locations (from looking that hooks available in debug mode) but I can't find another one that works, and it seems like postbit_display_complete would be correct anyway. Here is the plug for reference:
$filterthese = array('word1', 'word2', 'word3', 'word4');
$replacement = 'censored';
if (!in_array($forum['forumid'], array(1,2,3,4))) $this->post['message'] = str_ireplace($filterthese, $replacement, $this->post['message']);
Is there a different hook that I could use? Or is there a different way to do this so that the plug-in only replaces text in posts and not anywhere else?
Thanks. :D