FM Themes
Welcome to FM Themes
where you can share your 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.

Adding Groups Column To Memberlist

View previous topic View next topic Go down

SLGray
Administrator
Reputation : 290
Points : 1514
Posts : 3644
View user profile http://fmthemes.forumotion.com

PostSLGray 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
brandon_g
Coder
Reputation : 67
Points : 2249
Posts : 492
View user profile http://broadcastingduo.forumotion.com/

Postbrandon_g 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?
SLGray
Administrator
Reputation : 290
Points : 1514
Posts : 3644
View user profile http://fmthemes.forumotion.com

PostSLGray 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.
brandon_g
Coder
Reputation : 67
Points : 2249
Posts : 492
View user profile http://broadcastingduo.forumotion.com/

Postbrandon_g on Wed Apr 29, 2015 10:07 pm

Well what is the code(s) for it?
JScript
Tutor
Reputation : 2
Points : 306
Posts : 15
View user profile

PostJScript on Thu Apr 30, 2015 11:39 am

[You must be registered and logged in to see this link.]

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: [You must be registered and logged in to see this link.]

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
SLGray
Administrator
Reputation : 290
Points : 1514
Posts : 3644
View user profile http://fmthemes.forumotion.com

PostSLGray 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.
JScript
Tutor
Reputation : 2
Points : 306
Posts : 15
View user profile

PostJScript on Thu Apr 30, 2015 7:22 pm

[You must be registered and logged in to see this link.] 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: [You must be registered and logged in to see this link.] ?

Could you explain better?

JS
SLGray
Administrator
Reputation : 290
Points : 1514
Posts : 3644
View user profile http://fmthemes.forumotion.com

PostSLGray on Thu Apr 30, 2015 8:39 pm

[You must be registered and logged in to see this link.] wrote:
[You must be registered and logged in to see this link.] 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: [You must be registered and logged in to see this link.] ?

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.
SLGray
Administrator
Reputation : 290
Points : 1514
Posts : 3644
View user profile http://fmthemes.forumotion.com

PostSLGray 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?
JScript
Tutor
Reputation : 2
Points : 306
Posts : 15
View user profile

PostJScript on Tue May 05, 2015 8:39 am

[You must be registered and logged in to see this link.] 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
SLGray
Administrator
Reputation : 290
Points : 1514
Posts : 3644
View user profile http://fmthemes.forumotion.com

PostSLGray on Tue May 05, 2015 11:21 pm

It does not remove it.
JScript
Tutor
Reputation : 2
Points : 306
Posts : 15
View user profile

PostJScript on Wed May 06, 2015 5:54 am

[You must be registered and logged in to see this link.] 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
SLGray
Administrator
Reputation : 290
Points : 1514
Posts : 3644
View user profile http://fmthemes.forumotion.com

PostSLGray on Wed May 06, 2015 1:37 pm

Thanks [You must be registered and logged in to see this link.] . It works perfectly now.

Topic solved and archived
SLGray
Administrator
Reputation : 290
Points : 1514
Posts : 3644
View user profile http://fmthemes.forumotion.com

PostSLGray on Sat Jul 11, 2015 9:44 pm

[You must be registered and logged in to see this link.]

Please create a tutorial for this coding.

View previous topic View next topic Back to top

Create an account or log in to leave a reply

You need to be a member in order to leave a reply.

Create an account

Join our community by creating a new account. It's easy!


Create a new account

Log in

Already have an account? No problem, log in here.


Log in

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