News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Display Additional Membergroups

Started by margarett, March 03, 2014, 11:02:35 AM

Previous topic - Next topic

JerzyLS

First solution working fine, but the second not necessarily.

JerzyLS

Here is my solution:

Profile.template.php

Find:


//Show additional groups, if the user has some attributed
if (!empty($modSettings['show_additional_groups']) && !empty($context['member']['additional_groups_full'])) {
echo '<dl>';
foreach($context['member']['additional_groups_full'] as $temp) {
echo '
<dt>', $txt['additional_membergroups'], ':</dt>
<dd>', $temp['group'], '</dd>';
}
echo '</dl>';
}


Replace:



        //Show additional groups, if the user has some attributed
if (!empty($modSettings['show_additional_groups']) && !empty($context['member']['additional_groups_full'])) {
echo '<dl><dt>', $txt['additional_membergroups'], ':</dt>';
foreach($context['member']['additional_groups_full'] as $temp) {
echo '
', $temp['group'], ',';
}
echo '</dl>';
}

K0SM0S

Installed the mod fine with no errors, but when I enable the options I need to enable via the misc settings, I add someone to a additional membergroup, apply it, then check a random forum post they have posted in and it still shows only one.

margarett

Which options did you set? Did you install to your custom theme (if any)? Do your additional membergroups have stars assigned?
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

K0SM0S

Quote from: margarett on July 25, 2016, 09:40:02 PM
Which options did you set? Did you install to your custom theme (if any)? Do your additional membergroups have stars assigned?

I have Show additional membergroups on Topic Display and Profile Summary? ticked and my membergorups have only 1 Star assigned, since it's an image rather than a block.

And I am using a custom theme called Greeny

Kindred

and did you apply the changes to that theme during installation?
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

K0SM0S

Quote from: Kindred on July 26, 2016, 07:25:08 AM
and did you apply the changes to that theme during installation?

Figured out how to fix it, but now there is another problem. I am sure you can see it right away in this picture.



Is there a way to move the Development Team picture underneath Administrator?

Kindred

you need to put the code change in the right place
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

K0SM0S

Quote from: Kindred on July 26, 2016, 02:32:58 PM
you need to put the code change in the right place

I'm not sure I quite understand what you're saying, can you elaborate?

Kindred

You added the code for the mod... But you put it in the wrong place, therefore, it is displaying in the wrong location.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

margarett

Your Display.template.php has a list of everything which is added on the "post author" area (or mini-profile as it's also called).

Your should find something like this:
// Show the post group if and only if they have no other group or the option is on, and they are in a post group.
if ((empty($settings['hide_post_group']) || $message['member']['group'] == '') && $message['member']['post_group'] != '')
echo '
<li class="postgroup">', $message['member']['post_group'], '</li>';
echo '
<li class="stars">', $message['member']['group_stars'], '</li>';

Then my MOD tries to add its code below this code. You probably added it above the avatar bit, you need to move it below the primary membergroup/post count group. Look at the code in Display.template.php, it's quite self-explanatory :)
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

K0SM0S

Quote from: margarett on July 26, 2016, 07:46:40 PM
Your Display.template.php has a list of everything which is added on the "post author" area (or mini-profile as it's also called).

Your should find something like this:
// Show the post group if and only if they have no other group or the option is on, and they are in a post group.
if ((empty($settings['hide_post_group']) || $message['member']['group'] == '') && $message['member']['post_group'] != '')
echo '
<li class="postgroup">', $message['member']['post_group'], '</li>';
echo '
<li class="stars">', $message['member']['group_stars'], '</li>';

Then my MOD tries to add its code below this code. You probably added it above the avatar bit, you need to move it below the primary membergroup/post count group. Look at the code in Display.template.php, it's quite self-explanatory :)

Just looked in the .php you said, found nothing related to anything you showed above.

Shambles

Attach your Display.template.php to your next post and we'll have a look for you.

badon

margarett, thank you very much for maintaining this mod. It works well for me. This should be a standard feature. We have "Topic mover" and "Post edit" member groups who are people that can do little tasks for other members by request. It doesn't make sense to keep those member groups secret, and I don't know why SMF does it that way...but, problem solved, thanks to this mod! :)

Arantor

Mostly it's done that way for performance. Getting primary group is cheap, getting multiple groups not so much.

badon

Arantor, maybe it would be straightforward to make it optional for additional member groups to be visible? If they're invisible by default, that satisfies the need for performance. On the page where they can be made visible, there could be an explanation that making them visible will reduce performance. Then for groups like the ones I mentioned, I could make them visible, and leave the others with the default settings. For now, as long as margarett keeps maintaining this mod, my use case is satisfied.

Arantor

No, it wouldn't because of the same performance issue I mentioned. That's the entire reason it's that way. It's fundamental to the way SMF's database is designed.

A user has a primary group, a post count group and "all other groups". Fetching the primary group is cheap (it always manifests as a 1-1 relationship) but trying to handle multiples... Even if SMF didn't use a single text field to store them all (it uses a string e.g, 10,12,13,15 which MySQL won't perform a join from) even creating multiples means it has to join all the members to all the groups and then sit and perform deduplication before it can process anything else.

Multiple groups however you do it has a performance impact. More groups, worse it gets.

badon

OK, maybe I'm looking at it the wrong way. If I have a regular user that I want to have regular user permissions, but also a few extra abilities, then maybe I should make the new user groups primary for those users, instead of additional? I'm not sure what the best practice is for this kind of thing. For now, our forum is small, but ignoring performance issues will just cause problems later.

Arantor

The primary / other group distinction is solely for the purposes of making threads quick to display in base SMF.

Permissions are not performance related whether you have one group or lots (at least not in any meaningful way)

It just comes back to whether you display one group or multiple and if you really want to show off peoples' roles at a more granular level than "regular member" and "moderator" you could, but my experience of forums suggests that people don't really care and that having a few (primary) moderator groups is clearer and more meaningful - moderator (moves topics), senior moderator (moves topics, closes topics), administrator (does everything) or similar.

As a general rule, most forum users simply do not care which people do specific jobs unless 1) they need something done (in which case there's the report to moderator function so the appropriate person can deal with it) or 2) they want the badge and power themselves. The latter has a habit of being toxic in forums anyway so keeping it a little simpler actually tends to help, not hurt.

badon

Sounds like good advice, thank you Arantor.

Advertisement: