PDA

View Full Version : Rule to prevent users with less than X posts to post URLs


MaXimus
05-13-2013, 10:50 AM
I have vBulletin 3.8.7

how can I create a rule that only members with above 30 posts may post links?

I don't want knew people to register just to post spammy links

nerbert
05-13-2013, 11:23 AM
Give this plugin a try:

Product: vBulletn

Hook Location: postbit_display_complete


if($post['posts'] < 30)
{
$post['message'] = preg_replace("/\[url[\s\S]*?\/url\]/i", "LINK REMOVED", $post['message']);
}


It should remove any links if post count is less than 30


EDIT: This won't display properly in the php code box. It breaks to a new line after "?". Just be sure when you copy it to the admin CP there is no line break there and no spaces

MaXimus
05-13-2013, 06:13 PM
Give this plugin a try:

Product: vBulletn

Hook Location: postbit_display_complete


if($post['posts'] < 30)
{
$post['message'] = preg_replace("/\[url[\s\S]*?\/url\]/i", "LINK REMOVED", $post['message']);
}


It should remove any links if post count is less than 30


EDIT: This won't display properly in the php code box. It breaks to a new line after "?". Just be sure when you copy it to the admin CP there is no line break there and no spaces

can u give me step by step instructions where to paste this?

admin cp then?

nerbert
05-13-2013, 06:22 PM
Go to Plugins & Products > Add New Plugin

Product: vBulletin

Hook Location: postbit_display_complete

Title : Kill links

Exectution Order: 5

Plugin PHP Code:


if($post['posts'] < 30)
{
$post['message'] = preg_replace("/\[url[\s\S]*?\/url\]/i", "LINK REMOVED", $post['message']);
}



Plugin is active: NO

Save and Reload

Now go find a post by a newby, change Plugin is active to YES and refresh the page with the newby post and see if it works and doesn't generate any errors. If there's an error turn the plugin back off and post here, I'll try to help.

MaXimus
05-14-2013, 12:06 PM
Go to Plugins & Products > Add New Plugin

Product: vBulletin

Hook Location: postbit_display_complete

Title : Kill links

Exectution Order: 5

Plugin PHP Code:


if($post['posts'] < 30)
{
$post['message'] = preg_replace("/\[url[\s\S]*?\/url\]/i", "LINK REMOVED", $post['message']);
}



Plugin is active: NO

Save and Reload

Now go find a post by a newby, change Plugin is active to YES and refresh the page with the newby post and see if it works and doesn't generate any errors. If there's an error turn the plugin back off and post here, I'll try to help.

no error message bro but didn't work:

http://forums.tweakarena.com/showthread.php?p=136#post136


https://vborg.vbsupport.ru/external/2013/05/38.png

nerbert
05-14-2013, 01:52 PM
Duh! It should be looking for html instead of bb code. Try this:


if($post['posts'] < 30)
{
$post['message'] = preg_replace("/<a[\s\S]*?\/a>/i", "LINK REMOVED", $post['message']);
}


--------------- Added 1368545302 at 1368545302 ---------------

Note the Warning at the top in your screen shot. Go to your Options and find Plugin/Hook System and turn it on

MaXimus
05-14-2013, 03:15 PM
Duh! It should be looking for html instead of bb code. Try this:


if($post['posts'] < 30)
{
$post['message'] = preg_replace("/<a[\s\S]*?\/a>/i", "LINK REMOVED", $post['message']);
}


--------------- Added 1368545302 at 1368545302 ---------------

Note the Warning at the top in your screen shot. Go to your Options and find Plugin/Hook System and turn it on

Thanks a looooooooot bro!! that worked like a charm after I enabled plugins globally :)

cheers!