PDA

View Full Version : Users can not use IMG tag if they have less than 20 posts


Zzed
04-03-2002, 10:00 PM
This hack will prevent new users from posting any images using the UBB IMG
tag until they have 20 posts.

This hack was requested by Remi.

New templates: 1 --> error_noimagesallowed
Modified files: 2 --> newthread.php and newreply.php

################################################## ####################

Create a new template by the name of: error_noimagesallowed

Copy the following information in it:

You do not have enough post count to post images in your signature or in your previous post. Please go back and correct the problem and then continue again. You need a minimum of $posts_needed_for_img to post images.</p>

################################################## ####################

In newthread.php:

Look for:

// check max images
if ($maximages!=0) {
$parsedmessage=bbcodeparse($message,$foruminfo[forumid],$allowsmilie);
if (countchar($parsedmessage,"<img")>$maximages) {
eval("standarderror(\"".gettemplate("error_toomanyimages")."\");");
exit;
}
}

Add the following code directly below it:

$posts_needed_for_img = 20;
if($bbuserinfo[posts] < $posts_needed_for_img) {
if (countchar($parsedmessage,"<img")>0) {
eval("standarderror(\"".gettemplate("error_noimagesallowed")."\");");
exit;
}
}


In newreply.php:

Look for the following code:

// check max images
if ($maximages!=0) {
$parsedmessage=bbcodeparse($message,$forumid,$allo wsmilie);
if (countchar($parsedmessage,"<img")>$maximages) {
eval("standarderror(\"".gettemplate("error_toomanyimages")."\");");
exit;
}
}

Add the following code directly below it:

$posts_needed_for_img = 20;
if($bbuserinfo[posts] < $posts_needed_for_img) {
if (countchar($parsedmessage,"<img")>0) {
eval("standarderror(\"".gettemplate("error_noimagesallowed")."\");");
exit;
}
}


You are done. :)

Erwin
04-04-2002, 10:23 AM
Works fine! Thanks a lot! I was needing this!

Admin
04-04-2002, 10:24 AM
I'd replace the [img] tag with "I am a fool", but that's just me. ;) Good work.

E
04-04-2002, 10:26 AM
^^LMAO

Remi
04-04-2002, 10:35 AM
Zzed

YOU are GREAT https://vborg.vbsupport.ru/external/2011/01/19.gif https://vborg.vbsupport.ru/external/2011/01/19.gif

Thank you very much, this is wounderfurll :D

MrLister
04-04-2002, 01:31 PM
Thanks for the hack. Great job on it!

Zzed
04-04-2002, 02:42 PM
Thank you guys for all the kind words. :)

Psychdrone
04-04-2002, 05:30 PM
I think I am sure, but what would you have to change ezactly to make it count for other VbTags??

Erwin
04-04-2002, 08:52 PM
One big problem - it doesn't allow users to post normal smilies too.

Any way around this?

Zzed
04-04-2002, 09:03 PM
Sorry. :( I'll work on it.

Erwin
04-04-2002, 09:07 PM
Thanks!

Admin
04-05-2002, 05:36 AM
You don't need to check the parsed message for [img] code, you can do that right in the source:
$posts_needed_for_img = 20;
if($bbuserinfo[posts] < $posts_needed_for_img and strstr($message, '[img]')) {
eval("standarderror(\"".gettemplate("error_noimagesallowed")."\");");
exit;
}

Zzed
04-05-2002, 05:55 AM
Perfect. :)

But I would recommend using stristr() instead. ;)

Thanks FireFly. :)

Admin
04-05-2002, 06:00 AM
Originally posted by Zzed
But I would recommend using stristr() instead. ;)
Yes that makes sense. :)

Erwin
04-05-2002, 06:03 AM
Firefly, you're right.

It works like a charm. The master has done it again.

:D