FM Themes
Welcome to FM Themes
where you can share your ModernBB, punBB, phpBB 2, Invision, & phpBB 3 themes for Forumotion forums.

You are viewing the forum as a guest, so you will not be able to use the full forum. To use all the features of the forum, you need to log in or create a FREE account by registering.
Share
View previous topicGo downView next topic
avatar
Administrator
Administrator
Posts : 3943
Points : 1840
Reputation : 311
View user profilehttps://www.fmthemes.net

Solved Adding Groups Column To Memberlist

on Tue Apr 28, 2015 5:21 pm
I have been trying to add the groups column to the memberlist, but the information does not appear unless you sorted the list by groups.  The column appears with no information.  I tried to modify the memberlist template.


Last edited by SLGray on Wed May 06, 2015 1:38 pm; edited 1 time in total
avatar
Administrator
Administrator
Posts : 517
Points : 2280
Reputation : 70
View user profilehttp://broadcastingduo.forumotion.com/

Solved Re: Adding Groups Column To Memberlist

on Wed Apr 29, 2015 7:18 am
Is this for FMThemes? May you provide a screenshot and/or link to the topic or tutorial you saw this in?
avatar
Administrator
Administrator
Posts : 3943
Points : 1840
Reputation : 311
View user profilehttps://www.fmthemes.net

Solved Re: Adding Groups Column To Memberlist

on Wed Apr 29, 2015 9:58 pm
It is for FM Themes.  I have not used a tutorial.

I was going to post a tutorial about it.
avatar
Administrator
Administrator
Posts : 517
Points : 2280
Reputation : 70
View user profilehttp://broadcastingduo.forumotion.com/

Solved Re: Adding Groups Column To Memberlist

on Wed Apr 29, 2015 10:07 pm
Well what is the code(s) for it?
avatar
VIP Member
VIP Member
Posts : 15
Points : 308
Reputation : 4
View user profile

Solved Re: Adding Groups Column To Memberlist

on Thu Apr 30, 2015 11:39 am
Message reputation : 100% (1 vote)
@SLGray

Hello, see if the code below help you on something:
Code:

jQuery(function() {
   // Reads the label of the groups in the index...
   $.get('/', function(data) {
      var isSortbyGrp = location.search.indexOf('groups');
      if (isSortbyGrp == -1) {
         jQuery('th.tcl.memberlist').after('<th class="tc2">Usergroups</th>');
      }
      var aGroup = jQuery('#onlinelist p:last', data),
         oTarget = jQuery('td.tcl.avatar-mini'),
         oThis = null,
         color = null;

      for (i = 0, len = oTarget.length; i < len; i++) {
         oThis = jQuery(oTarget[i]);

         color = oThis.find('.gen span:last').attr('style');
         if (color !== undefined) {
            if (isSortbyGrp == -1) {
               oThis.after('<td class="tc2">' + aGroup.find('a[style="' + color.replace(':', ': ') + '"]').prop('outerHTML') + '</td>');
            } else {
               oThis.next().html(aGroup.find('a[style="' + color.replace(':', ': ') + '"]').prop('outerHTML'));
            }
         } else {
            if (isSortbyGrp == -1) {
               oThis.after('<td class="tc2">Members</td>');
            }
         }
      }
      //}).done(function(data) {
   });
});

Result: https://i.imgur.com/XPHG5PG.png

The code is only a sketch, it can become much better and available to all versions in a single JavaScript for example.

So long,

JS
avatar
Administrator
Administrator
Posts : 3943
Points : 1840
Reputation : 311
View user profilehttps://www.fmthemes.net

Solved Re: Adding Groups Column To Memberlist

on Thu Apr 30, 2015 6:45 pm
Thanks @"JScript " .

It did add the column and groups.  There is an issue when you sort by groups.  It does not group them together.
avatar
VIP Member
VIP Member
Posts : 15
Points : 308
Reputation : 4
View user profile

Solved Re: Adding Groups Column To Memberlist

on Thu Apr 30, 2015 7:22 pm
SLGray wrote:(...)There is an issue when you sort by groups.  It does not group them together.  
I confess, I did not understand very well!

You refer to it: https://i.imgur.com/NqUp4u1.png ?

Could you explain better?

JS
avatar
Administrator
Administrator
Posts : 3943
Points : 1840
Reputation : 311
View user profilehttps://www.fmthemes.net

Solved Re: Adding Groups Column To Memberlist

on Thu Apr 30, 2015 8:39 pm
JScript wrote:
SLGray wrote:(...)There is an issue when you sort by groups.  It does not group them together.  
I confess, I did not understand very well!

You refer to it: https://i.imgur.com/NqUp4u1.png ?

Could you explain better?

JS
Ok.  When I tested it, it went like this:

Administrator
VIP Member
Administrator
Member

When I used the sort option.
avatar
Administrator
Administrator
Posts : 3943
Points : 1840
Reputation : 311
View user profilehttps://www.fmthemes.net

Solved Re: Adding Groups Column To Memberlist

on Sat May 02, 2015 3:51 pm
I just tested it again.  I notice why it looks messed up.  The reason why is that if you are in more than one group, you are listed in all groups.

Is there a way to remove the group option in the sort dropdown menu?
avatar
VIP Member
VIP Member
Posts : 15
Points : 308
Reputation : 4
View user profile

Solved Re: Adding Groups Column To Memberlist

on Tue May 05, 2015 8:39 am
SLGray wrote:Is there a way to remove the group option in the sort dropdown menu?
Yes!

Add this:
Code:
jQuery('option[value="groups"]').remove();

JS
avatar
Administrator
Administrator
Posts : 3943
Points : 1840
Reputation : 311
View user profilehttps://www.fmthemes.net

Solved Re: Adding Groups Column To Memberlist

on Tue May 05, 2015 11:21 pm
It does not remove it.
avatar
VIP Member
VIP Member
Posts : 15
Points : 308
Reputation : 4
View user profile

Solved Re: Adding Groups Column To Memberlist

on Wed May 06, 2015 5:54 am
Message reputation : 100% (1 vote)
SLGray wrote:It does not remove it.
Of course yes!
I do not know how you used the line of code, but try to change the current code for this:
Code:

jQuery(function() {
   if (location.pathname == "/memberlist") {
      jQuery('option[value="groups"]').remove();
      // Reads the label of the groups in the index...
      $.get('/', function(data) {
         var isSortbyGrp = location.search.indexOf('groups');
         if (isSortbyGrp == -1) {
            jQuery('th.tcl.memberlist').after('<th class="tc2">Usergroups</th>');
         }
         var aGroup = jQuery('#onlinelist p:last', data),
            oTarget = jQuery('td.tcl.avatar-mini'),
            oThis = null,
            color = null;

         for (i = 0, len = oTarget.length; i < len; i++) {
            oThis = jQuery(oTarget[i]);

            color = oThis.find('.gen span:last').attr('style');
            if (color !== undefined) {
               if (isSortbyGrp == -1) {
                  oThis.after('<td class="tc2">' + aGroup.find('a[style="' + color.replace(':', ': ') + '"]').prop('outerHTML') + '</td>');
               } else {
                  oThis.next().html(aGroup.find('a[style="' + color.replace(':', ': ') + '"]').prop('outerHTML'));
               }
            } else {
               if (isSortbyGrp == -1) {
                  oThis.after('<td class="tc2">Members</td>');
               }
            }
         }
         //}).done(function(data) {
      });
   }
});

JS
avatar
Administrator
Administrator
Posts : 3943
Points : 1840
Reputation : 311
View user profilehttps://www.fmthemes.net

Solved Re: Adding Groups Column To Memberlist

on Wed May 06, 2015 1:37 pm
Thanks @JScript . It works perfectly now.

Topic solved and archived
avatar
Administrator
Administrator
Posts : 3943
Points : 1840
Reputation : 311
View user profilehttps://www.fmthemes.net

Solved Re: Adding Groups Column To Memberlist

on Sat Jul 11, 2015 9:44 pm
@JScript

Please create a tutorial for this coding.
View previous topicBack to topView next topic
Permissions in this forum:
You cannot reply to topics in this forum