![]() |
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. :) |
Thanks! I'll give this a go. ;)
|
one question can make this when u post a attach file set user
how many posts can download???can do that?thankz... |
Nice :) I'm still considering whether to use it or not but I just think I might
|
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 |
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 ? :) |
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 |
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". Code:
// minimum post to view attachments 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. |
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?? |
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: Code:
##### In attachment.php find: $extension=strtolower(substr(strrchr($attachmentin fo which appears just after the headers of the attachment. |
What does this mean?
"To avoid the problem of the View Images option" I mean I'm not sure I understand what that would do if you didn't do it this way. |
Quote:
|
So they will be allowed to see image attachments with your code?
|
Yes :)
|
Then why bother to even install the hack? ;)
|
To limit downloading attachments other than images of course ;)
|
So, if it is a link, they can't view it. But if the image is showing, they can view it instead of seeing a red x. Is that it? ;)
|
Hi :)
This is the French version of this hack, thx alot EvilLS1 :) It works with VBB 2.x.x Kikooo :) Voici la version Fran?aise, compatible avec les versions 2.x.x de VBB. Je l'utilise pour ma part sur la 2.3.0. |
Sophocle,
That is an excellent idea! The only problem that I saw with it is that perhaps some people prefer that users with less than the minimum # of posts not be able to download images.. And even with the "view images" option set to "no", they would still be able to download images that way. But there's an easy solution.. Code:
if ($viewattachedimages==1) { I've tested this and it works. :) I'll update the zip file in the first post. {edit} I just noticed something.. As an added bonus, this hack will also stop people from hot linking images on other sites if you set view images to no and minimum posts > 0. :p |
squawell,
I'm sure that could be done, but its not something that I would want for my forum and at the moment I don't have time to try it...sorry. |
EvilLS1, The red x is still showing for me on attachments that are set to view. I have Slynderdale's "Show Image attachments" hack installed and it doesn't show the image with that, just the red x. I have "View image attachments" turned of in the Admin CP but with Slynderdale's hack, you can set it to view an attachment or a link. How would I get this to work with that?
|
Ok, I figured out how to do it by putting it in the postbit_attachmentimage template (using Logician's Dynamic Templates hack). In place of the actual image showing, they will see the contents of the error_attachmoreposts template. How can I pull the $minpostattach amount form the postbit_attachmentimage template? Right now, unless I hard code it, it shows nothing for the number.
|
Boofo,
Did you reinstall the updated version of the hack in the zip? I added Sophocle's fix aswell as another improvement which is described a couple of posts above this one. Try re-downloading the zip file in the first post & reinstalling the newer version. Let me know if that fixes it (it should). |
I already installed that before I wrote the last message. The hack for show image attachments is what is messing it up. I like it the way I have it now where is shows the message in place of the image in the post. I just want to be able to have it show the $minpostattach amount in the postbit_attachmentimage without having to hard code it in. If they're not allowed to download attachments, they shouldn't be able to view them either. ;)
|
If you installed the code from Sophocle's post you will still get red Xs for images with the .jpg extension because he forgot to include $extension!='jpg' in his code. I added it in the zip though.
I'm not sure why the $minpostattach isn't working in that template for ya. I gotta hit the sack right now but I'll check it out when I get up. |
The code I installed is from your hack. I help off until you changed yours. ;)
You might want to take a look at The Show images hack. It works with the viewimages set to off. Somehow, I need to add something somewhere that will pull out that number, but I don't know where. ;) |
Quote:
{EDIT} OK, n/m. I know what your saying now.. I'll check out the show images hack. :) |
The "Show Images hack" allows you to show an image in the post when the viewimages is turned off in the Admin CP. That way, you can show an image instead of a link on a post by post basis.
Right now, I have it set up to show the error template in place of the image inside the post. I think if they are not allowed to download attachments, they shouldn't be able to view them either. I accomplished this by doing a conditional in the postbit_attachmentimage template itself. What I can't get to show in the template is the number that is set for the $minpostattach variable. I have to hard code whatever number that is inside the template. I think I need to define that variable inside the attachment.php. |
Boofo,
I just realized that you were talking about a completely different hack. At first when you said "show images hack" I thought you were referring to the post by Sophocle in the first page of this thread. I'm an idiot! lol |
No, you're not an idiot. I was not explaining myself very well, I guess. ;)
All I really need now is to get the $minpostattach variable ammount to show up in the postbit_attachmentimage template. |
Boofo, I think you could code it very simply with the Advandced Templates Hack of Logician.
EvilS1, thank you very much for having updated the hack. You've perfectly completed my proposition ;) I've translated your hack for french people (http://www.vbulletin-fr.com) and will change the hack in order to integrate new modifications. I respected all copyright restrictions. I'll send the complete adress to the hack when the translation is completed. |
I did use the Advanced Templates Hack by Logician. Everything is working fine except the $minpostattach variable doesn't show up in the postbit_attachmentimage template. ;)
|
Boofo,
To make the $minpostattach variable work in the postbit_attachmentimage template: In admin/functions.php find: Code:
// global options Code:
// global options Sophocle, Thanks again for you addition to the hack. Works great. ;) |
Bingo! That was what I needed. I guess I should have known that, huh? Dohh!!! ;)
Thank you very much, sir. ;) |
y/w. Glad I could help. :)
|
Here is the thread for the updated french translation of the hack made for www.vbulletin-fr.com :
http://www.vbulletin-fr.com/forum/sh...?threadid=2551 You can also find the translation in the attached file. |
Will this work for vb3 gamma? I need this bad. Miss it from when i had vb2 :(
|
ukbill69,
No, vb2 hacks will not work with vb3. Alot of vb2 hacks will be ported over when the final version of VB3 is released though. |
Thanks for your reply.
|
Anyone could convert this hack for vb3?
Thank's a lot.... |
All times are GMT. The time now is 06:42 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 | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|