PDA

View Full Version : Restrict style to Usergroup


Andreas
06-01-2005, 10:00 PM
Description
This hack allows you to restrict the usage of styles to certain usergroups.

Hack Details
Files to Edit = 4
Queries to Run = 1
Difficulty = Medium

History
0.1 Initial Version
0.2 Fixed a typo in the query, thanks to nexialys
0.3 Fixed a Bug which caused Problems with Primary Usergroups

Developed and tested with 3.0.7, but should work with all 3.0.x-Versions.

Corriewf
06-02-2005, 06:01 PM
This would go good in conjuction with subscription services.

Andreas
06-02-2005, 06:06 PM
That's possible.
Create an additional usergroup, restrict usage of your premium styles for this usergroup and then create a subscription which adds the user to this usergroup.

dsboyce8624
06-02-2005, 06:39 PM
I'm looking for soomething like this where if I have multiple sytles, but only want me to see them (because I'm working on them) only I see the chooser box.

Anything like that around?

Corriewf
06-02-2005, 06:44 PM
I'm looking for soomething like this where if I have multiple sytles, but only want me to see them (because I'm working on them) only I see the chooser box.

Anything like that around?

Ok so how many admins do you have? If the answer is one then Kirby is your hero.

nexialys
06-02-2005, 06:45 PM
KirbyDE, the query is having an error... VACHAR instead of VARCHAR.. ;)

great hack !

Andreas
06-02-2005, 06:51 PM
I hate typos ;)
Thanks, fixed.

GoTTi
06-02-2005, 08:53 PM
FINALLY
thanks kirb.

moley
06-02-2005, 10:34 PM
thanks a lot.

Andreas
06-02-2005, 11:13 PM
Would be nice to know if it does what it is meant do do - lol.

Brent H
06-03-2005, 12:17 AM
Installed and working great :D

defi
06-03-2005, 02:21 AM
I LOVE YOU KIRBY!
Okay, maybe not love but thanks!

dsboyce8624
06-03-2005, 01:59 PM
Ok so how many admins do you have? If the answer is one then Kirby is your hero.

Does that mean this will do what I need since it's only me?

Andreas
06-03-2005, 03:07 PM
If you are the only user in Usergroup Administrators - yes.

Freezerator
06-04-2005, 06:57 AM
Great hack!

Tnx!

dsboyce8624
06-04-2005, 03:01 PM
If you are the only user in Usergroup Administrators - yes.

Then I love Kirby too!

In a nice hetero male bonding sort of way. :nervous:

Andreas
06-04-2005, 03:04 PM
I don't want to sound ungraceful, but i'd prefer a woman to love me ;)

dsboyce8624
06-04-2005, 03:12 PM
I don't want to sound ungraceful, but i'd prefer a woman to love me ;)

Well, at least I qualified it. That way it didn't sound dirty.

Corriewf
06-04-2005, 06:14 PM
Aww man I just thought about how I am going to take your nice hack and turn it dirty....

NAKED GIRLS SKIN!

YES!

dsboyce8624
06-04-2005, 07:18 PM
Aww man I just thought about how I am going to take your nice hack and turn it dirty....

NAKED GIRLS SKIN!


YES!

ROFLMFAO!!!!!

Corriewf
06-04-2005, 07:51 PM
ROFLMFAO!!!!!


Dude im not joking either... Already working on it.... Oh the gif new post icons is sweet!

dsboyce8624
06-04-2005, 07:58 PM
Dude im not joking either... Already working on it.... Oh the gif new post icons is sweet!

When it's ready for prime time let me know. Love to have a look.

Corriewf
06-05-2005, 01:08 AM
When it's ready for prime time let me know. Love to have a look.

Well its done for right now.... Great for a few laughs.

Corriewf
06-05-2005, 01:11 AM
Lets just say that they are motivated to post a long post......

brianstevz
06-05-2005, 01:29 AM
I love this hack. It's exactly what I was looking for. Thanks for sharing your work.

What I did on my board was to add a style to subscribers that doesn't include ad's now. Hopefully this will encourage a little more donations.

Barakat
06-05-2005, 03:50 AM
thanks a lot

GoTTi
06-08-2005, 03:51 PM
when i select a user group for the style to be used on, the style is not showing up anymore. any ideas?

GoTTi
06-08-2005, 03:56 PM
yea as soon as i select a usergroup to be able to select the style, it just removes itself from the drop down.

using vb 3.0.0

Andreas
06-08-2005, 04:02 PM
I am not sure if this does work with 3.0.0 ...

If you set a Style to be only usable for Usergroup X, then only Usergroup X will see the Style in the Style-Selector Dropdown in UserCP or the Quick Style-Chooser at the bottom of each page.
This is how it should work.

Corriewf
06-08-2005, 04:18 PM
yea as soon as i select a usergroup to be able to select the style, it just removes itself from the drop down.

using vb 3.0.0


Did you also set it for admins to view.

I have an additional usergroup set up for my style.

between worlds
06-25-2005, 11:50 AM
Works great. Thank you.

GoTTi
06-25-2005, 05:21 PM
ive checked the box for the admins to view and it removed it from the drop down.

when i select a box for any usergroup to be able to use the style, i loose it in the drop down, but if i have it activated for all to see, the style shows in the drop down.

nighteyes
06-27-2005, 09:30 AM
Same problem here. Once I've selected the style, it completely vanishes from the drop-down menu..... even if I change to a different style.... it doesn't re-appear and I can't re-select it from the menu.

OK edit. This appears to only take into consideration secondary usergroups. I create a styles usergroup and anyone who is in this as secondary can see the additional styles in the dropdrown menus.

Andreas
06-27-2005, 09:38 AM
Strange. Does work just fine for me and I cannot reproduce the problem.

@nighteyes
Which Version do you use?
If you don't mind, pease send me a PM with an ACP and FTP account for your site so I can take a look at what is going wrong.

nighteyes
06-27-2005, 09:44 AM
See above edit Kirby. Is this the way it's supposed to work? :)

Andreas
06-27-2005, 09:48 AM
No, but there was a bug in the instructions.


$ugarray = array_merge(array($bbuserinfo['userid']), explode(',', $bbuserinfo['membergroupids']));


should have been

$ugarray = array_merge(array($bbuserinfo['usergroupid']), explode(',', $bbuserinfo['membergroupids']));


instead.
Does it also work with primary usergroups when you change this?

nighteyes
06-27-2005, 10:29 AM
Yep that fixes the problem. Thanks for posting a fix so quickly. :)

87accordlxi
06-27-2005, 01:23 PM
This may be a dumb question, but what does editing global.php do? When I edited it, it kept giving me parse errors so I reverted to a saved backup of the file. The hack still works.

Andreas
06-27-2005, 01:27 PM
Without the global.php edit Users can still use any Style (that has User Select = Yes).
If you get parse errors, you did not make the edit correctly - check again.

87accordlxi
06-27-2005, 01:38 PM
I see. They cannot select a restricted style from the dropdown menu, but they can still type the direct url of the board with that style and see it. Like http://www.mysite.com/index.php?s=&styleid=10 if Style #10 was restricted.

This is the parse error I keep getting. The edits for global.php are not very hard and i've tried it 4 or 5 times and still keep getting the error.


Parse error: parse error, unexpected '=' in /home2/geez/public_html/global.php on line 283

Andreas
06-27-2005, 01:53 PM
What's on lines 275-285 of you global.php?

87accordlxi
06-27-2005, 02:21 PM
Well I think I got it working now. Just a stupid copy/paste error I kept making. Everything works, and if users type the direct URL to a restricted style, it takes them to the default. Cool hack, I'll use this to exempt our donating members from ad banners.

King Kovifor
06-27-2005, 02:22 PM
I love this hack. I was wondering why it wasn't already built into the ACP. *saved for myth.*

Andreas
06-27-2005, 02:24 PM
and if users type the direct URL to a restricted style, it takes them to the default
Yes, this is how it should behave :)

Immortal
07-06-2005, 06:26 PM
Great hack, was looking for this awhile back. I got it installed and but I'm having same problems as they were, it removes the selection when chosen. I am using 3.0.7.

Andreas
07-06-2005, 06:30 PM
What does "it removes the selection when chosen" mean?

Immortal
07-06-2005, 06:35 PM
Sorry should've been exact! :)

I select the usergroup, press okay, then go back and it is unchecked again. Same problem they was having. I just downloaded it today so I had the fix you already changed.

Andreas
07-06-2005, 06:36 PM
You mean in ACP / Styles & Templates / Style Manager?

Immortal
07-06-2005, 06:40 PM
You mean in ACP / Styles & Templates / Style Manager?


Yes sir! :)

Andreas
07-06-2005, 06:46 PM
Nobody reported such a Problem so far.
Please carefully check the edits you made to admincp/template.php

Immortal
07-06-2005, 06:55 PM
I think I checked them all, is there a particular file you think would be causing this?

Andreas
07-06-2005, 06:58 PM
Quoting myself:

Please carefully check the edits you made to admincp/template.php

Immortal
07-06-2005, 07:07 PM
I'm very sorry I missed that. Could I perhaps email you the template.php file?

Immortal
07-06-2005, 08:21 PM
Kirby is the man! :)

GoTTi
07-10-2005, 04:22 PM
yay now its working. i didnt see the update here. thanks kirb

mkdevo
07-21-2005, 04:22 PM
just what i was looking for!

the search button IS my friend! :D

thanks K!

Dark Aura
07-24-2005, 09:12 PM
When I run the querie I get this, why is that...

An error occurred while attempting to execute your query. The following information was returned.
error number: 1146
error desc: Table 'darkaura_forums.style' doesn't exist

and how do I fix it as I would really like this hack.

Marco van Herwaarden
07-25-2005, 03:06 AM
You are probably using a table prefix. Add the prefix in front of the tablename (style) when running that query.

Gray Matter
08-17-2005, 02:19 PM
Not to be a bothersome pain in the butt, but any chance of seeing this for 3.5.0 anytime soon? :)

Andreas
08-17-2005, 07:49 PM
Yes. The next Version of vBulletin should have all necessary Hooks to implement this :)

Gray Matter
08-18-2005, 07:02 PM
Yes. The next Version of vBulletin should have all necessary Hooks to implement this :)

Which means it will be a plugin? :) That's even better! :D

Andreas
08-18-2005, 07:47 PM
Yes, it will be a Plugin.

sarahsboy18
08-30-2005, 03:16 AM
Kirby... You are my hero! Great Hack!

royouth
10-04-2005, 05:34 PM
I installed this hack except I don't have the edits to global.php done since I got an error when I edited it. So it's working nicely for the styles that I had before I added this hack.

I just recently added two new styles and for the new styles the style selector doesn't work at all. So if I open a browser with the new style from ACP I'm stuck in that style and can't switch to another style with the quick style chooser.

Andreas
10-04-2005, 08:01 PM
Check your edits and settings is all I can say.

zagman76
12-08-2005, 12:48 AM
just wondering if there is a 3.5.x version of this yet? :)

Thanks!

amykhar
12-08-2005, 01:23 AM
Here's a trick for finding that out on your own. Click the hack author's name. Look at his profile. His modifications are listed there.

Roody
01-31-2006, 04:55 PM
KirbyDE, the query is having an error... VACHAR instead of VARCHAR.. ;)

great hack !

Is there an updated hack for this in 3.5.3?

nsusa
08-06-2006, 05:20 PM
Just wondering what the plans for the plugin are and if this will be updated for 3.6 maybe?

Christoph