The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Limit Attachment Downloads based off Posts!!! Help Please
Does anyone know how to limit downloading of forum attachments based off post count?
|
#2
|
||||
|
||||
You can modify the template attachmentbit.
Code:
<!-- code corrected, see post #5 below --> <if condition="[s]$vbulletin->userinfo['postcount'][/s] >= 50"> <tr> <td class="$bgclass"> <img class="inlineimg" src="$stylevar[imgdir_attach]/$attachment[attachmentextension].gif" alt="<phrase 1="$attachment[attachmentextension]">$vbphrase[file_type_x]</phrase>" width="16" height="16" border="0" style="vertical-align:middle" /> <a href="attachment.php?$session[sessionurl]attachmentid=$attachment[attachmentid]&d=$attachment[dateline]" target="_blank">$attachment[filename]</a> </td> <td class="$bgclass"> $attachment[filesize] </td> <td class="$bgclass" align="center"> $attachment[counter] </td> </tr> <else /> <tr> <td class="$bgclass" colspan="3" align="center">You do not have enough posts to download attachments.</td> </tr> </if> Change the 50 to whatever post count you want it to be. If you want to make it more advanced than that, you should post a mod request. |
#3
|
|||
|
|||
Thank you sir!
--------------- Added [DATE]1237866241[/DATE] at [TIME]1237866241[/TIME] --------------- hey does this work with vb 3.8 because it does not seem to be working for me???? please help --------------- Added [DATE]1237866710[/DATE] at [TIME]1237866710[/TIME] --------------- It's still allowing downloads & i copied your code word for word! |
#4
|
||||
|
||||
Templates should use $bbuserinfo instead of $vbulletin->userinfo. Also, postcount may be the post number at the location - maybe spit it out and see (like this is post #4)
|
#5
|
||||
|
||||
Ah, I just kinda wrote it without thinking. Yeah, I agree $bbuserinfo is a much better way to go about it. I think it would then be...
Code:
<if condition="$bbuserinfo['posts'] >= 10"> <tr> <td class="$bgclass"> <img class="inlineimg" src="$stylevar[imgdir_attach]/$attachment[attachmentextension].gif" alt="<phrase 1="$attachment[attachmentextension]">$vbphrase[file_type_x]</phrase>" width="16" height="16" border="0" style="vertical-align:middle" /> <a href="attachment.php?$session[sessionurl]attachmentid=$attachment[attachmentid]&d=$attachment[dateline]" target="_blank">$attachment[filename]</a> </td> <td class="$bgclass"> $attachment[filesize] </td> <td class="$bgclass" align="center"> $attachment[counter] </td> </tr> <else /> <tr> <td class="$bgclass" colspan="3" align="center">You do not have enough posts to download attachments.</td> </tr> </if> |
#6
|
|||
|
|||
hmmm that doesn't seem to work either, it seems like vbulletin is ignoring the if statements and still letting them download.
|
#7
|
||||
|
||||
Keep in mind that there is such a thing as browser caching, and post caching. When testing this, make sure you're clearing your brower's cache.
How to clear the cache for the page you're viewing For Firefox: hold SHIFT and click the refresh button on the toolbar For Internet Explorer: hold CTRL and click the refresh button on the toolbar |
#8
|
||||
|
||||
I am pretty sure ['posts] won't work if a user has more than 1,000 posts because of the comma. That variable $post['posts'] gets formatted prior to use in the postbit templates. I think you need to write a plugin to get the 'real' unformatted posts to use in a condition.
|
#9
|
|||
|
|||
Ok. I've tried your updated code, Cleared my browsers chache & cookies and It's still not working on the forum. I think Lynne may be right that some of the variables are incorrect.
Thanks. |
#10
|
||||
|
||||
It's not that the variable is wrong, it's just that you can't use it in a condition since it's formatted. You need to write a plugin, maybe using postbit_display_start?, to grab the posts number *before* it gets formatted.
|
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|