Latest topics
» [HELP] About Profile Cover Code
by MaHwOs Yesterday at 18:54

» bloquer un membre
by berlingo Fri 17 Nov 2017, 18:19

» IconSkouliki Graphics
by skouliki Fri 17 Nov 2017, 03:54

» [IN PROGRESS] Can this code work on pun version
by skouliki Thu 16 Nov 2017, 03:50

» Auto-suggest @mentions as You Type
by skouliki Wed 15 Nov 2017, 14:56

» [TUTORIAL] [ALL VERSIONS] Warning before posting
by demon99 Wed 15 Nov 2017, 08:12

» About Add Reply & New Topic button (popup form)
by omarpop23 Mon 13 Nov 2017, 20:31

» Hello everyone this is Adam from France
by Adam Mon 13 Nov 2017, 13:32

» Add a login popup for the toolbar
by Ape Sun 12 Nov 2017, 18:41

» Post a message automatically when locking a topic
by ThunderTB Sun 12 Nov 2017, 13:51

» Control pannel issue
by Ange Tuteur Sun 12 Nov 2017, 09:49

» BUG... forum members birthday's
by Ape Sat 11 Nov 2017, 11:44

» Display a Preview of Groups on Hover
by ThunderTB Fri 10 Nov 2017, 21:56

» Search box only visible on hover
by Ange Tuteur Mon 06 Nov 2017, 09:57

» [GAME] Animal Game
by SLGray Sun 05 Nov 2017, 15:04

Recent Tutorials
Who is online?
In total there are 7 users online :: 0 Registered, 0 Hidden and 7 Guests :: 1 Bot

None

[ View the whole list ]


Most users ever online was 172 on Fri 19 Feb 2016, 05:17

_userdata.usergroup

Page 1 of 2 1, 2  Next

View previous topic View next topic Go down

avatar
Ace 1
Valued Member
Title :

Beta Tester
Gender : Unspecified
Age : 18
Posts : 2151
Points : 2950
Reputation : 88
Location : USA
Language : English ?
Browser : Browser : Google Chrome Forum Version : Forum Version : phpBB3
Awards :
View all awards
View user profile http://fmdesign.forumotion.com/u190

PostAce 1 on Mon 14 Nov 2016, 09:16

With this plugin, the variable
Code:
_userdata.usergroup
is now accessible on any forum version (including FAE).


Installation


Administration Panel > Modules > HTML & Javascript > Javascript codes management > Create new javascript

Title: _userdata.usergroup
Placement: In all the pages

Code:

Code:
$(function() {
  '_userdata.usergroup ©️️ 2017 Version 5.0';
  'Developed by Ace 1';
  'All rights reserved';
 
  window.faGroups = {
    groupIDs: [1, 2, 3], // list of groupIDs
    cacheTime: 30, // time in minutes to store data
 
    multipleGroups: false, // enable to return all groups the user is in
 
    storage: window.localStorage,
    user_id: _userdata.session_logged_in ? _userdata.user_id : 0,
 
    setGroup: function() {
      var group,
          i = 0, j;
 
      if (faGroups.storage && faGroups.user_id > 0) {
        if (!faGroups.storage['ug' + faGroups.user_id] || !(faGroups.storage['ug' + faGroups.user_id + '_exp'] > new Date().getTime() - faGroups.cacheTime * 60 * 1000)) {
          $.ajax({
            url: '/groups',
            type: 'get',
            async: false,
            success: function(d) {
              if (faGroups.multipleGroups) group = [];
         
              for (; i < faGroups.groupIDs.length; i++) {
                j = $('ul.noList a[href^="/g' + faGroups.groupIDs[i] + '-', d);
 
                if (j[0]) {
                  if (!faGroups.multipleGroups) {
                    group = faGroups.groupIDs[i];
                    i = faGroups.groupIDs.length;
                  } else {
                    group.push(faGroups.groupIDs[i]);
                  }
                }
              }
             
              faGroups.storage['ug' + faGroups.user_id] = group ? JSON.stringify(group) : group;
              faGroups.storage['ug' + faGroups.user_id + '_exp'] = new Date().getTime();
            }
          });
        }
 
        // sets _userdata.usergroup to the user's current group
        if (faGroups.storage['ug' + faGroups.user_id] != 'undefined') {
          try {
            _userdata.usergroup = JSON.parse(faGroups.storage['ug' + faGroups.user_id]);
          } catch(e) {
            _userdata.usergroup = faGroups.storage['ug' + faGroups.user_id];
          }
        } else {
          _userdata.usergroup = -1; // user not within any group
        }
      } else {
        _userdata.usergroup = 0; // _userdata.session_logged_in == 0
      }
    },
 
    returnGroups: function() {
      if (!_userdata.usergroup) return;
 
      return JSON.parse(faGroups.storage['ug' + faGroups.user_id]);
    },
 
    checkGroups: function() {
      var groups_to_check = [].slice.apply(arguments),
          user_groups,
          in_groups;
 
      if (groups_to_check.length < 1 || !_userdata.usergroup) return;
 
      user_groups = _userdata.usergroup;
 
      if (typeof user_groups == 'object') {
        // usergroup == array
   
        if (groups_to_check.length > 1) {
          // arguments == array
          in_groups = user_groups.every(function(val) {
            return groups_to_check.indexOf(val) > -1;
          });
     
          return in_groups ? true : false;
        } else {
          // arguments == string
          return user_groups.indexOf(groups_to_check[0]) > -1 ? true : false;
        }
      } else {
        // usergroup == string
   
        if (groups_to_check.length > 1) {
          // arguments == array
          return false;
     
        } else {
          // arguments == string
          return groups_to_check[0] == user_groups ? true : false;
        }
      }
    }
  };
 
  faGroups.setGroup();
 
  /*** Progress
    var logs = {
      'Version 1.0': 'Developed',
      'Version 2.0': 'Enabled values -1 and 0 (no groups and not logged in, respectively)',
      'Version 3.0': 'Enhanced and simplified',
      'Version 4.0': 'Enabled multipleGroups, returnGroups(), checkGroups(args)'
      'Version 5.0': 'Patched unexpected tokens in JSON as well as errors when _userdata.session_logged_in == 0'
    };
  ***/
});

Note: This is not optimized for special moderation privileges. It is not secure. If you want a javascript that is, then just leave a comment below.


Modifications


I think the modifications are pretty self-explanatory. If anyone has an issue, then feel free to leave a reply on this thread.


Group IDs
Code:
    groupIDs: [ 1, 2, 3 ],
The array
Code:
1, 2, 3
is the order of group IDs on your forum,
Code:
1
having the highest priority and
Code:
3
having the lowest.


Cache Time
Code:
    cacheTime: 30,
The amount of time that usergroups are checked.
Code:
30
is the amount of minutes your browser will store the usergroup number.


New! Multiple Groups Option
Code:
    multipleGroups: false,
This is new and I got motivation to work on it, thanks to @STBW. Basically, when this is set to
Code:
true
, all usergroups that a user is in will be searched for and stored, as opposed to just the highest usergroup. If you don't care about lower usergroups that a user is in, then leave this as is.


Use


You're probably wondering how this would be useful. With this plugin comes two new functions. One that can return the group(s) that the user is in (depending on what
Code:
multipleGroups
is set to) and another that can check if the user is in the group(s) passed into the function.


New! returnGroups
Code:
faGroups.returnGroups();

// will return a number or an array


New! checkGroups
Code:
faGroups.checkGroups(1);
faGroups.checkGroups(1, 2, ...);

// will return true or false


Let's put these to use. For example, if you are using FAE and wanted to change the background for all Administrator group members when they visit the forum, you would add the following JavaScript:

Code:
$(function() {
    faGroups.checkGroups(1) && $('#fa_edge').css('background-color', 'black');
});

Since, on any Forumotion forum, the administrator group ID will always be
Code:
1
.



Also, these are some key numbers that you should know if you use this plugin.

When
Code:
_userdata.usergroup
is:

Code:
0
, the user is not logged in
Code:
-1
, the user is not in any group

I hope you guys like it

Rose


Last edited by Ace 1 on Fri 06 Oct 2017, 09:53; edited 17 times in total
avatar
Ange Tuteur
Administrator
Title :
Coffee Addict
Gender : Male
Age : 22
Posts : 4712
Points : 9586
Reputation : 2341
Location : Macungie, PA
Language : EN10, FR5
Browser : Browser : Brave Forum Version : Forum Version : Forumactif Edge
Awards :
View all awards
View user profile https://github.com/SethClydesdale https://twitter.com/sethc1995

PostAnge Tuteur on Mon 14 Nov 2016, 10:04

@Ace 1 nice utility ! This'll definitely make it easier for people who want to identify what group a user is in. I remember a few people asked for something like this in the past -- showing something specific for certain groups.

Keep it up Thumb right
avatar
Ace 1
Valued Member
Title :

Beta Tester
Gender : Unspecified
Age : 18
Posts : 2151
Points : 2950
Reputation : 88
Location : USA
Language : English ?
Browser : Browser : Google Chrome Forum Version : Forum Version : phpBB3
Awards :
View all awards
View user profile http://fmdesign.forumotion.com/u190

PostAce 1 on Mon 14 Nov 2016, 10:18

I was one of those people Razz

Thank you by the way.
avatar
STBW

Title :
Gender : Unspecified
Posts : 33
Points : 1029
Reputation : 2
Language : Spanish
Browser : Browser : Google Chrome Forum Version : Forum Version : Forumactif Edge
Awards :
View all awards
View user profile

PostSTBW on Thu 17 Nov 2016, 05:03

I cannot achieve to make it work. Is supposed that I can put any ID of a group on this part no? (the zone colored with red)

if ( _userdata.usergroup == 1 )

Or it only works for Admin Id? Because when I put 1 it works.. but with any other ID (98 for example) it does not! Sad
avatar
Ace 1
Valued Member
Title :

Beta Tester
Gender : Unspecified
Age : 18
Posts : 2151
Points : 2950
Reputation : 88
Location : USA
Language : English ?
Browser : Browser : Google Chrome Forum Version : Forum Version : phpBB3
Awards :
View all awards
View user profile http://fmdesign.forumotion.com/u190

PostAce 1 on Thu 17 Nov 2016, 11:29

@STBW I think I could've been a tad more specific when I explained it. The red number in your post is supposed to be the group ID.

http://fmdesign.forumotion.com/g2-administrators
http::::fmdesign.forumotion.com/g2-administrators

So with the following Javascript:

Code:
$(function() {
  if ( _userdata.usergroup == 2 ) {
    // code to execute for administrators
    console.log('Hi Admin.');
  }
});

That code will be executed for Ange Tuteur and Leah7.
avatar
STBW

Title :
Gender : Unspecified
Posts : 33
Points : 1029
Reputation : 2
Language : Spanish
Browser : Browser : Google Chrome Forum Version : Forum Version : Forumactif Edge
Awards :
View all awards
View user profile

PostSTBW on Thu 17 Nov 2016, 12:19

It works when I put as ID 1 but do not work when I want to use it for group ID 98

I do not know if it is because is a number of 2 characters... (digits) or what

And one question apart, do someone know how to reset the group IDs? I mean, because if the group that used to have ID 3 is deleted.. how it can restart? to do not end having long IDs like 100 etc..

EDITED
: I do not think is due the digits, because I tested it with ID 2 and did not work pale but it works on ID 1 Neutral
avatar
Ace 1
Valued Member
Title :

Beta Tester
Gender : Unspecified
Age : 18
Posts : 2151
Points : 2950
Reputation : 88
Location : USA
Language : English ?
Browser : Browser : Google Chrome Forum Version : Forum Version : phpBB3
Awards :
View all awards
View user profile http://fmdesign.forumotion.com/u190

PostAce 1 on Thu 17 Nov 2016, 12:46

Can you give me your forum URL?
avatar
jessy

Title :
Gender : Female
Posts : 102
Points : 790
Reputation : 14
Language : italy
Browser : Browser : Google Chrome Forum Version : Forum Version : Invision
Awards :
View all awards
View user profile http://ilgiornaledibordo.forumattivo.com/

Postjessy on Thu 17 Nov 2016, 13:28



I modified :

Code:
 number_of_groups: 10, // max number of groups

added:

Code:
;$(function() {
    if ( _userdata.usergroup == 7 ) $('body').css('background-color', 'red');
});$(function() {
    if ( _userdata.usergroup == 4 ) $('body').css('background-color', 'lime');
});

does not work.thanks for your time
avatar
SLGray
Valued Member
Title :
Owner of 2 Forums
Gender : Male
Age : 44
Posts : 2455
Points : 4771
Reputation : 287
Location : United States
Language : English
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : ModernBB
Awards :
View all awards
View user profile http://www.fmthemes.forumotion.com https://www.facebook.com/FM-Themes-655055824604957 https://twitter.com/FMThemes https://pinterest.com/FMThemes

PostSLGray on Thu 17 Nov 2016, 20:30

Exactly is not the group ID: the letter and number?
avatar
STBW

Title :
Gender : Unspecified
Posts : 33
Points : 1029
Reputation : 2
Language : Spanish
Browser : Browser : Google Chrome Forum Version : Forum Version : Forumactif Edge
Awards :
View all awards
View user profile

PostSTBW on Fri 18 Nov 2016, 04:28

avatar
Ace 1
Valued Member
Title :

Beta Tester
Gender : Unspecified
Age : 18
Posts : 2151
Points : 2950
Reputation : 88
Location : USA
Language : English ?
Browser : Browser : Google Chrome Forum Version : Forum Version : phpBB3
Awards :
View all awards
View user profile http://fmdesign.forumotion.com/u190

PostAce 1 on Mon 21 Nov 2016, 08:35

jessy wrote:

I modified :

Code:
 number_of_groups: 10, // max number of groups

added:

Code:
;$(function() {
    if ( _userdata.usergroup == 7 ) $('body').css('background-color', 'red');
});$(function() {
    if ( _userdata.usergroup == 4 ) $('body').css('background-color', 'lime');
});

does not work.thanks for your time

@jessy Since you're using Invision, replace your code with this:

Code:
$(function() {
    if ( _userdata.usergroup == 7 ) $('#ipbwrapper').css('background-color', 'red');
});$(function() {
    if ( _userdata.usergroup == 4 ) $('#ipbwrapper').css('background-color', 'lime');
});

SLGray wrote:Exactly is not the group ID: the letter and number?

When I say ID I mean the number alone.

STBW wrote:Yes, it is: http://www.live-the-worldwide.com/

@STBW I'm going to need you to try the code and press Ctrl + Shift + J, type _userdata.usergroup inside the console, and press Enter. Let me know what number appears (if any).

avatar
STBW

Title :
Gender : Unspecified
Posts : 33
Points : 1029
Reputation : 2
Language : Spanish
Browser : Browser : Google Chrome Forum Version : Forum Version : Forumactif Edge
Awards :
View all awards
View user profile

PostSTBW on Mon 21 Nov 2016, 08:41

Appears the number 1
avatar
Ace 1
Valued Member
Title :

Beta Tester
Gender : Unspecified
Age : 18
Posts : 2151
Points : 2950
Reputation : 88
Location : USA
Language : English ?
Browser : Browser : Google Chrome Forum Version : Forum Version : phpBB3
Awards :
View all awards
View user profile http://fmdesign.forumotion.com/u190

PostAce 1 on Mon 21 Nov 2016, 09:18

Okay, so keep in mind that that number is the ID you need to use.

And I've also changed the code a tad bit because there was a discrepancy that you brought to my attention.
avatar
STBW

Title :
Gender : Unspecified
Posts : 33
Points : 1029
Reputation : 2
Language : Spanish
Browser : Browser : Google Chrome Forum Version : Forum Version : Forumactif Edge
Awards :
View all awards
View user profile

PostSTBW on Mon 21 Nov 2016, 11:20

Still not working for me. In the list of groupIDs you must to put all the IDs or only the ones you want to use?

Ty for your replies

EDITED: And what happens if a user is in more than one group?
avatar
Ace 1
Valued Member
Title :

Beta Tester
Gender : Unspecified
Age : 18
Posts : 2151
Points : 2950
Reputation : 88
Location : USA
Language : English ?
Browser : Browser : Google Chrome Forum Version : Forum Version : phpBB3
Awards :
View all awards
View user profile http://fmdesign.forumotion.com/u190

PostAce 1 on Mon 21 Nov 2016, 14:32

Ok @STBW I think this should have resolved the code problem. The problem was that the user you were testing for probably was not on the first page of the group URL.

For example, here on FMD:

http://fmdesign.forumotion.com/g6-auction-group is the first page of the default group.
http://fmdesign.forumotion.com/g6-auction-group?start=30 is the second page of the default group.
http://fmdesign.forumotion.com/g6-auction-group?start=60 is the last page.

I wasn't iterating through those other pages. Now the code does do that and it should work for you.

STBW wrote:EDITED: And what happens if a user is in more than one group?

If the user is in more than one group, the group that they are associated with depends on the order in which you put your groupIDs.

Code:
      groups: [ 1, 2, 3 ], // list of groupIDs

Based on my script, if a user was in group 1 and 2, then the value of
Code:
_userdata.usergroup
would be 1. And if a user was in group 2 and 3, the value would be 2.
avatar
jessy

Title :
Gender : Female
Posts : 102
Points : 790
Reputation : 14
Language : italy
Browser : Browser : Google Chrome Forum Version : Forum Version : Invision
Awards :
View all awards
View user profile http://ilgiornaledibordo.forumattivo.com/

Postjessy on Tue 22 Nov 2016, 15:03

sorry no work....maybe I'm wrong,this and all the code

Code:
$(function() {
    '_userdata.usergroup 2016';
    'Developed by Ace 1';
    'All rights reserved';
 
    window.faGroups = {
        groupIDs: [1, 4, 3], // list of groupIDs
        cacheTime: 30, // time in minutes to store data
 
        storage: window.localStorage,
        name: _userdata.username,
 
        setGroup: function() {
            var version,
                groupNumber,
                members = [],
                loop,
                i = 0,
                j;
 
            if (faGroups.storage && faGroups.name != 'Anonymous') {
                if (!faGroups.storage['group_' + faGroups.name] || !faGroups.storage['group_' + faGroups.name + '_exp'] > new Date().getTime() - faGroups.cacheTime * 60 * 1000) {
                    for (; i < faGroups.groupIDs.length; i++) {
                        version = $('#phpbb').length || $('#fa_edge').length ? 'tr[class] strong' : $('.bodylinewidth').length ? 'td[class] a strong' : 'td[class] strong';
                        j = 0;
 
                        $.ajax({
                            url: '/g' + faGroups.groupIDs[i] + '-',
                            type: 'get',
                            async: false,
                            success: function(group) {
                                $(version, group).each(function() {
                                    members.push($(this).text());
                                });
 
                                loop = (function() {
                                    if ($('a[href*="?start"] ~ a.pag-img', group).html()) {
                                        var url = $('a[href*="?start"] ~ a.pag-img', group).attr('href');
                                        $.ajax({
                                            url: url,
                                            type: 'get',
                                            async: false,
                                            success: function(extendedGroup) {
                                                $(version, extendedGroup).each(function() {
                                                    members.push($(this).text());
                                                });
                                            }
                                        });
                                        loop();
                                    }
                                })();
                            }
                        });
 
                        for (; j < members.length; j++) {
                            if (faGroups.name == members[j]) {
                                groupNumber = faGroups.groupIDs[i];
                                j = members.length; // ends loop if found
                                i = faGroups.groups.length; // ends loop if found
                            }
                        }
 
                        members = [];
                    }
 
                    faGroups.storage['group_' + faGroups.name] = groupNumber;
                    faGroups.storage['group_' + faGroups.name + '_exp'] = new Date().getTime();
                }
 
                // sets _userdata.usergroup to the user's current group
                if (Number(faGroups.storage['group_' + faGroups.name]) != NaN) {
                    _userdata.usergroup = Number(faGroups.storage['group_' + faGroups.name]);
                } else {
                    _userdata.usergroup = -1; // user not within any group
                }
            } else {
                _userdata.usergroup = 0; // _userdata.session_logged_in == 0
            }
        }
    };
 
    faGroups.setGroup();
});;$(function() {
    if ( _userdata.usergroup == 1 ) $('#ipbwrapper').css('background-color', 'red');
});$(function() {
    if ( _userdata.usergroup == 4 ) $('#ipbwrapper').css('background-color', 'lime');
});

thanks in advance
avatar
STBW

Title :
Gender : Unspecified
Posts : 33
Points : 1029
Reputation : 2
Language : Spanish
Browser : Browser : Google Chrome Forum Version : Forum Version : Forumactif Edge
Awards :
View all awards
View user profile

PostSTBW on Wed 23 Nov 2016, 11:42

Same here, still not working (in my main forum at least, I tested it in another one I own and there it worked..)
avatar
Ace 1
Valued Member
Title :

Beta Tester
Gender : Unspecified
Age : 18
Posts : 2151
Points : 2950
Reputation : 88
Location : USA
Language : English ?
Browser : Browser : Google Chrome Forum Version : Forum Version : phpBB3
Awards :
View all awards
View user profile http://fmdesign.forumotion.com/u190

PostAce 1 on Sat 03 Dec 2016, 14:16

@jessy Replace your code with this:

Code:
$(function() {
    '_userdata.usergroup 2016';
    'Developed by Ace 1';
    'All rights reserved';
 
    window.faGroups = {
        groupIDs: [1, 4, 3], // list of groupIDs
        cacheTime: 30, // time in minutes to store data
 
        storage: window.localStorage,
        name: _userdata.username,
 
        setGroup: function() {
            var version,
                groupNumber,
                members = [],
                loop,
                i = 0,
                j;
 
            if (faGroups.storage && faGroups.name != 'Anonymous') {
                if (!faGroups.storage['group_' + faGroups.name] || !faGroups.storage['group_' + faGroups.name + '_exp'] > new Date().getTime() - faGroups.cacheTime * 60 * 1000) {
                    for (; i < faGroups.groupIDs.length; i++) {
                        version = $('#phpbb').length || $('#fa_edge').length ? 'tr[class] strong' : $('.bodylinewidth').length ? 'td[class] a strong' : 'td[class] strong';
                        j = 0;
 
                        $.ajax({
                            url: '/g' + faGroups.groupIDs[i] + '-',
                            type: 'get',
                            async: false,
                            success: function(group) {
                                $(version, group).each(function() {
                                    members.push($(this).text());
                                });
 
                                loop = (function() {
                                    if ($('a[href*="?start"] ~ a.pag-img', group).html()) {
                                        var url = $('a[href*="?start"] ~ a.pag-img', group).attr('href');
                                        $.ajax({
                                            url: url,
                                            type: 'get',
                                            async: false,
                                            success: function(extendedGroup) {
                                                $(version, extendedGroup).each(function() {
                                                    members.push($(this).text());
                                                });
                                            }
                                        });
                                        loop();
                                    }
                                })();
                            }
                        });
 
                        for (; j < members.length; j++) {
                            if (faGroups.name == members[j]) {
                                groupNumber = faGroups.groupIDs[i];
                                j = members.length; // ends loop if found
                                i = faGroups.groups.length; // ends loop if found
                            }
                        }
 
                        members = [];
                    }
 
                    faGroups.storage['group_' + faGroups.name] = groupNumber;
                    faGroups.storage['group_' + faGroups.name + '_exp'] = new Date().getTime();
                }
 
                // sets _userdata.usergroup to the user's current group
                if (Number(faGroups.storage['group_' + faGroups.name]) != NaN) {
                    _userdata.usergroup = Number(faGroups.storage['group_' + faGroups.name]);
                } else {
                    _userdata.usergroup = -1; // user not within any group
                }
            } else {
                _userdata.usergroup = 0; // _userdata.session_logged_in == 0
            }
        }
    };
 
    faGroups.setGroup();
});

$(function() {
    if ( _userdata.usergroup == 1 ) {
        $('#ipbwrapper').css('background-color', 'red');
    } else if ( _userdata.usergroup == 4 ) {
        $('#ipbwrapper').css('background-color', 'lime');
    }
});

@STBW I'm still working on a way around the high digits thing. Don't worry. I should be done in the next week.
avatar
jessy

Title :
Gender : Female
Posts : 102
Points : 790
Reputation : 14
Language : italy
Browser : Browser : Google Chrome Forum Version : Forum Version : Invision
Awards :
View all awards
View user profile http://ilgiornaledibordo.forumattivo.com/

Postjessy on Sun 04 Dec 2016, 10:14

does not work,never mind thank you very much for your availability
avatar
Ace 1
Valued Member
Title :

Beta Tester
Gender : Unspecified
Age : 18
Posts : 2151
Points : 2950
Reputation : 88
Location : USA
Language : English ?
Browser : Browser : Google Chrome Forum Version : Forum Version : phpBB3
Awards :
View all awards
View user profile http://fmdesign.forumotion.com/u190

PostAce 1 on Fri 23 Dec 2016, 04:47

@STBW @jessy Sorry for the wait guys. I updated the original code. The new code works for me. Let me know what happens on your ends.
avatar
STBW

Title :
Gender : Unspecified
Posts : 33
Points : 1029
Reputation : 2
Language : Spanish
Browser : Browser : Google Chrome Forum Version : Forum Version : Forumactif Edge
Awards :
View all awards
View user profile

PostSTBW on Sat 14 Jan 2017, 01:11

A lot of thaaankss!! it seems to work!

But, when you add or remove a user of the group... the changes are not working until you closes and reopens the browser (I changed the cacheTime: 30, // time in minutes to cacheTime: 2, // time in minutes and waited the 2 minutes... but nothing happened after refreshed the page)

Will be good that the changes really were applied after passed the time cached, ty in advance



avatar
Ace 1
Valued Member
Title :

Beta Tester
Gender : Unspecified
Age : 18
Posts : 2151
Points : 2950
Reputation : 88
Location : USA
Language : English ?
Browser : Browser : Google Chrome Forum Version : Forum Version : phpBB3
Awards :
View all awards
View user profile http://fmdesign.forumotion.com/u190

PostAce 1 on Sun 29 Jan 2017, 19:30

@STBW Oh mg I found out the problem.

It, and all other tutos I put out, should be working.
avatar
STBW

Title :
Gender : Unspecified
Posts : 33
Points : 1029
Reputation : 2
Language : Spanish
Browser : Browser : Google Chrome Forum Version : Forum Version : Forumactif Edge
Awards :
View all awards
View user profile

PostSTBW on Mon 27 Feb 2017, 11:17

The code does not work for more than one function, how can I add more functions and make them work for a member that is in the required groups?

For example, there are 2 functions:

1) One that makes red bg for group 117
2) Other that makes appear green font color for group 116..

The problem is, that... I want the 2 functions work at same time, but only works one (usually the first one of the array). I want that the member who is on both groups (116 & 117) sees the red bg and the green font, but only one of them works.

Idk if I explained well my problem >.<
avatar
Ace 1
Valued Member
Title :

Beta Tester
Gender : Unspecified
Age : 18
Posts : 2151
Points : 2950
Reputation : 88
Location : USA
Language : English ?
Browser : Browser : Google Chrome Forum Version : Forum Version : phpBB3
Awards :
View all awards
View user profile http://fmdesign.forumotion.com/u190

PostAce 1 on Thu 02 Mar 2017, 09:30

STBW wrote:The code does not work for more than one function, how can I add more functions and make them work for a member that is in the required groups?

For example, there are 2 functions:

1) One that makes red bg for group 117
2) Other that makes appear green font color for group 116..

The problem is, that... I want the 2 functions work at same time, but only works one (usually the first one of the array). I want that the member who is on both groups (116 & 117) sees the red bg and the green font, but only one of them works.

Idk if I explained well my problem >.<

@STBW

I see what you're saying. Hm.. I don't know if I can make a script that checks for ALL groups a user is in without putting a lot of stress on your browser every half an hour or so. The script above just gets the first group (based off the numbers you entered in the array) like you said. If I were to check for all groups, then I would probably have to make an array of all the groups that the logged on user is in. It's definitely possible and if it's really important to you, I can make this a priority. Just shoot me a post on this topic letting me know. And also, make sure you tag me because FMD is kinda inactive.

How many groups do you have on your forum?
avatar
STBW

Title :
Gender : Unspecified
Posts : 33
Points : 1029
Reputation : 2
Language : Spanish
Browser : Browser : Google Chrome Forum Version : Forum Version : Forumactif Edge
Awards :
View all awards
View user profile

PostSTBW on Fri 03 Mar 2017, 02:38

A lot of thanks! @Ace 1 for your perseverance! Smile

Yeah I am interested, but about how many groups I have... it is something that probably will change every now and then (because we are a roleplaying site.. and each RP group has its own FM group, so if a new RP group is created we create a new FM Group)

So.. I do not know what to answer to this, is it very important? What if I only will apply that rule to 20 specific groups? Let me know any other info you need!

A lot of thanks! Very Happy

Page 1 of 2 1, 2  Next

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