vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   Style Permissions (https://vborg.vbsupport.ru/showthread.php?t=68045)

noonespecial 08-06-2004 09:41 AM

Style Permissions
 
I wanna make it so that certain styles can only be used by members of a certain group. Any suggestions?

Colin F 08-06-2004 10:31 AM

Quote:

Originally Posted by noonespecial
I wanna make it so that certain styles can only be used by members of a certain group. Any suggestions?

What do you want to do exactly?

Do you want to restrict access altogether or do you only want to restrict the options shown on the select menu in the usercp?
If you only restrict access to the select menu, users can still see styles by adding &styleid=x to the URL... but it's less complicated as far as I know :)

Colin F 08-06-2004 10:36 AM

You could try something like this:

in global.php, find:
Code:

        // style specified in user profile
        $styleid = $bbuserinfo['styleid'];

REPLACE WITH:

PHP Code:

    if ($bbuserinfo['styleid'] == AND $bbuserinfo['usergroupid'] != Y)
    {
        
$styleid $vboptions['styleid'];
    }
    else
    {
    
// style specified in user profile
    
$styleid $bbuserinfo['styleid'];
    } 

replace X with the styleid and Y with the usergroup that's allowed to view that style.
(untested)

noonespecial 01-03-2005 01:44 PM

Quote:

Originally Posted by Colin F
You could try something like this:

in global.php, find:
Code:

        // style specified in user profile
        $styleid = $bbuserinfo['styleid'];

REPLACE WITH:

PHP Code:

    if ($bbuserinfo['styleid'] == AND $bbuserinfo['usergroupid'] != Y)
    {
        
$styleid $vboptions['styleid'];
    }
    else
    {
    
// style specified in user profile
    
$styleid $bbuserinfo['styleid'];
    } 

replace X with the styleid and Y with the usergroup that's allowed to view that style.
(untested)

I'll give that a try. Basically, I have 6 or 7 styles right now, and I want to add a new style that doesn't include advertisements and allow users to purchase that style.

infazteam 01-03-2005 01:57 PM

Kodlar biras karışık sanki ?

Carnage 01-03-2005 11:09 PM

you could look at it from another angle and edit the templates. putting in a conditional to display the ads if the usergroup is not the ad-free usergroup might be easier also that would mean that your paying users wouldn't be limited to just one style to gain their benifits.

noonespecial 01-04-2005 10:19 AM

Quote:

Originally Posted by Carnage-
you could look at it from another angle and edit the templates. putting in a conditional to display the ads if the usergroup is not the ad-free usergroup might be easier also that would mean that your paying users wouldn't be limited to just one style to gain their benifits.

that's a great idea! could you help me with what the conditional would look like?

Carnage 01-04-2005 12:04 PM

Code:

<if condition="$bbuserinfo['usergroupid'] != X">Code to display ads</if>
change X to the usergroup id of the group that dosn't display ads you can add multiple groups by doing:

Code:

<if condition="$bbuserinfo['usergroupid'] != X && $bbuserinfo['usergroupid'] != Y">Code to display ads</if>
you can also specify users not to display ads to as well by using $bbuserinfo['userid'] != X

noonespecial 01-05-2005 04:44 AM

Quote:

Originally Posted by Carnage-
Code:

<if condition="$bbuserinfo['usergroupid'] != X">Code to display ads</if>
change X to the usergroup id of the group that dosn't display ads you can add multiple groups by doing:

Code:

<if condition="$bbuserinfo['usergroupid'] != X && $bbuserinfo['usergroupid'] != Y">Code to display ads</if>
you can also specify users not to display ads to as well by using $bbuserinfo['userid'] != X

beautiful, im going to put it into work asap .. hopefully we can generate a litle revenue

warpeditor 03-05-2005 02:00 PM

Quote:

Originally Posted by Colin F
You could try something like this:

in global.php, find:
Code:

        // style specified in user profile
        $styleid = $bbuserinfo['styleid'];

REPLACE WITH:

PHP Code:

    if ($bbuserinfo['styleid'] == AND $bbuserinfo['usergroupid'] != Y)
    {
        
$styleid $vboptions['styleid'];
    }
    else
    {
    
// style specified in user profile
    
$styleid $bbuserinfo['styleid'];
    } 

replace X with the styleid and Y with the usergroup that's allowed to view that style.
(untested)

I got a parse error with this code. All I want to do is give moderators 1 more style to choose. Any ideas?

Marco van Herwaarden 03-05-2005 02:11 PM

You will need to replace the "X" and the "Y" with your styleid's (numbers!!).

warpeditor 03-06-2005 09:19 AM

Quote:

Originally Posted by MarcoH64
You will need to replace the "X" and the "Y" with your styleid's (numbers!!).

Well, of course I did. But I still got an error. Thanks anyway.

Marco van Herwaarden 03-06-2005 11:57 AM

For the rest this code look perfect sane to me.

Could you post the actual code you're using.

warpeditor 03-06-2005 01:19 PM

PHP Code:

if ($bbuserinfo['styleid'] == 23 AND $bbuserinfo['usergroupid'] != 7

$styleid $vboptions['styleid']; 

else 

// style specified in user profile 
$styleid $bbuserinfo['styleid']; 


This is what I did in global.php. I want usergroup id 7 to be able to choose styleid 23. Isn't this the way it supposed to be? But when I do this I got an error saying "Parse error: parse error, unexpected '{' in /home/wherever/global.php on line 266.

Marco van Herwaarden 03-06-2005 06:38 PM

I must be blind or simply too much tired, but i don't see your error.

And which line is line 266?

warpeditor 03-07-2005 10:10 AM

Quote:

Originally Posted by MarcoH64
And which line is line 266?


PHP Code:

if ($bbuserinfo['styleid'] == 23 AND $bbuserinfo['usergroupid'] != 7
{  ----- 
this one is line 266
$styleid 
$vboptions['styleid']; 

else 

// style specified in user profile 
$styleid $bbuserinfo['styleid']; 


hmm... thanks for your help anyway.

Marco van Herwaarden 03-07-2005 10:36 AM

Well i did the same edit myself, and no problem.

Please post again (dohh) with the 5 lines before and after the change.

warpeditor 03-09-2005 12:52 PM

PHP Code:

$userselect false;

// is style in the forum/thread set?
if ($codestyleid)
{
    
// style specified by forum
    
$styleid $codestyleid;
    
$userselect true;
}
else if (
$bbuserinfo['styleid'] > AND ($vboptions['allowchangestyles'] == OR ($bbuserinfo['permissions']['adminpermissions'] & CANCONTROLPANEL)))
{
    if (
$bbuserinfo['styleid'] == 29 AND $bbuserinfo['usergroupid'] != 7
++++{ 
++++++++
$styleid $vboptions['styleid']; 
++++} 
++++else 
++++{ 
++++
// style specified in user profile 
++++$styleid $bbuserinfo['styleid']; 
++++} 
  
}
else
{
    
// no style specified - use default
    
$styleid $vboptions['styleid'];


This is how it looks.

Marco van Herwaarden 03-09-2005 03:23 PM

Try:
PHP Code:

$userselect false

// is style in the forum/thread set? 
if ($codestyleid

    
// style specified by forum 
    
$styleid $codestyleid
    
$userselect true

else
{
    if (
$bbuserinfo['styleid'] > AND ($vboptions['allowchangestyles'] == OR ($bbuserinfo['permissions']['adminpermissions'] & CANCONTROLPANEL))) 
    { 
        if (
$bbuserinfo['styleid'] == 29 AND $bbuserinfo['usergroupid'] != 7
            { 
                
$styleid $vboptions['styleid']; 
            } 
            else 
            { 
            
// style specified in user profile 
                
$styleid $bbuserinfo['styleid']; 
            } 
       
    } 
    else 
    { 
        
// no style specified - use default 
        
$styleid $vboptions['styleid']; 
    } 



warpeditor 03-14-2005 04:25 PM

Quote:

Originally Posted by MarcoH64
Try:
PHP Code:

$userselect false

// is style in the forum/thread set? 
if ($codestyleid

    
// style specified by forum 
    
$styleid $codestyleid
    
$userselect true

else
{
    if (
$bbuserinfo['styleid'] > AND ($vboptions['allowchangestyles'] == OR ($bbuserinfo['permissions']['adminpermissions'] & CANCONTROLPANEL))) 
    { 
        if (
$bbuserinfo['styleid'] == 29 AND $bbuserinfo['usergroupid'] != 7
            { 
                
$styleid $vboptions['styleid']; 
            } 
            else 
            { 
            
// style specified in user profile 
                
$styleid $bbuserinfo['styleid']; 
            } 
       
    } 
    else 
    { 
        
// no style specified - use default 
        
$styleid $vboptions['styleid']; 
    } 



I no longer getting parse error but it doesn't change style ID 29. Moderators (ID number 7) only sees default style. After this even administrators can't see style ID 29.

Many thanks anyway MarcoH64. Any ideas?

Marco van Herwaarden 03-14-2005 06:32 PM

Well i not checked your logic, only removed the error message.

Don't have the time now to have a closer look, if nobody else does, i will try to look tomorrow.


All times are GMT. The time now is 04:44 PM.

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.01308 seconds
  • Memory Usage 1,818KB
  • 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
  • (8)bbcode_php_printable
  • (8)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (21)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