vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Changing attachment upload permissions on the fly? (https://vborg.vbsupport.ru/showthread.php?t=207032)

JamesAB 03-01-2009 08:00 PM

Changing attachment upload permissions on the fly?
 
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:

PHP Code:

if (in_array($foruminfo['forumid'], array(71522)))
{
     
$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. :)


All times are GMT. The time now is 02:31 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.03421 seconds
  • Memory Usage 1,721KB
  • 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
  • (6)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