Notifications
Clear all

Script Modify Comment Content before saving it

5 Posts
2 Users
0 Reactions
327 Views
MarcelDerAdmin
Posts: 36
Topic starter
(@marcelderadmin)
Trusted Member
Joined: 5 years ago

Hi i wanna try to modify the comment before its being saved. i wanna check for spam my own way with my own custom code, tho i cant get it  to do anything apparently

 

i tried the following but its just not working so i assume there is maybe a custom hook for wpforo?

function preprocess_comment_remove_url( $commentdata ) {
    $commentdata["comment_content"] = "not a test";
    return $commentdata;
}



// Hook our function to WordPress the_content filter
add_filter( 'preprocess_comment' , 'preprocess_comment_remove_url', 10, 1);
4 Replies
Robert
Posts: 10590
Admin
(@robert)
Support Team
Joined: 9 years ago

Hi @marcelderadmin,

wpForo Spam Control already removes all URLs of new registered users if you configure it. Just set the value of "Min number of posts to be able to post links" option for example 5 to remove all external URLs from posts of users who don't have at least 5 approved posts yet. The option is located in wpForo > Settings > Spam Control admin page.

Reply
3 Replies
MarcelDerAdmin
(@marcelderadmin)
Joined: 5 years ago

Trusted Member
Posts: 36

@robert thx for the info but its not only that. i want to make a custom plugin because im sick of spending money for small stuff and i dont want to filter urls only but mainly for other specific messages or words.

 

i wanna block the entire russian alphabet etc and dont want to install a plugin. i know how to code but its hard getting started with wordpress because there isnt a great tutorial available thats not showing how to install another plugin

Reply
Robert
Admin
(@robert)
Joined: 9 years ago

Support Team
Posts: 10590

@marcelderadmin,

You could also use Forums Censure PRO plugin. You can insert any word or character in the user blocking list of this plugin. Once some word or character is found it'll block the user or just set the post as under moderation:

https://gvectors.com/product/forums-censure-pro/

Reply
MarcelDerAdmin
(@marcelderadmin)
Joined: 5 years ago

Trusted Member
Posts: 36

@robert Hi thanks for the info but as stated above im trying to spend tons of money for basic features and while i can understand that you guys try to make money which is totally understandable its not a option for me and i decided to make a forum software myself once im done with some other projects but still thank you!

Reply