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)

Kirk Y 08-23-2005 11:42 PM

Quote:

Originally Posted by KirbyDE
Yes. I've read this Post you made and found it very amusing :)

Ha ha... well I'm glad I can find ways to amuse you. I was just curious... not like you see v3 Arcade in the Navbar or anything, eh?

jesus likes pie 10-07-2005 12:51 AM

Can you make a specific user be allowed to use html?

If so, how?

EDIT: hey, I have an idea, could I make a secondary usergroup that has it enabled, put the desired user as secondary usergroup for it, but have him display as his primary one?

Will that work? If not.....what will?

sorry guys...wrong thread. rofl...

Andreas 10-07-2005 12:52 AM

Yes it will work, if the primary usergroup does allow membergroups.

Reaktor7 10-07-2005 02:03 AM

i am pretty sure there is a plugin for that which may make things a little neater....

harmor19 10-22-2005 01:46 PM

I got the same error someone else got about the escape strings

In the product I have I put that "Rebuild Bitfields" script Andreas wrote

Code:

<plugins>
                <plugin active="1">
                        <title>Testimonialss</title>
                        <phpcode><![CDATA[ // 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();]]></phpcode>
                </plugin>
        </plugins>

I don't know if I plugins can be used without a hook so maybe that's my problem.

Here's my bitfield
Code:

<?xml version="1.0" encoding="ISO-8859-1"?>
<bitfields product="testimonials">
        <bitfielddefs>
                <group name="ugp">
                        <group name="testimonials">
                        <bitfield name="can_mod_testimonials" group="testimonials_permissions" phrase="can_mod_testimonials" install="">1</bitfield>
                        </group>
                </group>
        </bitfielddefs>
</bitfields>


Andreas 10-22-2005 08:00 PM

You must use the Code as Product install Code.

harmor19 10-22-2005 09:34 PM

1 Attachment(s)
It was in a product but removed the plugin tags around it.

when I upload the product I get this error

Code:

### INSERT QUERY GENERATED BY fetch_query_sql() ###
INSERT INTO plugin
        (`active`, `value`, `product`)
VALUES
        ('1', '\r\n                ', 'testimonials-Harmor19');

MySQL Error  : Unknown column 'value' in 'field list'


Andreas 10-22-2005 11:01 PM

1 Attachment(s)
Did you create the product XML by hand?
There is almost no chance the product manager would generate smth. like that ...

harmor19 10-22-2005 11:19 PM

Well I took references frommy other product xml's.

Thanks.

Now I'm on to update my testimonials mod.

akanevsky 10-28-2005 09:32 PM

Hi, this is the XML I'm trying to use:

Code:

<?xml version="1.0" encoding="ISO-8859-1"?>
<bitfields product="vBulletin">
        <bitfielddefs>
                <group name="ugp">
                        <group name="charlimit">
                                <bitfield name="isexempt" group="post_thread_permissions"  phrase="exempt_from_char_limit"></bitfield>
                        </group>
                </group>
        </bitfielddefs>
</bitfields>

On save, it says "Warning: mysql_real_escape_string() expects parameter 1 to be string, array given in /includes/class_core.php on line 635... why?

harmor19 10-28-2005 09:36 PM

download the xml's Andreas did for me and look off of those.

akanevsky 10-28-2005 09:39 PM

I don't see any difference other than the group used, and I don't think that's what causes the problem.

Ok, figured that I needed to rebuild bitfields.. But it still does not save.

Andreas 10-28-2005 09:56 PM

vbulletin, NOT vBulletin - better yet use your own product id.

akanevsky 10-28-2005 10:06 PM

I changed the product ID to my own. There are no results though.

As I said, after sumbitting the usergroup options, it says "usergroup X saved", but then after I reload the page, the option is back to "off" (as it was originally)... :( My latest XML:

Code:

<?xml version="1.0" encoding="ISO-8859-1"?>
<bitfields product="dv_ugpefcm">
        <bitfielddefs>
                <group name="ugp">
                        <group name="charlimit">
                        <bitfield name="isexempt" group="post_thread_permissions" phrase="exempt_from_char_limit" install="">0</bitfield>
                        </group>
                </group>
        </bitfielddefs>
</bitfields>


Andreas 10-28-2005 10:17 PM

Did you rebuild the bitfield cache?

akanevsky 10-28-2005 10:18 PM

Yes. Using the admincp navbar link in debug mode.

Figured: The problem was that I specified invalid decimal bitfield value. Now it is working (after I changed 0 to 1). :)

Mr Blunt 10-29-2005 02:38 PM

I don't think '' and '0' are valid bitfield values.

1st bitfield should have value of 1
2nd should have 2
3rd should have 4
4th should have 8
5th should have 16
and so on....

akanevsky 10-29-2005 03:25 PM

Yes, I already figured that, thanks.
It should be mentioned in the first post though.

Andreas 10-29-2005 07:45 PM

I assumed everybody knows how the binary system works ;)

akanevsky 10-29-2005 08:12 PM

Even if yes, it is not mentioned that XML uses binary data as the values. YOu did not specify what to put between the tags :)

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.

Cheertobi 12-21-2005 12:21 PM

Hi,

I cannot get this work ;(

I made the following bitfield:

Code:

<?xml version="1.0" encoding="ISO-8859-1"?>
<bitfields product="vbulletin">
        <bitfielddefs>
                <group name="ugp">
                        <group name="teampermissions">
                                <bitfield name="caneditteam" group="team_permissions" phrase="can_edit_team" install="">1</bitfield>
                                <bitfield name="candeleteteams" group="team_permissions" phrase="can_delete_teams" install="">2</bitfield>
                        </group>
                </group>
        </bitfielddefs>
</bitfields>

But $permissions['teampermissions'] seems to be empty and $vbulletin->bf_ugp_teampermissions['caneditteam']) or $vbulletin->bf_ugp_teampermissions['candeleteteams']) are always "true", even if they are selected in the admincp or not.

Tobi

Cheertobi 12-22-2005 07:40 PM

Does noone have an idea what is wrong in my coding?!

Andreas 12-23-2005 08:13 PM

Did you rebuild the bitfield cache?

@MrBlunt
Well, as said - just directly use the XMLReader and set your bits accordingly.
Or fake the product being installed and call the bitfield builder.

Cheertobi 12-23-2005 09:44 PM

Quote:

Originally Posted by Andreas
Did you rebuild the bitfield cache?

Yes I did that. Andreas, can we maybe move over to vbhacks-germany? It might be easier for me to explain what I have done and what not work like expected in german?!

Regards,

Tobi

Andreas 12-23-2005 10:30 PM

If you already have a thread there or create on - sure

Delphiprogrammi 01-12-2006 12:22 PM

1 Attachment(s)
hi,

Thanks for your explanation verry usefull.One question through.My permissions show up fine the only thing that annoys me a little is that that little help icon that refuses to shoowup nexto my permissions ? i bet it got something todo with the adminhelp manager you see in debug mode ?

buh i hate XML most of the time i doesn't work for me

HTML Code:

<?xml version="1.0" encoding="iso-8859-1"?>
<bitfields product="myproduct">
<bitfielddefs>
<group name="ugp">
<group name="myproductpermissions">
 <bitfield name="canview" group="myproduct_permissions" phrase="can_view" install="2,5,6,7">1</bitfield>
 <bitfield name="canmanage" group="myproduct_permissions" phrase="can_manage" install="2,5,6,7">2</bitfield>
</group>
</group>
</bitfielddefs>
</bitfields>

can't even choose between yes or no i can change it and vbulletin says options saved successfully but when i goback to check .... (you can guess)the value doesn't change

Code:

"ALTER TABLE " . TABLE_PREFIX . "usergroup ADD myproductpermissions INT(10) UNSIGNED NOT NULL DEFAULT 0";
really hate XML :devious:

CyberRanger 01-17-2006 04:52 PM

posted in wrong thread ...

joefitz 02-07-2006 01:18 AM

Just an FYI, for those interested in having custom forum permissions that correspond with custom usergroup permissions, you may want to check out my hack discussed in the following thread:
Custom Usergroup Forum Permissions

Andreas 02-07-2006 01:29 AM

There is a reason why there is no built-in support for custom forum permissions ;)

vasudeva 04-06-2006 01:43 PM

Quote:

Originally Posted by Andreas
There is a reason why there is no built-in support for custom forum permissions ;)

What is that reason, for those of us new to the game? I'm trying to get my head around expanding vB's permissions system and would appreciate any insights.


All times are GMT. The time now is 11:12 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.01698 seconds
  • Memory Usage 1,845KB
  • 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
  • (7)bbcode_code_printable
  • (1)bbcode_html_printable
  • (1)bbcode_php_printable
  • (6)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)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