Simple Machines Community Forum

SMF Support => SMF 1.1.x Support => Aiheen aloitti: jnix - huhtikuu 17, 2007, 08:02:34 AP

Otsikko: Permission to choose own theme?
Kirjoitti: jnix - huhtikuu 17, 2007, 08:02:34 AP
My overall setting is for users NOT to be able to select their own theme. But I'd like global moderators to be able to - to test out new themes really. I tried selecting a different theme in their profile, but it has no effect (presumably due to the overall setting..) - but this does work for admin (ie by changing the theme in the admin profile I can use a different one).

Is there any way to allow global moderators to choose their own theme, but no-one else?

Thanks in advance
Otsikko: Re: Permission to choose own theme?
Kirjoitti: Sarge - huhtikuu 17, 2007, 09:52:11 AP
In your forum, what permissions do global moderators (and of course admins) have that no-one else has?

Otsikko: Re: Permission to choose own theme?
Kirjoitti: jnix - huhtikuu 17, 2007, 11:36:36 AP
Several eg they can modify/remove any post. And there are a couple of boards that only they can see. I presume pretty standard mod type settings.
Otsikko: Re: Permission to choose own theme?
Kirjoitti: SleePy - huhtikuu 17, 2007, 09:04:20 IP
Do you have it enabled so users can change their theme?
Admin -> Themes and Layout
Allow members to select their own themes.
Allow members to select the "Default" theme.

are checked?
Otsikko: Re: Permission to choose own theme?
Kirjoitti: Sarge - huhtikuu 18, 2007, 01:59:13 AP
Lainaus käyttäjältä: SleePy - huhtikuu 17, 2007, 09:04:20 IP
Do you have it enabled so users can change their theme?
Admin -> Themes and Layout
Allow members to select their own themes.
Allow members to select the "Default" theme.

are checked?

SleePy, the whole point is to allow only global moderators, not regular members, to change their theme.

I figured out a way to do that, but I need to know the name of a permission that is (normally) only assigned to global moderators. Can you help with that?
Otsikko: Re: Permission to choose own theme?
Kirjoitti: metallica48423 - huhtikuu 18, 2007, 02:49:01 AP
Sarge, theres a couple things you could do, just as suggestions:

1.) Create a custom permission -- this would be the most customizable route

2.) Do a check on the membergroup ID -- This would be customizable, but not easily or without further code modification.

3.) One permission that mods usually always have is 'Moderate board'

With the gumption, you could package this up and make it a mod :P 

Otsikko: Re: Permission to choose own theme?
Kirjoitti: Sarge - huhtikuu 18, 2007, 03:12:03 AP
Lainaus käyttäjältä: metallica48423 - huhtikuu 18, 2007, 02:49:01 AP
Sarge, theres a couple things you could do, just as suggestions:

1.) Create a custom permission -- this would be the most customizable route

2.) Do a check on the membergroup ID -- This would be customizable, but not easily or without further code modification.

3.) One permission that mods usually always have is 'Moderate board'

With the gumption, you could package this up and make it a mod :P 



I'm trying to code the second way right now.

It seems that the first way might be implemented in the next SMF version. Here's a comment in Profile.template.php:


// Are they allowed to change their theme? // !!! Change to permission?


Anyway, I'll try to make a permission and release a mod. ;)
Otsikko: Re: Permission to choose own theme?
Kirjoitti: metallica48423 - huhtikuu 18, 2007, 03:17:45 AP
IF it helps any :P

2 is the Membergroup ID of Global Moderators

if (in_array($user_info['groups'], 2) {
code here
}


I THINK (i'm not sure) that this check is done with if $context['user']['is_admin'] if the option is not on, i am not sure, i'd have to look sometime tomorrow... so it'd be matter of checking if they're an admin || if they're a global mod?

Just my random thoughts, i'll have a look at the code if you can't figure it out :)
Otsikko: Re: Permission to choose own theme?
Kirjoitti: Sarge - huhtikuu 18, 2007, 03:24:18 AP
Thanks, I think I have figured it out already. Although I think it's in_array(2, $user_info['groups']) -- not the other way round :P
Otsikko: Re: Permission to choose own theme?
Kirjoitti: metallica48423 - huhtikuu 18, 2007, 03:26:23 AP
i thought that looked funny -- i did a search for $user_info

You are correct, it is before :P
Otsikko: Re: Permission to choose own theme?
Kirjoitti: Sarge - huhtikuu 18, 2007, 03:59:07 AP
I coded the changes and made a mod package. See attached. You can install it through Package Manager.

This mod allows all members of the membergroup with ID = 2 (global moderators by default) to change their theme.

Tested in a SMF 1.1.2 installation, but could work in other SMF versions too.

P.S. Fixed mod ID (it was set as another mod of mine).
Otsikko: Re: Permission to choose own theme?
Kirjoitti: Sarge - huhtikuu 18, 2007, 04:05:54 AP
I just submitted the mod:
http://custom.simplemachines.org/mods/index.php?mod=769

P.S. I intend to make the mod even better by creating a permission for it.
Otsikko: Re: Permission to choose own theme?
Kirjoitti: jnix - huhtikuu 18, 2007, 04:39:58 AP
Thanks all - especially Sarge for the mod. Works fine for me - exactly what I wanted. Now means I can get feedback on any theme changes from global mods before unleashing them on all users.

Makes sense to me to make it a permission - is it worth me making a feature request for this?



Otsikko: Re: Permission to choose own theme?
Kirjoitti: metallica48423 - huhtikuu 18, 2007, 04:43:40 AP
I think it would be best and make a mod request for it -- unless Sarge is going to change his to add permissions as an option :P

I suspect, along with Sarge, that this may already be planned for 2.0, due to the comment.  Only time will tell
Otsikko: Re: Permission to choose own theme?
Kirjoitti: Sarge - huhtikuu 18, 2007, 04:49:27 AP
Lainaus käyttäjältä: jnix - huhtikuu 18, 2007, 04:39:58 AP
Makes sense to me to make it a permission - is it worth me making a feature request for this?

Although there's a hint for it in the source files, by all means do request this feature -- if you don't request it, then I will.

There's no harm in poking the devs now and then, is there? :P

Lainaus käyttäjältä: metallica48423 - huhtikuu 18, 2007, 04:43:40 AP
I think it would be best and make a mod request for it -- unless Sarge is going to change his to add permissions as an option :P

Unless? I'm already rewriting this mod to use permissions instead. This way, the admin can set the option for whatever membergroup he/she wishes.

Stay tuned. ;)
Otsikko: Re: Permission to choose own theme?
Kirjoitti: metallica48423 - huhtikuu 18, 2007, 04:52:39 AP
the Unless was more of a 'not sure whether or not you were planning to do so but strongly suspected so' unless :P

I think it'd be a fairly useful mod, however :P

Will definitely check it out when the permissioned version becomes available
Otsikko: Re: Permission to choose own theme?
Kirjoitti: KGIII - huhtikuu 18, 2007, 04:59:47 AP
Check ID on re-write. (Almost done being swamped.) :D (It is set as the shared forum mod in your package that you have here.)
Otsikko: Re: Permission to choose own theme?
Kirjoitti: jnix - huhtikuu 18, 2007, 05:10:14 AP
Lainaus käyttäjältä: Sarge - huhtikuu 18, 2007, 04:49:27 AP
Although there's a hint for it in the source files, by all means do request this feature -- if you don't request it, then I will.

Ok, have made a feature request (http://www.simplemachines.org/community/index.php?topic=165725.0).

Thanks again for your help
Otsikko: Re: Permission to choose own theme?
Kirjoitti: Sarge - huhtikuu 18, 2007, 05:13:06 AP
Lainaus käyttäjältä: metallica48423 - huhtikuu 18, 2007, 04:52:39 AP
Will definitely check it out when the permissioned version becomes available

How long are you going to stay online tonight? ;)

Lainaus käyttäjältä: KGIII - huhtikuu 18, 2007, 04:59:47 AP
Check ID on re-write. (Almost done being swamped.) :D (It is set as the shared forum mod in your package that you have here.)

Fixed. Thanks!
Otsikko: Re: Permission to choose own theme?
Kirjoitti: KGIII - huhtikuu 18, 2007, 05:14:30 AP
You MAY have issues with it at the mod site - if you've already uploaded it for approval. Let one of us know if you do and we can get it deleted it and you can upload a new one if required. (I say this 'cause, well, I have had to have one deleted though they may have fixed that issue now.)
Otsikko: Re: Permission to choose own theme?
Kirjoitti: Sarge - huhtikuu 18, 2007, 05:34:44 AP
Lainaus käyttäjältä: KGIII - huhtikuu 18, 2007, 05:14:30 AP
You MAY have issues with it at the mod site - if you've already uploaded it for approval. Let one of us know if you do and we can get it deleted it and you can upload a new one if required. (I say this 'cause, well, I have had to have one deleted though they may have fixed that issue now.)

Thanks for the info.

Yes, I've already submitted it for approval. The username and ID for both the old version and the new one don't contain spaces.

How do I know if I have a problem?
Otsikko: Re: Permission to choose own theme?
Kirjoitti: KGIII - huhtikuu 18, 2007, 08:18:26 IP
When you go to upload your shared forum mod - if the ID is the same it may complain.
Otsikko: Re: Permission to choose own theme?
Kirjoitti: Sarge - huhtikuu 18, 2007, 08:37:33 IP
Lainaus käyttäjältä: KGIII - huhtikuu 18, 2007, 08:18:26 IP
When you go to upload your shared forum mod - if the ID is the same it may complain.

I uploaded a fixed version for the Allow Theme Change mod; the new files contain a new ID.

Just to be sure, can you please get it deleted, so that I can reupload the fixed files? Here's the link again:
http://custom.simplemachines.org/mods/index.php?mod=769

There's a Remove link there, should I use that or let the team do it?
Otsikko: Re: Permission to choose own theme?
Kirjoitti: KGIII - huhtikuu 18, 2007, 08:41:20 IP
I'll drop a link to this into their section - and they may need to deal with it. I am not sure.
Otsikko: Re: Permission to choose own theme?
Kirjoitti: Sarge - huhtikuu 18, 2007, 08:44:23 IP
Thank you. :)
Otsikko: Re: Permission to choose own theme?
Kirjoitti: Joshua Dickerson - huhtikuu 18, 2007, 08:48:06 IP
Rejected it if that helps.
Otsikko: Re: Permission to choose own theme?
Kirjoitti: Sarge - huhtikuu 18, 2007, 08:56:01 IP
Lainaus käyttäjältä: groundup - huhtikuu 18, 2007, 08:48:06 IP
Rejected it if that helps.

I removed the mod when I read your message.

I noticed that the mod page is still there:
"Warning: This mod has been removed from the mod list"

Is it normal? Since the mod is rejected and removed, shouldn't the link be invalid?
Otsikko: Re: Permission to choose own theme?
Kirjoitti: Joshua Dickerson - huhtikuu 18, 2007, 08:58:57 IP
Lainaus käyttäjältä: Sarge - huhtikuu 18, 2007, 08:56:01 IP
Lainaus käyttäjältä: groundup - huhtikuu 18, 2007, 08:48:06 IP
Rejected it if that helps.

I removed the mod when I read your message.

I noticed that the mod page is still there:
"Warning: This mod has been removed from the mod list"

Is it normal? Since the mod is rejected and removed, shouldn't the link be invalid?
Honestly, I don't know what the idea is behind that. I think it all needs a rewrite.
Otsikko: Re: Permission to choose own theme?
Kirjoitti: Sarge - toukokuu 13, 2007, 06:05:22 AP
Lainaus käyttäjältä: jnix - huhtikuu 18, 2007, 04:39:58 AP
Makes sense to me to make it a permission - is it worth me making a feature request for this?

Rudolf has written his own mod to use permissions and to work for any membergroup that you give the permission to.

Check here:
http://www.simplemachines.org/community/index.php?topic=168995.msg1090452#msg1090452

Mod download page:
http://custom.simplemachines.org/mods/index.php?mod=795

Bottom line: uninstall my mod, install Rudolf's "Change Theme Permission" mod and set the permission for the membergroup you want.
Otsikko: Re: Permission to choose own theme?
Kirjoitti: jnix - toukokuu 15, 2007, 06:17:12 AP
Great, thanks for all your help on this.