![]() |
Allow URLs in posts only after a minimum number of posts (to reduce spam)
Allow URLs in posts only after a minimum number of posts (to reduce spam)
I did this mini-hack to reduce the amount of spammers and newbie mistakes at my forums. Most of the newbies at my site do not read the rules, and in their enthusiasm post links back to their own sites or forums. I have made it so that members need to have a minimum number of posts before they can post URLs to website. On my site I've set it to 15, but you can set it to whatever you like. If a member has less than the required amount of posts, when they try to post they get redirected to an error page, telling them that they need to have a minimum amount of posts before they can post links in their post. In my error message, I also tell them to post links to their own site only in our forum designated for website links. Update: Version 1.1 - fixed up a loophole. Just replace the old code with the new. Version 2.0 - tidied up the code, added code to editpost.php, made it easier to change the variable Anyway, installation is a breeze. The installation text file is below: |
<u>Screenshot</u>
This is a screenshot of the error message that the member will be redirected to if he or she has less that the minimum number of posts required and tries to post a message that has a website address or URL in it. Remember, you can customize this error message to suit your site. |
looks good erwin... :)
a little tip, when variable values are involved like that? try always to add them into global.php. so your $allowurl should be identified to something like that: Code:
// allow url's after xx posts let me know what you think. |
True, but in the case of this mini-hack, editing 2 files is easier than 3 files for newbies. :) Not worth making the $allowurl variable global if it's only going to be used in those 2 files, plus I don't want newbies mucking around in global.php just in case. But yeah, people can do that if they wish.
|
Simple yet usefull Hack Erwin, thanks for sharing, I'll probably install this one :)
|
Erwin,
This is a fantasic but simple idea, I get a lot of spam and this would help to reduce that. Thanks |
Thanks guys. :) If you like it and use it, please click install, so that I can keep track of how many installers there are, and also in case I update the hack and need to inform the installers. :)
|
Great hack Erwin!
It's a shame that after seeing the error message, a spammer would probably just type in the URL with a space after the "www." or something similar. :( |
As a addon to what TECK said you could also place a unset(); just above it.
|
Quote:
Yeah, at least if they bypass this hack by adding spaces and such the URL won't be clickable. And we will know then that they are a "true spammer" rather than an unknowing newbie. |
Quote:
|
Can you make it so it only works with the registered user group because my admins, mods, and super mods can post any. :(
Dark Shogun |
Wow...
Nice little hack Erwin:D Satan |
Quote:
Easy fix... In BOTH newthread.php AND newreply.php, find: PHP Code:
PHP Code:
Again, I am very surprised that you have staff members who do not reach the minimum post count for your site. :) |
hey erwin cna u make it for ".com" also. and if u can a lot of ppl use the vbcode [url ] is there a way to make it into that also.
i am just asking if u can. if not its still a great hack. |
Quote:
If they use the vcode [url ] this hack will block it automatically. |
Quote:
Dark Shogun |
Update: Version 1.1 - fixed up a loophole. Just replace the old code with the new.
I've discovered a couple of loopholes that new users can use to post URLs. I've replaced the old code with a new piece of code that closes up these loopholes. Please download the 1.1 version of the text file, and replace the old code with the new. :) |
Is step one and two the same for a reason?
|
Step One is for newthread.php, Step Two is for newreply.php - different files, but same code to find and add.
|
works great, thanks a lot.
|
Awesome this should be quite easy to modify for a specific forum :D
Thanks Erwin :D Regards - miSt |
The Hack is bugy, if a guy want promotion his homepage
he can make a post like subject my page text: rotten.com and post it after it, he can edit his own post and make rotten.com to www.rotten.com, after submit it the link will be active with "[URL]"... |
Helped myself :).
I think you should add this to editpost.php under the same "find string" how newreply.php $allowurl = 15; if($bbuserinfo[posts] < $allowurl and strstr($message,'[url')) { eval("standarderror(\"".gettemplate("error_nourlal lowed")."\");"); exit; } if($bbuserinfo[posts] < $allowurl and strstr($message,'[URL')) { eval("standarderror(\"".gettemplate("error_nourlal lowed")."\");"); exit; } $allowurl = 15; if($bbuserinfo[posts] < $allowurl and strstr($message,'www')) { eval("standarderror(\"".gettemplate("error_nourlal lowed")."\");"); exit; } if($bbuserinfo[posts] < $allowurl and strstr($message,'www')) { eval("standarderror(\"".gettemplate("error_nourlal lowed")."\");"); exit; } which blocks now also to edit the www or URL-BBcode to the url. |
Nice hack.
I would recommend you use the stristr function instead of the strstr function. |
You might also want to "streamline" it into one condition:
PHP Code:
|
i was wondering if it is possiable to disable live linking i mean users be able to post a link but it should not be clickable.
i dont mind people posting links as long as they not clickable other should be able to see it then if they wanna visit that site then they have to type it in thier browser. Just like my signature below |
Update Version 2.0 - Tidied up the code, added to editpost.php, made it easier to change the variable
Just download the text file and replace the old code. I've made it so you can change the minimum post easily in the phpinclude template. |
Quote:
|
Thanks for the quick reply but i am still lost i am new to php coding
any further help would be most welcome |
great hack erwin
thank you |
I am sorry to say I am at a total loss on this one. It is weird...If I add the code to the two of the files (editpost.php and newreply.php)...they all produce...
Parse error: parse error in /home/avsforum/www.avsforum.com/avs-vb/editpost.php on line 307 ...or the like. In this case, line 307 is the last line in the file. This is a great hack and needed on AVS Forum...I just can not seem to figure out why this is happening. ver 2.2.8 Help? |
NOTE....In your instructions for editpost.php and newreply.php you have forgot your closing } for the IF statment. Thus the above error.
|
You're right... how embarassing... :) It's been almost a year as well... thanks - text file fixed.
|
Yes...A year...LOL. Your hacks still live on! ;) This is a great one in my book.
Thanks for all you do. |
I installed it today on 2.3.0 and it doesn't work at all there....
|
[high]* jdmuniverse jumps up and hits the install button with a bat :)[/high]
|
Does this hack also disable urls in the signatures/pms?
|
Quote:
|
Works Great! I Installed on 2.3.5
|
All times are GMT. The time now is 04:43 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|