Info
- 3 posts
- 2 voices
- Started 2 years ago by thekmen
- Latest reply from thekmen
- This topic is resolved
C*nsor posts but not in specific category
-
- Posted 2 years ago #
I am using the C*nsor posts plugin on bbPress 1.0.1, works perfectly...
However, I want to disable the censor on one forum.the function used in the plugin is:
function censor_post_text($post) { if (!bb_get_option('censor_enable')) {return $post;} $words = bb_get_option('censor_words'); if ($words[0]=='') return $post; foreach ($words as $key => $word) { $words[$key] = '/\b('.preg_quote($word).')\b/i'; } $replace = array(); $numwords = sizeof($words); for($i = 0; $i < $numwords; $i++) { array_push($replace, "****"); } $clean_post = preg_replace($words, $replace, $post); return $clean_post; }anyone know how I would add something like - if not in form id 20 - to the above?
-
- Posted 2 years ago #
The problem is the way the plugin is written, the same filter is used for the title and such.
the post_text filter can also pass the post_id which you can use to lookup the forum the post is in but you'd have to modify more of the plugin to not use the post_id
you can try modifying this
add_filter('post_text', 'censor_post_text');
to
add_filter('post_text', 'censor_post_text',10,2);
so it then passes the post_idThen change this
function censor_post_text($post) {
to this
function censor_post_text($post,$post_id=0) {and then add this after the above
if (!empty($post_id)) {$temp=bb_get_post($post_id); if ($temp->forum_id==20) {return $post;}} -
- Posted 2 years ago #
thanks _ck_ works perfectly...
-
You must log in to post.