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)

akanevsky 06-25-2006 06:55 PM

I wonder why the "INSTALL" bit never works correctly. If I install such xml, all settings are initially off, regardless of install value.

andrefedalto 07-12-2006 07:59 PM

thanks Andreas for this nice custom usergroup permission howto...

i used to make my usergroup permissions with a plugin in the hook 'admin_usergroup_edit', but i needed 1 column in 'usergroup' table for each permission :( (too bad for lots of new perms)

but now this xml really rocks :)

Mythotical 07-30-2006 06:52 AM

EDIT: Got it fixed

sabret00the 07-30-2006 12:01 PM

how do you check for INT Permissions?

rogersnm 08-08-2006 08:17 AM

So can you just do:
HTML Code:

<?xml version="1.0" encoding="ISO-8859-1"?>
<bitfields product="vbulletin">
        <bitfielddefs>
                <group name="ugp">
                        <group name="myhackpermissions">
                                <bitfield name="canfoo" group="my_hack_permissions"  phrase="can_foo_forum" install="">1</bitfield>
                        </group>
                </group>
        </bitfielddefs>
</bitfields>

And then the query
PHP Code:

ALTER TABLE usergroup ADD myhackpermissions INT10 UNSIGNED DEFAULT '0' NOT NULL 

To add a Yes/No?

harmor19 08-09-2006 09:45 PM

I couldn't get it to work so I made my own function in the hook "global_start".
I kept everything else the same but removed "can_administer".

I had to use this query to add the field to the "administrator" table.
PHP Code:

$db->query_write("ALTER TABLE `" TABLE_PREFIX "administrator` ADD hostingadminperms INT( 10 ) UNSIGNED DEFAULT '0' NOT NULL ;"); 


I put this in global_start
PHP Code:

function can_admin_hosting()
{
  global 
$vbulletin$db;

  
$getuserperms $db->query_read("SELECT * FROM " TABLE_PREFIX "administrator WHERE userid='".$vbulletin->userinfo['userid']."' ");
    
$perms $db->fetch_array($getuserperms);
 
  return 
$perms['hostingadminperms'];



In your admin backend file I just used
PHP Code:

can_admin_hosting(); 


MaryTheG(r)eek 10-21-2006 04:59 AM

Very helpfull topic. Could you please extend it a bit saying me how I can set a default value per bitfield (for all usergroups) ?

I've the following code in bitfield_vbmates.xml
Code:

<?xml version="1.0" encoding="ISO-8859-1"?>
<bitfields product="vbmates">
        <bitfielddefs>
                <group name="ugp">
                        <group name="vbmates">
                                <bitfield name="canuse" group="vbmates_permissions" phrase="vbmates_can_use">1</bitfield>
                <bitfield name="canadd" group="vbmates_permissions" phrase="vbmates_can_add">2</bitfield>
..... and others below..........
                        </group>
                </group>
        </bitfielddefs>
</bitfields>

Then I setup correctly persmissions per user group. Why with the code:

Code:

if(!$permissions['vbmates'] & $vbulletin->bf_ugp['vbmates']['canadd']){
    $vbulletin->url = "vbmates.php?" . $vbulletin->session->vars['sessionurl'] ."";
    eval(print_standard_redirect('vbmates_no_add_profile', true, true));
}

a usergroup can go on while they dont have permission for it? Please note:
1.- I changed bitfield_vbmates.xml after the first product installation
2.- I've also trying to use in this file: <group name="vbmates_permissions"> but no chance.

Ok, I found it. It needed one couple of parenthesis more. Instead of:
if(!$permissions['vbmates'] & $vbulletin->bf_ugp['vbmates']['canadd'])
should be ...
if(!($permissions['vbmates'] & $vbulletin->bf_ugp['vbmates']['canadd']))

mrpaint 10-22-2006 12:46 PM

Hi, can you help me a bit in this problem?

My bitfield_get_direct_links.xml:
HTML Code:

<?xml version="1.0" encoding="ISO-8859-1"?>

<bitfields product="get_direct_links">
        <bitfielddefs>
                <group name="ugp">
                        <group name="get_direct_links_permissions">
                                <bitfield intperm="true" name="get_direct_links_number" group="get_direct_links_permissions" phrase="get_direct_links_number_desc">5</bitfield>
                        </group>
                </group>
        </bitfielddefs>
</bitfields>

In UserGroupt Manager, it work well but in my php code, when I call
PHP Code:

var_dump($vbulletin->bf_ugp); 

I can't find my get_direct_links_permissions. And when I call
PHP Code:

var_dump($permissions['get_direct_links_permissions']); 

It is NULL

Can you help me? Thank you very much!

PS: Sorry for my bad English

Kungfu 11-05-2006 06:37 PM

I have some problems with an int bitfield.

<bitfield intperm="true" name="myhackintset" group="my_hack_permissions" phrase="myhack_int_desc"></bitfield>

Its baiscally like this one, only difference is it installs to all usergroups, including custom usergroups. Well my problem is this, i want to check if a person is in two usergroups, but one of the usergroups bitfield is set to 0. Example, Registered usergroup setting is 0, but Custom usergroup setting is 1. Instead of taking the 1 as the value, i need the 0.

Anyway to do this? Hope thats clear.

timetunnel 11-26-2006 07:31 PM

Hello.

How to change a custom bitfield_xx.xml parameter via vB Options?

For example, as I add new usergroups, I want to update the 'install' or 'ignore' param (e.g. comma-separated value) via ACP vs. editing the file.

Is that possible e.g. putting an ACP variable in the xml file?

Thanks in advance.

Update: Using a variable in the 'xml' file is not necessary but vB requires code revisions in order to update bitfield 'usergroups' via ACP vs. modifying 'bitfield_xx.xml' file. It may be better to work with the 'ignoregroups' feature in usergroups.php combined with vBulletin Options' User Profile Options instead of the 'install' parameter of the 'xml' file since 'ignoregroups' works in v.3.6.3 after installation whereas, it seems that the 'install' parameter of <bitfields> is only recognized during new installations.


All times are GMT. The time now is 11:37 PM.

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.02312 seconds
  • Memory Usage 1,758KB
  • 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
  • (2)bbcode_code_printable
  • (2)bbcode_html_printable
  • (6)bbcode_php_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