PDA

View Full Version : Style Permissions


noonespecial
08-06-2004, 09:41 AM
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
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: // style specified in user profile
$styleid = $bbuserinfo['styleid'];

REPLACE WITH:

if ($bbuserinfo['styleid'] == X 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
You could try something like this:

in global.php, find: // style specified in user profile
$styleid = $bbuserinfo['styleid'];

REPLACE WITH:

if ($bbuserinfo['styleid'] == X 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
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
<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:


<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
<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:


<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
You could try something like this:

in global.php, find: // style specified in user profile
$styleid = $bbuserinfo['styleid'];

REPLACE WITH:

if ($bbuserinfo['styleid'] == X 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
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
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
And which line is line 266?


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
$userselect = false;

// is style in the forum/thread set?
if ($codestyleid)
{
// style specified by forum
$styleid = $codestyleid;
$userselect = true;
}
else if ($bbuserinfo['styleid'] > 0 AND ($vboptions['allowchangestyles'] == 1 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:
$userselect = false;

// is style in the forum/thread set?
if ($codestyleid)
{
// style specified by forum
$styleid = $codestyleid;
$userselect = true;
}
else
{
if ($bbuserinfo['styleid'] > 0 AND ($vboptions['allowchangestyles'] == 1 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
Try:
$userselect = false;

// is style in the forum/thread set?
if ($codestyleid)
{
// style specified by forum
$styleid = $codestyleid;
$userselect = true;
}
else
{
if ($bbuserinfo['styleid'] > 0 AND ($vboptions['allowchangestyles'] == 1 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.