Advertisement:

Author Topic: Allow moderators to customise CSS in their boards  (Read 1747 times)

Offline confuseamuse

  • Jr. Member
  • **
  • Posts: 128
Allow moderators to customise CSS in their boards
« on: August 05, 2017, 05:37:04 PM »
Is there a mod that allows moderators to custom the css specifically for that board?

The reason I ask is that the ability to customise board css files requires admin access, whereas a system that allows CSS to be implemented on a per board basis might be a better option.

I'm thinking of a system similar to how reddit handles subreddits. The mods are able to input custom css for certain attributes, and the elements they don't change remain the same. So if a mod just wanted to change the background of the body/post area, they don't need to have the entire index.css file inserted into the stylesheet as well.

I doubt that this is a simple change considering the additions that would have to be made to the already existing code.

Offline br360

  • Lead Support Specialist
  • SMF Hero
  • *
  • Posts: 2,031
    • GenXcommunity
Re: Allow moderators to customise CSS in their boards
« Reply #1 on: August 06, 2017, 02:12:54 PM »
If you gave mods the permission to change the CSS it would allow them to edit any template as well.  There is no mod for allowing them only access to CSS but there are a couple other options.

you have the ability to make certain boards a different theme. Maybe the mods could cruise the theme site and pick a theme they like that they could use for the board they are a moderator to?

You could also create a test site and give them access to the CSS files there. They can play around and get things how they want and then maybe you could take the edits and add them to your main site? You would probably have to have a few themes installed anyway as if a theme is edited then everyone sees the edits. I'm sure you don't want multiple moderators messing with the same themes CSS ;)

Offline confuseamuse

  • Jr. Member
  • **
  • Posts: 128
Re: Allow moderators to customise CSS in their boards
« Reply #2 on: August 06, 2017, 04:25:40 PM »
True that would mess things up.

Is there a way to let the moderators select the theme for the board? If you can do that, it makes things a lot easier.

My forum is still under development and has no users at the moment, but it's going live tomorrow :)

Online Antes

  • Evil Black Cat
  • SMF Friend
  • SMF Hero
  • *
  • Posts: 8,648
  • Gender: Male
  • Black cat rulz!
    • Antes on GitHub
    • merta on LinkedIn
    • @antesistan on Twitter
    • Lunarfall
Re: Allow moderators to customise CSS in their boards
« Reply #3 on: August 06, 2017, 04:35:13 PM »
One thing comes to my mind you can allow extra css under that board which can be edited by moderators who can change style a little bit (like Reddit style).
Active Project(s): [ SimpleDesk ] # [ Lunarfall ] # [ CoreStore ]

Past Project(s): [ ezPortal ]

Offline confuseamuse

  • Jr. Member
  • **
  • Posts: 128
Re: Allow moderators to customise CSS in their boards
« Reply #4 on: August 06, 2017, 05:15:03 PM »
One thing comes to my mind you can allow extra css under that board which can be edited by moderators who can change style a little bit (like Reddit style).

That's exactly what I was thinking. The only problem is that it can potentially add conflicts within CSS code, rendering the moderator changes useless (although that isn't really a big deal).

I'm thinking of a system that has the option available in a separate section and a PHP syntax that specifically creates a directory in the theme folder that stores Board CSS edits for each board, which is then called upon within the Board Index itself.

Online Antes

  • Evil Black Cat
  • SMF Friend
  • SMF Hero
  • *
  • Posts: 8,648
  • Gender: Male
  • Black cat rulz!
    • Antes on GitHub
    • merta on LinkedIn
    • @antesistan on Twitter
    • Lunarfall
Re: Allow moderators to customise CSS in their boards
« Reply #5 on: August 06, 2017, 05:27:08 PM »
Not really loading extra css file first should dictate its content over index.css (I think).
Active Project(s): [ SimpleDesk ] # [ Lunarfall ] # [ CoreStore ]

Past Project(s): [ ezPortal ]

Offline confuseamuse

  • Jr. Member
  • **
  • Posts: 128
Re: Allow moderators to customise CSS in their boards
« Reply #6 on: August 06, 2017, 07:25:59 PM »
How would I go about adding this feature?

Offline Gwenwyfar

  • Customizer
  • Full Member
  • *
  • Posts: 690
  • Gender: Female
    • Gwenwyfar on GitHub
Re: Allow moderators to customise CSS in their boards
« Reply #7 on: August 06, 2017, 08:08:43 PM »
One thing comes to my mind you can allow extra css under that board which can be edited by moderators who can change style a little bit (like Reddit style).

That's exactly what I was thinking. The only problem is that it can potentially add conflicts within CSS code, rendering the moderator changes useless (although that isn't really a big deal).

I'm thinking of a system that has the option available in a separate section and a PHP syntax that specifically creates a directory in the theme folder that stores Board CSS edits for each board, which is then called upon within the Board Index itself.
The name of CSS is "Cascading Style Sheets" for a reason: Any css that comes after a previously defined css takes priority. So if you include the custom css after the main css file, any changes in it should override the main css.

Offline confuseamuse

  • Jr. Member
  • **
  • Posts: 128
Re: Allow moderators to customise CSS in their boards
« Reply #8 on: August 07, 2017, 03:46:44 AM »
One thing comes to my mind you can allow extra css under that board which can be edited by moderators who can change style a little bit (like Reddit style).

That's exactly what I was thinking. The only problem is that it can potentially add conflicts within CSS code, rendering the moderator changes useless (although that isn't really a big deal).

I'm thinking of a system that has the option available in a separate section and a PHP syntax that specifically creates a directory in the theme folder that stores Board CSS edits for each board, which is then called upon within the Board Index itself.
The name of CSS is "Cascading Style Sheets" for a reason: Any css that comes after a previously defined css takes priority. So if you include the custom css after the main css file, any changes in it should override the main css.

Thanks for the lesson.

I think this could work by appending the individual board CSS files to a directory in the main theme. Probably in "{theme_url}/css/board" or something like that.

Offline Gluz

  • Native Language Support Specialist
  • Sr. Member
  • *
  • Posts: 961
  • Gender: Male
Re: Allow moderators to customise CSS in their boards
« Reply #9 on: August 07, 2017, 05:47:56 PM »
...
Probably in "{theme_url}/css/board" or something like that.

That could be a reasonable approach, to have a CSS file load if it exists, and using the board ID as the name of the file it take a little code to do it.

One thing to use that approach is making a sample CSS file with comments and structured to put the main parts that anyone would change like background colors and other simple stuff.
Need help with PHP, HTML, CSS, Themes or MODs?

Quote
Think in spanish, habla en inglés.

Offline confuseamuse

  • Jr. Member
  • **
  • Posts: 128
Re: Allow moderators to customise CSS in their boards
« Reply #10 on: August 07, 2017, 06:51:22 PM »
...
Probably in "{theme_url}/css/board" or something like that.

That could be a reasonable approach, to have a CSS file load if it exists, and using the board ID as the name of the file it take a little code to do it.

One thing to use that approach is making a sample CSS file with comments and structured to put the main parts that anyone would change like background colors and other simple stuff.

I also remembered that the 'Themes and Layout' section has a CSS editor, which displays the results of the CSS files in real time. Using that feature to display edits made with the CSS via the board settings would also allow the editing mod to view the changes in real time.

Offline Gluz

  • Native Language Support Specialist
  • Sr. Member
  • *
  • Posts: 961
  • Gender: Male
Re: Allow moderators to customise CSS in their boards
« Reply #11 on: August 09, 2017, 10:31:30 PM »
Well, that will require more modifications, in the Board edit area (Sources and Templates) and in the database to store the CSS in each board, but will made an interesting MOD and it will be more like Antes said, kind of Reddit style.

Let me figuring out the best way to do something for it.
Need help with PHP, HTML, CSS, Themes or MODs?

Quote
Think in spanish, habla en inglés.

Offline confuseamuse

  • Jr. Member
  • **
  • Posts: 128
Re: Allow moderators to customise CSS in their boards
« Reply #12 on: August 16, 2017, 01:44:38 PM »
Well, that will require more modifications, in the Board edit area (Sources and Templates) and in the database to store the CSS in each board, but will made an interesting MOD and it will be more like Antes said, kind of Reddit style.

Let me figuring out the best way to do something for it.

Feel free to do so.

Offline Gluz

  • Native Language Support Specialist
  • Sr. Member
  • *
  • Posts: 961
  • Gender: Male
Re: Allow moderators to customise CSS in their boards
« Reply #13 on: August 17, 2017, 12:09:10 AM »
I've been doing some tests, and get one little problem, you can't assign Local Moderators to manage Boards to edit the Name, Description or any other setting there, and if you put all the Local Moderators in another group to grant that permission, then they can edit all the boards and not only the ones that they moderate.

It can't be done that way, unless someone with more experience than me can do that the Local moderators only see the boards they moderate to edit them, I was looking for that but didn't get anything like it.

What I want to try next is adding a Button into the Button Strip (New Topic, New Poll...) to Edit the board CSS, and add there a textarea for it, save it in the boards table and in the template load the CSS at the end for that to override the main one just in that board. This way every Local Moderator can add the CSS directly and the changes are instantaneous after saving and going to the board. Because the other way I was thinking is by using an extra CSS file with the ID of the board and the forum load it if that file exist.

Each one of this methods have pros and cons, like the files can be cached by the browser and browsing around the forum will not require loading all the files again but all the files should be uploaded to the forum FTP and is not that straight forward to the Local Moderators to do it. The Button to add directly the CSS is easy for the people who will use it, but the forum has to load the CSS from the database or if caching is enabled, pull the database value to the cache and load it from there each time the board is visited.
Need help with PHP, HTML, CSS, Themes or MODs?

Quote
Think in spanish, habla en inglés.

Online Antes

  • Evil Black Cat
  • SMF Friend
  • SMF Hero
  • *
  • Posts: 8,648
  • Gender: Male
  • Black cat rulz!
    • Antes on GitHub
    • merta on LinkedIn
    • @antesistan on Twitter
    • Lunarfall
Re: Allow moderators to customise CSS in their boards
« Reply #14 on: August 17, 2017, 06:29:55 AM »
You should add unique page to the modification. Its best to ignore the core pages.
Active Project(s): [ SimpleDesk ] # [ Lunarfall ] # [ CoreStore ]

Past Project(s): [ ezPortal ]

Offline confuseamuse

  • Jr. Member
  • **
  • Posts: 128
Re: Allow moderators to customise CSS in their boards
« Reply #15 on: October 20, 2017, 06:45:23 PM »
Did anything happen regarding this?

Offline Gluz

  • Native Language Support Specialist
  • Sr. Member
  • *
  • Posts: 961
  • Gender: Male
Re: Allow moderators to customise CSS in their boards
« Reply #16 on: October 20, 2017, 08:05:38 PM »
Sorry, I was doing some tests but none of it successful.

There was some cache thingies that I wanted to try but didn't work as expected, I left it aside and get busy with other things so not any advancement. I don't have so much time with my new job, so, I don't know if I can test more things with this.
Need help with PHP, HTML, CSS, Themes or MODs?

Quote
Think in spanish, habla en inglés.

Offline confuseamuse

  • Jr. Member
  • **
  • Posts: 128
Re: Allow moderators to customise CSS in their boards
« Reply #17 on: October 21, 2017, 12:09:00 AM »
Sorry, I was doing some tests but none of it successful.

There was some cache thingies that I wanted to try but didn't work as expected, I left it aside and get busy with other things so not any advancement. I don't have so much time with my new job, so, I don't know if I can test more things with this.

Ah alright. I've gotten slightly better at coding stuff, so I might take a crack at it, see if I can make some headway.