Skip to main content
Topic: Member Group Display (Read 3074 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Member Group Display

I've been working with member group badges and such lately and I feel the system needs a drastic overhaul from the core.

  • We need to allow full HTML for badges rather than just an image and how many repeats. This would allow full CSS customisation for the badge, or images if preferred. We could drop-in a {group_name} placeholder, for example.
  • We need to expose all additional groups and their badges in the info array to the themes, that way themes can incorporate additional group badges without the need for hacky workarounds or mods
  • We need a way to hide post-count-based groups regardless of belonging to another primary group

Once I get some opinions on these changes, I don't mind going ahead and writing the PR for core, since I'll be doing this work for my own forum anyway.

For example of #1: http://codepen.io/anon/pen/azoKWo
Last Edit: November 10, 2014, 07:13:36 am by ant59

Re: Member Group Display

Reply #1

Quote from: ant59 – I've been working with member group badges and such lately and I feel the system needs a drastic overhaul from the core.
From my experience on the multiple badges addon, I can't agree more. nods

Quote from: ant59 –
  • We need to allow full HTML for badges rather than just an image and how many repeats. This would allow full CSS customisation for the badge, or images if preferred. We could drop-in a {group_name} placeholder, for example.
I tend to prefer to reduce the number of fields that allow any kind of HTML for security reasons (yes, I know, I know, it's just that maybe, one day...).

Quote from: ant59 –
  • We need to expose all additional groups and their badges in the info array to the themes, that way themes can incorporate additional group badges without the need for hacky workarounds or mods
Yes and no.
Yes, let's make available badges to the template.
No, just only if the "source" wants so.
Show badges is an option the admin should have through a setting "forum-wide", not theme-specific.

Quote from: ant59 –
  • We need a way to hide post-count-based groups regardless of belonging to another primary group
Post-count-based groups are a pain.
I would change their structure quite drastically. First thing I would make so the "minimum 100 posts" inherits the "minimum 10 posts" group as well (it's very, very rare you not need that configuration, usually as the member grows you give him more permissions, not an entirely different set). Second I would make it so they are calculated "on-the-fly", without a specific field in the database (it's just "simple math" (and a max to determine the current group) and it shouldn't affect much the rest of the code).
On the show/hide, it should be again an admin choice, but if done sensibly it shouldn't be too difficult to let themes decide to hide the info or not.

In the prefix addon I'm trying to write, I'm adding a class to the prefix html with the id of the prefix, while in the admin panel I'm giving the option to edit the style of the current theme, but I'm also giving the example of the code to use in any other theme.
I think it's more or less the same thing? (See the attachment.)
Bugs creator.
Features destroyer.
Template killer.

Re: Member Group Display

Reply #2

Great information :D

Quote from: emanuele – I tend to prefer to reduce the number of fields that allow any kind of HTML for security reasons (yes, I know, I know, it's just that maybe, one day...).
I agree with the intent, but I don't think that poses a threat here, since the only users able to edit member group badges are admins, ie the highest security cleared group and the same group allowed to edit the server configuration.

Quote from: emanuele – Yes and no.
Yes, let's make available badges to the template.
No, just only if the "source" wants so.
Show badges is an option the admin should have through a setting "forum-wide", not theme-specific.
Agreed on the option. So the source would check for a setting and expose the additional groups as an array on something like an "additional_groups" key, if the admin has it set to expose additional groups? Then themes could just loop through that array on the key, and if it's empty, they would show none. No conditionals needed theme-side then.

Quote from: emanuele – Post-count-based groups are a pain.
I would change their structure quite drastically. First thing I would make so the "minimum 100 posts" inherits the "minimum 10 posts" group as well (it's very, very rare you not need that configuration, usually as the member grows you give him more permissions, not an entirely different set). Second I would make it so they are calculated "on-the-fly", without a specific field in the database (it's just "simple math" (and a max to determine the current group) and it shouldn't affect much the rest of the code).
On the show/hide, it should be again an admin choice, but if done sensibly it shouldn't be too difficult to let themes decide to hide the info or not.
100% with you on this. It would make a lot more sense to inherit post-based groups. Elk could have a panel for editing permissions on post count, which rather than checkboxes (as with member groups), could contain a textbox beside each permission, with a post count above which they are enabled?

Quote from: emanuele – In the prefix addon I'm trying to write, I'm adding a class to the prefix html with the id of the prefix, while in the admin panel I'm giving the option to edit the style of the current theme, but I'm also giving the example of the code to use in any other theme.
I think it's more or less the same thing? (See the attachment.)
Where does this prefix?

Re: Member Group Display

Reply #3

Nice hak :-)
No found.

Re: Member Group Display

Reply #4

Quote from: ant59 –
Quote from: emanuele – I tend to prefer to reduce the number of fields that allow any kind of HTML for security reasons (yes, I know, I know, it's just that maybe, one day...).
I agree with the intent, but I don't think that poses a threat here, since the only users able to edit member group badges are admins, ie the highest security cleared group and the same group allowed to edit the server configuration.
Slightly OT, so spoiler:
Spoiler (click to show/hide)

Quote from: ant59 – 100% with you on this. It would make a lot more sense to inherit post-based groups. Elk could have a panel for editing permissions on post count, which rather than checkboxes (as with member groups), could contain a textbox beside each permission, with a post count above which they are enabled?
hmm...interesting, though I have the feeling it may not scale well, and it would be difficult to set the "deny permission" (if necessary).

http://www.elkarte.net/community/index.php?topic=1424.0
Bugs creator.
Features destroyer.
Template killer.

Re: Member Group Display

Reply #5

Quote from: emanuele – Slightly OT, so spoiler:
Spoiler (click to show/hide)

That's a valid point. Is there any other way we can achieve the same level of customisability? I know that IP.Board software provides the user the ability to add HTML, which is usually used by admins to have <span> tags wrap the badge with CSS. We could check the HTML on saving to make sure there's no unclosed tags and such. The best way might be similar to your prefixes addon, but that opens up the same risk, since I could just inject
Code: [Select]
* { display: none; }
which messes up the page to the same extent as a HTML issue. Another option I've seen around is on the Lithium forum software, where they have a hardcoded span wrapping the prefix/badge (since they're essentially trying to achieve the same thing) with a field to alter the inline style="" attribute, which removes the threat of using a selector (such as *). Having it limited to a single span for the badge kind of limits the potential though.

Quote from: emanuele – hmm...interesting, though I have the feeling it may not scale well, and it would be difficult to set the "deny permission" (if necessary).

Oh yeah, good point. I guess you'd want a set for each interval then, inheriting but also overwriting the previous.

Re: Member Group Display

Reply #6

On the html: well, I'm not a themer, so I may be wrong, though with just a "simple" markup like:
Code: [Select]
<li class="listlevel1 icons">
    <span class="membergroup_1" />
</li>
you can attach css to:

.icons:before
.icons
.membergroup_1:before
.membergroup_1
.membergroup_1:after
.icons:after

it should be a fair amount of places to customize the badges, no?

 emanuele is thinking at some setting to expose font-awesome icons...
Actually, a way to let people use FA icons where possible/meaningful would be a nice thing, I think.
Bugs creator.
Features destroyer.
Template killer.

Re: Member Group Display

Reply #7

Quote from: emanuele – On the html: well, I'm not a themer, so I may be wrong, though with just a "simple" markup like:
Code: [Select]
<li class="listlevel1 icons">
    <span class="membergroup_1" />
</li>
you can attach css to:

.icons:before
.icons
.membergroup_1:before
.membergroup_1
.membergroup_1:after
.icons:after

I've had a browse around and seen how other forum engines provide this functionality, and I totally agree with your proposal here. Having styling on the list item itself and an inner span - wrapping the title - is perfect.

I'll get to work on this tomorrow and see what I can come up with for a pull request.