vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   dynamically changing vbulletin permissions/bitfields via a plugin (https://vborg.vbsupport.ru/showthread.php?t=212507)

dartho 04-30-2009 06:59 AM

dynamically changing vbulletin permissions/bitfields via a plugin
 
I want to override permissions using a plugin - specifically for viewing attachments. By default, guests can not view attachments. I know I can set this manually, but would like to do so dynamically.

I think this is the bitfield I need to toggle is:
Code:

<bitfields product="vbulletin">
        <bitfielddefs>
                <group name="ugp">
                        <group name="forumpermissions">
                                <bitfield name="cangetattachment"          group="forum_viewing_permissions"  phrase="can_download_attachments"      install="2,5,6,7"      >4096</bitfield>

I've tried creating a plugin on various hooks with the code:
Code:

$userdata->set_bitfield('forumpermissions','cangetattachment',true);
I'm yet to get this working.

the plugin code will have other conditionals (primarily the forum which the post/attachment resides in ), but the short story is I ultimately want to allow viewing of attachments by anyone.

any help appreciated !
Many thanks

Dismounted 04-30-2009 07:07 AM

You can change it at runtime instead (but this may sometimes cause confusion) by modifying the bitfield array in $vbulletin.

dartho 04-30-2009 11:31 AM

Many thanks - in this case the following code seems to work:
Code:

$vbulletin->bf_ugp['forumpermissions']['cangetattachment']=1;


All times are GMT. The time now is 07:13 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.01108 seconds
  • Memory Usage 1,709KB
  • 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
  • (3)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (3)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