vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Need help modifying attachment permissions (https://vborg.vbsupport.ru/showthread.php?t=258462)

MultiSync77F 02-06-2011 08:39 PM

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?

inphoenix 09-05-2011 10:02 PM

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.

kh99 09-05-2011 10:46 PM

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


inphoenix 09-06-2011 12:48 AM

Thanks for your help. I am very new to vBulletin. Would you mind explaining it in more details please?

inphoenix 09-08-2011 04:10 AM

Anyone?

Your help would be appreciated.

kh99 09-08-2011 11:47 AM

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.

inphoenix 09-08-2011 02:10 PM

Thank you so much for helping me out. Much appreciated.

Warriorwithwood 10-03-2012 04:52 AM

Is there any way to adapt this so admins and mods have no file size limitations on attachments?


All times are GMT. The time now is 04:44 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.01445 seconds
  • Memory Usage 1,723KB
  • 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
  • (1)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (8)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete