The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Number of group members in legend

2 posters

Go down

Solved Number of group members in legend

Post by Zwiebel January 11th 2023, 11:43 am

Hello,

I was wondering if somebody already posted a way to automatically display the number of people in a group e.g. next to the groupname in the legend. I'm aware it's not a function of forumotion itself and I would have to do it manually currently.


Example would be:

[Adminstrators: 3] [Newbies: 5] [Warriors: 21] [Archers: 12], etc

or something along those lines?


Best,
Zwiebel


Last edited by Zwiebel on January 11th 2023, 1:40 pm; edited 2 times in total
Zwiebel
Zwiebel
New Member

Posts : 7
Reputation : 1
Language : English

https://naruto-play.forumieren.de

Back to top Go down

Solved Re: Number of group members in legend

Post by Guest January 11th 2023, 11:56 am

What is your forum version?
avatar
Guest
Guest


Back to top Go down

Solved Re: Number of group members in legend

Post by Zwiebel January 11th 2023, 11:59 am

modernBB
Zwiebel
Zwiebel
New Member

Posts : 7
Reputation : 1
Language : English

https://naruto-play.forumieren.de

Back to top Go down

Solved Re: Number of group members in legend

Post by Guest January 11th 2023, 12:08 pm

Will write later script.
avatar
Guest
Guest


Back to top Go down

Solved Re: Number of group members in legend

Post by Guest January 11th 2023, 1:16 pm

Here you go. Go to CP - Modules - Javascript, make a new script and apply only for homepage. Add this code:

Code:
$(document).ready(function() {

    var numberOfGroups = $(".block-footer b a").length;

    for (i = 0; i < numberOfGroups; i++) {
        var titleValue = $(".block-footer b a")[i].getAttribute("title");
        var numberOfUsers = titleValue.slice(titleValue.indexOf(":"));
        var originalText = $(".block-footer b a")[i].innerHTML;
        $(".block-footer b a")[i].innerHTML = originalText + numberOfUsers;
    }

});

Save. Let me know the results. For me it works like this:
Number of group members in legend Scree152
avatar
Guest
Guest


Back to top Go down

Solved Re: Number of group members in legend

Post by Zwiebel January 11th 2023, 1:26 pm

aaaaww men, this is so smart and simple! thank you. I saw that they basically give you the number in the title of the link but I wouldn't have known how to extract it.

works just fine <3
Zwiebel
Zwiebel
New Member

Posts : 7
Reputation : 1
Language : English

https://naruto-play.forumieren.de

Back to top Go down

Solved Re: Number of group members in legend

Post by Guest January 11th 2023, 1:35 pm

Zwiebel wrote:aaaaww men, this is so smart and simple! thank you. I saw that they basically give you the number in the title of the link but I wouldn't have known how to extract it.

works just fine <3
Yeah, simple slice method does the trick.
avatar
Guest
Guest


Back to top Go down

Solved Re: Number of group members in legend

Post by skouliki January 11th 2023, 3:20 pm

Problem solved & topic archived.
Please read our forum rules: ESF General Rules
skouliki
skouliki
Manager
Manager

Female Posts : 15061
Reputation : 1690
Language : English,Greek
Location : Greece

http://iconskouliki.forumgreek.com

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum