vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   Minimum posts to download attachments.. (https://vborg.vbsupport.ru/showthread.php?t=52682)

EvilLS1 05-06-2003 10:00 PM

Minimum posts to download attachments..
 
This little hack will make it possible for you to require your users to have a minimum number of posts (which you define in the admin control panel) before they can download attachments.

Requested by TranceMaster and a couple of others in this thread:
https://vborg.vbsupport.ru/showthrea...threadid=48636

Updated: No more red Xs if the "view images" option is set to "yes". Now if "view images" is set to yes, everyone will be able to see the images in the threads, but not download other file types unless they have enough posts.. But if "view images" is set to no, users who do not have the minimum # of posts will still get the "not enough post" error message (even with images)...

Credits: Thanks to Sophocle for his help with this update.

If you downloaded the first version clear your browser cache and download the zip file again.

Screenshots included in the zip.

If you find this hack useful please click install. :)

Boofo 05-07-2003 06:48 AM

Thanks! I'll give this a go. ;)

squawell 05-07-2003 09:47 AM

one question can make this when u post a attach file set user

how many posts can download???can do that?thankz...

Koutaru 05-07-2003 10:00 AM

Nice :) I'm still considering whether to use it or not but I just think I might

TranceMaster 05-07-2003 10:59 AM

excellent man, thank you very much
ill go test it out just now
:)

edit: i was just thinking, would it be possible to only have this hack affect a certain forum.

i run a music production site, with various sub forums.
but the one forum that contains the most attachments is the samples forum.

right now people need 50 posts before they can even view it, would be good to let them view it but not download until they have enough posts.

and having it not effect any other forum would be great.
dunno if thats possible though
let me know
thanks again

TM

shungo 05-07-2003 12:36 PM

thx alot :D !!!

I've searched it ... but without no results... thx again for your job :)

I'm going to translate it for my forum... in franch now.. would you like i post it here ? :)

Shimmy 05-07-2003 03:25 PM

Thanks alot for responding to us...i'll give a try

Edit: it works perfectly on my site...and with vb 2.3.0

Thanks

EvilLS1 05-08-2003 03:20 AM

squawell,
I don't understand what you're asking.


TranceMaster,
Sure, if you only want this to effect a single forum just remove the code that you added earlier to attachment.php..

Then find (in attachment.php):

Code:

$getforuminfo=$DB_site->query_first("SELECT forumid".
                                    iif($postid,',attachmentid ','')."
                                    FROM thread,post
                                    WHERE post.threadid=thread.threadid ".
                                      iif($postid,"AND post.postid='$postid'","AND post.attachmentid='$attachmentid'")."
                                      ");

Below it add:
Code:

// minimum post to view attachments
if ($bbuserinfo[posts] < $minpostattach and $getforuminfo['forumid']==X) {
        eval("standarderror(\"".gettemplate("error_attachmoreposts")."\");");
exit;
}

Now in the code above, replace the red X with the forum ID of the one that you want this to effect.
I haven't tested this but it should work.

When I get some free time I might re-do this so that the minimum # of posts can be set on a forum by forum basis in the CP. So if ya want to be notified about updates just click install.


shungo,
Sure, go ahead and post the French version if you want.

squawell 05-08-2003 09:02 AM

i mean when u start a new topic u can set the post number if

member over that number than he can download if not he cant..

can do this??

Sophocle 05-09-2003 12:01 PM

To avoid the problem of the View Images option, I would suggest those modifications in the hack :

In spite of doing :
Code:

##### In attachment.php find:
require("./global.php");

##### Below add:
// minimum posts to download attachments hack
if ($minpostattach > $bbuserinfo[posts]) {
        eval("standarderror(\"".gettemplate("error_attachmoreposts")."\");");
exit;
}
// end minimum posts to download attachments hack

Just do :
Code:

##### In attachment.php find:
updateuserforum($getforuminfo['forumid']);

##### Just before, add:

// minimum posts to download attachments hack
$extension=strtolower(substr(strrchr($attachmentinfo[filename],"."),1));
if (($minpostattach > $bbuserinfo[posts]) && $minpostattach!=0 && $extension!='gif' && $extension!='jpeg' && $extension!='png') {
        eval("standarderror(\"".gettemplate("error_attachmoreposts")."\");");
exit;
}
// end minimum posts to download attachments hack

And if you are perfectionist, you can also suppress the line :
$extension=strtolower(substr(strrchr($attachmentin fo
which appears just after the headers of the attachment.


All times are GMT. The time now is 11:15 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01262 seconds
  • Memory Usage 1,738KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete