Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 03-24-2009, 02:09 AM
blackhatspace blackhatspace is offline
 
Join Date: Mar 2009
Posts: 20
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Limit Attachment Downloads based off Posts!!! Help Please

Does anyone know how to limit downloading of forum attachments based off post count?
Reply With Quote
  #2  
Old 03-24-2009, 02:27 AM
TigerC10's Avatar
TigerC10 TigerC10 is offline
 
Join Date: Apr 2006
Location: Austin, TX
Posts: 616
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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" />&nbsp;<a href="attachment.php?$session[sessionurl]attachmentid=$attachment[attachmentid]&amp;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.
Reply With Quote
  #3  
Old 03-24-2009, 02:29 AM
blackhatspace blackhatspace is offline
 
Join Date: Mar 2009
Posts: 20
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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!
Reply With Quote
  #4  
Old 03-24-2009, 02:53 AM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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)
Reply With Quote
  #5  
Old 03-24-2009, 02:58 AM
TigerC10's Avatar
TigerC10 TigerC10 is offline
 
Join Date: Apr 2006
Location: Austin, TX
Posts: 616
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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" />&nbsp;<a href="attachment.php?$session[sessionurl]attachmentid=$attachment[attachmentid]&amp;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>
Reply With Quote
  #6  
Old 03-24-2009, 02:59 AM
blackhatspace blackhatspace is offline
 
Join Date: Mar 2009
Posts: 20
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Lynne View Post
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)
hmmm that doesn't seem to work either, it seems like vbulletin is ignoring the if statements and still letting them download.
Reply With Quote
  #7  
Old 03-24-2009, 03:04 AM
TigerC10's Avatar
TigerC10 TigerC10 is offline
 
Join Date: Apr 2006
Location: Austin, TX
Posts: 616
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #8  
Old 03-24-2009, 03:22 AM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #9  
Old 03-24-2009, 03:25 AM
blackhatspace blackhatspace is offline
 
Join Date: Mar 2009
Posts: 20
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #10  
Old 03-24-2009, 03:31 AM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 05:52 PM.


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.09098 seconds
  • Memory Usage 2,255KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_code
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete