View Full Version : Changing attachment upload permissions on the fly?
JamesAB
03-01-2009, 08:00 PM
Is it possible to use a hook to change a user's attachment permissions on the fly?
Basically, I'd like to have two different file size limits on uploading .ZIP files.
If a member is in usergroup x,y or z it would use the forum's default.
If a member is in usergroup a,b or c I would like to change the maximum allowed filesize to something different.
Any suggestions on how I can do this would be appreciated.
Thanks,
James
Lynne
03-01-2009, 08:17 PM
I believe you can change it per usergroup in Attachments > Attachment Permissions
JamesAB
03-01-2009, 08:55 PM
Thanks. You are correct Lynne.
I feel like an idiot. :o
I'd still like to know if this is possible, so I could change upload limits based on which forum is being posted on.
For example, can I let forum A use the default settings and then change the maximum allowed filesize to something different on forum B?
Thanks again,
James
Lynne
03-01-2009, 09:35 PM
I would guess you can write a plugin to do. First you need to find where in the code this is checked (somewhere in class_upload.php?) and look for which plugin you would use that is located before that check. Also, you need to note the variable name. Then writing the plugin should be pretty straightforward.
JamesAB
03-02-2009, 05:17 PM
Unless I'm missing something, this wasn't as difficult as I thought it would be. :)
I added this in a newattachment_start hook:
if (in_array($foruminfo['forumid'], array(7, 15, 22)))
{
$vbulletin->userinfo['attachmentpermissions']['rar']['size'] = 104857600;
$vbulletin->userinfo['attachmentpermissions']['zip']['size'] = 104857600;
}
This seems to work to override the forum default permissions on .RAR & .ZIP files.
Thanks,
James
Lynne
03-02-2009, 05:43 PM
Sometimes it's amazing how simple it can be. And other times it's amazing how hard it is. :)
vBulletin® v3.8.12 by vBS, Copyright ©2000-2024, vBulletin Solutions Inc.