PDA

View Full Version : Need help modifying attachment permissions


MultiSync77F
02-06-2011, 08:39 PM
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:

if (is_member_of($vbulletin->userinfo, 5, 6, 7))
$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?