1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Lack of Interest User group admin - # of users in group in mouseover

Discussion in 'Closed Suggestions' started by MGSteve, Dec 31, 2010.

  1. MGSteve

    MGSteve Well-Known Member

    As subject really, would be really cool if you could see how many users were in a particular group when the mouse is hovering over the usergroup name.

    for some reason I've got duplicated user groups and I can't tell which have users in them and which don't!
     
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Here is a query you can run to show the number of users in each group:

    Code:
    SELECT ug.title, ug.user_group_id, COUNT(*) AS numUsers
    FROM xf_user_group_relation AS ugr
    LEFT JOIN xf_user_group AS ug ON (ug.user_group_id = ugr.user_group_id)
    GROUP BY ugr.user_group_id
    
    This will return records like this:

    Screen shot 2010-12-31 at 9.39.17 AM.png

    This counts both primary and secondary group memberships.
     
    Jarod, MGSteve and Brogan like this.
  3. Brogan

    Brogan XenForo Moderator Staff Member

    Nice one Jake :)
     
  4. MGSteve

    MGSteve Well-Known Member

    Yup, i did much the same myself in the end, but just thought it would be useful feature to have, without having to whip out the SQL ;)
     
  5. hathway

    hathway Member

    Is there a query that can be run which shows the primary and secondary users separate?
     
  6. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Code:
    SELECT ug.title, ug.user_group_id, IF(ugr.is_primary = 1, 'PRIMARY', 'SECONDARY') AS type, COUNT(*) AS numUsers
    FROM xf_user_group_relation AS ugr
    LEFT JOIN xf_user_group AS ug ON (ug.user_group_id = ugr.user_group_id)
    GROUP BY ugr.user_group_id, ugr.is_primary;
    
    Screen shot 2012-02-10 at 12.36.48 AM.png
     
  7. hathway

    hathway Member

    Thank you Jake :)
     

Share This Page