vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3 Articles (https://vborg.vbsupport.ru/forumdisplay.php?f=187)
-   -   HowTo Create Custom Usergroup Permissions (https://vborg.vbsupport.ru/showthread.php?t=82844)

Andreas 10-29-2005 08:51 PM

Quote:

Originally Posted by Andreas in First Post
The value of <bitfield> is the decimal value of the bit (eg. 1 for the first, 2 for the second, 4 for the third, and so on).

So ... ?

akanevsky 10-29-2005 08:59 PM

Ah, I didn't see that :(

Alan @ CIT 11-10-2005 09:22 AM

I have a usergroup xml file with 3 bitfield options. How can I get them to be "Yes" by default when the product is installed?

At the moment, I've set the database column default to 7, then rebuild the bitfields, which makes them all appear as "Yes" when you edit a usergroup, but you need to go into each usergorup and click "Save" to make them take effect.

If you don't, they are still set as "No" in the forum, despite Usergroup Manager saying they are yes.

Any ideas?

Chris M 11-10-2005 09:33 AM

You can either run a manual query to update the bitfield values or you will have to save each Usergroup - There is no way to set it to a default value for existing usergroups since the datastore will not contain the values for the new settings ;)

Chris

Alan @ CIT 11-10-2005 09:39 AM

Dang, I was afraid of that. Cool, thanks Chris :)

sabret00the 11-18-2005 12:38 PM

thanks, very useful.

deathemperor 11-28-2005 04:09 AM

I found that the product attribute of the <bitfields> on vb3.5.0 is not case sensitive while 3.5.1 is

Mr Blunt 12-11-2005 12:56 PM

Quote:

Originally Posted by Andreas
Untested, but

PHP Code:

 // Rebuild Bitfields
require_once(DIR '/includes/class_bitfield_builder.php');
vB_Bitfield_Builder::save($db);
$myobj =& vB_Bitfield_Builder::init();

$groupinfo = array();

for (
$x 1$x 9$x++)
{
    
$groupinfo["$x"]['mypermissions'] = 0;
}

foreach (
$myobj->data['ugp']['mypermissions'] AS $permtitle => $permvalue)
{
    if (empty(
$permvalue['group']))
    {
        continue;
    }

    if (!empty(
$permvalue['install']))
    {
        foreach (
$permvalue['install'] AS $gid)
        {
            
$groupinfo["$gid"]['mypermission'] += $permvalue['value'];
        }
    }
}

foreach (
$groupinfo AS $usergroupid => $permissions)
{
    
$db->query_write("UPDATE " TABLE_PREFIX "usergroup SET mypermissions=$permissions[mypermissions] WHERE usergroupid=$usergroupid");
}
build_forum_permissions(); 


Did this become broken in vb351 or vb352? For my hack, this code doesn't seem to allow the default install groups to be set during installation anymore (someone complained after installing it on vb3.5.2, which is when I tried the install/uninstall code again on my own test forum).

I spent the last 8 hours clicking around and found Andreas had a problem with his signature hack when vb351 came out, but since I didn't see the previous version, I don't know what he did to fix.

Sorry if this was answered elsewhere.

Andreas 12-11-2005 01:26 PM

Yep, that does not work any longer for 3.5.1+ as the bitfield builder ignores bitfields for non-active products.
You must adjust it a bit to just use the XMLReader.

Mr Blunt 12-11-2005 11:43 PM

Quote:

Originally Posted by Andreas
Yep, that does not work any longer for 3.5.1+ as the bitfield builder ignores bitfields for non-active products.
You must adjust it a bit to just use the XMLReader.

Sigh, 12 hours of studying vb code and I haven't made any progress.

For the record, I gave up and moved the code to a seperate admin file and call it after installation.


All times are GMT. The time now is 04:14 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.02105 seconds
  • Memory Usage 1,746KB
  • 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
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete