Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 02-06-2011, 08:39 PM
MultiSync77F MultiSync77F is offline
 
Join Date: Mar 2005
Location: United States
Posts: 129
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Need help modifying attachment permissions

Hi,

I have limited space on my shared server so I do not want users attaching many images/attachments to a post. So I have "Attachments Per Post" in the ACP limited to 3 attachments.

I figure if they need more then 3 attachments per post, they can put them all in a ZIP file.

However, because of the way vBulletin works. My Admin account is now limited to 3 attachments per article. My articles usually have multiple diagrams included in them.

I'm not sure why Admins are not exempt from the attachment limit, but they aren't. So I need to figure out how to keep this Attachments Per Post setting at 3, and yet allow my admin account to have multiple attachments.

I have an understand of PHP but I'm not an expert. I've been looking and I believe that I need to modify the newattachment.php file to ignore that Attachments Per Post setting if the current user is in the Admin usergroup.

By playing with this it seems that the only enforcement of this rule is in that file, when the person clicks the "upload" button to upload a new attachment.

If I set the Attachments Per Post to 15, and upload 15 attachments to an article, then reset the Attachments Per Post to 3. The article loads fine even though it has more attachments then are currently allowed. So it appears the only enforcement is when you click that upload button.

Does anyone know how to modify this to exempt the admin usergroup?
Reply With Quote
  #2  
Old 09-05-2011, 10:02 PM
inphoenix inphoenix is offline
 
Join Date: Sep 2011
Posts: 78
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I would like to know this as well. There should be way to expempt Admins or moderators from this limit or set a different limit for them.
Reply With Quote
  #3  
Old 09-05-2011, 10:46 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You could create a plugin using hook location global_bootstrap_init_start and this code:

PHP Code:
if (is_member_of($vbulletin->userinfo567))
    
$vbulletin->options['attachlimit'] = 0
Reply With Quote
  #4  
Old 09-06-2011, 12:48 AM
inphoenix inphoenix is offline
 
Join Date: Sep 2011
Posts: 78
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks for your help. I am very new to vBulletin. Would you mind explaining it in more details please?
Reply With Quote
  #5  
Old 09-08-2011, 04:10 AM
inphoenix inphoenix is offline
 
Join Date: Sep 2011
Posts: 78
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Anyone?

Your help would be appreciated.
Reply With Quote
  #6  
Old 09-08-2011, 11:47 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Sorry, I missed your reply. To create a plugin:

- In the adminCP, click on "Plugins & Products" then "Add New Plugin".

- From the "Hook Location" drop-down menu, choose global_bootstrap_init_start

- Enter a title (something so that in the future you'll remember what this plugin does)

- For "Plugin PHP Code", copy and paste the code I posted above.

- Click the "Yes" radio button next to "Plugin is Active", and press "Save".

If you later want to disable or delete this plugin, you can use the Plugin Manager. Your plugin will be listed in the "Product: vbulletin" section, and you can edit, disable, or delete it from there.
Reply With Quote
Благодарность от:
inphoenix
  #7  
Old 09-08-2011, 02:10 PM
inphoenix inphoenix is offline
 
Join Date: Sep 2011
Posts: 78
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thank you so much for helping me out. Much appreciated.
Reply With Quote
  #8  
Old 10-03-2012, 04:52 AM
Warriorwithwood Warriorwithwood is offline
 
Join Date: Feb 2012
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Is there any way to adapt this so admins and mods have no file size limitations on attachments?
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 09:45 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04237 seconds
  • Memory Usage 2,230KB
  • Queries Executed 11 (?)
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
  • (1)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (8)post_thanks_box
  • (1)post_thanks_box_bit
  • (8)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (8)post_thanks_postbit_info
  • (8)postbit
  • (8)postbit_onlinestatus
  • (8)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_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
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete