PDA

View Full Version : dynamically changing vbulletin permissions/bitfields via a plugin


dartho
04-30-2009, 06:59 AM
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:

<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:
$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:
$vbulletin->bf_ugp['forumpermissions']['cangetattachment']=1;