News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Allow moderators to customise CSS in their boards

Started by confuseamuse, August 05, 2017, 05:37:04 PM

Previous topic - Next topic

confuseamuse

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.

br360

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 ;)

confuseamuse

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

Antes

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).

confuseamuse

Quote from: Antes 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).

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.

Antes

Not really loading extra css file first should dictate its content over index.css (I think).

confuseamuse


Gwenwyfar

Quote from: confuseamuse on August 06, 2017, 05:15:03 PM
Quote from: Antes 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).

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.
"It is impossible to communicate with one that does not wish to communicate"

confuseamuse

Quote from: Gwenwyfar on August 06, 2017, 08:08:43 PM
Quote from: confuseamuse on August 06, 2017, 05:15:03 PM
Quote from: Antes 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).

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.

Gluz

Quote from: confuseamuse on August 07, 2017, 03:46:44 AM
...
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.

confuseamuse

Quote from: Gluz on August 07, 2017, 05:47:56 PM
Quote from: confuseamuse on August 07, 2017, 03:46:44 AM
...
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.

Gluz

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.

confuseamuse

Quote from: Gluz 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.

Feel free to do so.

Gluz

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.

Antes

You should add unique page to the modification. Its best to ignore the core pages.

confuseamuse


Gluz

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.

confuseamuse

Quote from: Gluz 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.

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.

Advertisement: