FM Design
Would you like to react to this message? Create an account in a few clicks or log in to continue.

IMPORTANT

FM Design is in read-only mode, please click here for more information.

Latest topics
» Forumactif Edge - Releases
by Ange Tuteur Tue 03 Sep 2019, 11:49

» GIFActif - Giphy Button for the Editor
by Ange Tuteur Wed 08 May 2019, 17:21

» Forum Closure
by Ange Tuteur Mon 01 Jan 2018, 01:28

» Chit Chat Thread
by Valoish Sun 31 Dec 2017, 19:15

» Font/Text background color.
by Valoish Sun 31 Dec 2017, 19:11

» Forumactif Messenger - Instant Message Application for Forumotion
by Wolfuryo Sun 31 Dec 2017, 18:24

» [GAME] Count to One Million!
by brandon_g Fri 29 Dec 2017, 18:58

» Post Cards
by manikbiradar Wed 20 Dec 2017, 07:50

» [GAME] Countdown from 200,000
by Valoish Wed 13 Dec 2017, 23:22

» GeekPolice Tech Support Forums - GeekPolice.net
by Dr Jay Mon 11 Dec 2017, 19:12

» Asking about some plugin for Forumotion
by Dr Jay Mon 11 Dec 2017, 19:10

» [GAME] What are you thinking right now?
by Van-Helsing Sat 09 Dec 2017, 14:51

» Widget : Similar topics
by ranbac Wed 06 Dec 2017, 18:11

» Change the Background of the Forum and put an image and how to make prefixs?
by Clement Wed 06 Dec 2017, 15:19

» Hello from Western Australia
by SarkZKalie Wed 06 Dec 2017, 05:34

Recent Tutorials
Top posting users this month

Who is online?
In total there are 12 users online :: 0 Registered, 0 Hidden and 12 Guests :: 2 Bots

None

[ View the whole list ]


Most users ever online was 515 on Tue 14 Sep 2021, 15:24

_userdata.usergroup

Page 1 of 2 1, 2  Next

View previous topic View next topic Go down

Ace 1
Ace 1
Valued Member
Gender : Unspecified
Age : 25
Posts : 2153
Points : 5530
Reputation : 95
Location : USA
Language : English ?
Browser : Browser : Google Chrome Forum Version : Forum Version : phpBB3
https://fmdesign.forumotion.com/u190

PostAce 1 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
Ange Tuteur
Ange Tuteur
Administrator
Gender : Male
Posts : 4741
Points : 12255
Reputation : 2376
Location : Pennsylvania
Language : EN, JA, FR
Browser : Browser : Brave Forum Version : Forum Version : Forumactif Edge
https://sethclydesdale.github.io/ https://twitter.com/sethc1995

PostAnge Tuteur 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
Ace 1
Ace 1
Valued Member
Gender : Unspecified
Age : 25
Posts : 2153
Points : 5530
Reputation : 95
Location : USA
Language : English ?
Browser : Browser : Google Chrome Forum Version : Forum Version : phpBB3
https://fmdesign.forumotion.com/u190

PostAce 1 Mon 14 Nov 2016, 10:18

I was one of those people Razz

Thank you by the way.
STBW
STBW

Gender : Unspecified
Posts : 33
Points : 3590
Reputation : 2
Language : Spanish
Browser : Browser : Google Chrome Forum Version : Forum Version : Forumactif Edge

PostSTBW 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
Ace 1
Ace 1
Valued Member
Gender : Unspecified
Age : 25
Posts : 2153
Points : 5530
Reputation : 95
Location : USA
Language : English ?
Browser : Browser : Google Chrome Forum Version : Forum Version : phpBB3
https://fmdesign.forumotion.com/u190

PostAce 1 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.

https://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.
STBW
STBW

Gender : Unspecified
Posts : 33
Points : 3590
Reputation : 2
Language : Spanish
Browser : Browser : Google Chrome Forum Version : Forum Version : Forumactif Edge

PostSTBW 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
Ace 1
Ace 1
Valued Member
Gender : Unspecified
Age : 25
Posts : 2153
Points : 5530
Reputation : 95
Location : USA
Language : English ?
Browser : Browser : Google Chrome Forum Version : Forum Version : phpBB3
https://fmdesign.forumotion.com/u190

PostAce 1 Thu 17 Nov 2016, 12:46

Can you give me your forum URL?
jessy
jessy

Gender : Female
Posts : 102
Points : 3351
Reputation : 14
Language : italy
Browser : Browser : Google Chrome Forum Version : Forum Version : Invision
http://ilgiornaledibordo.forumattivo.com/

Postjessy Thu 17 Nov 2016, 13:28

_userdata.usergroup Chiuso21

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
SLGray
SLGray
Valued Member
Gender : Male
Age : 51
Posts : 2465
Points : 7347
Reputation : 290
Location : United States
Language : English
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : ModernBB
http://www.fmthemes.forumotion.com https://www.facebook.com/FM-Themes-655055824604957 https://twitter.com/FMThemes https://pinterest.com/FMThemes

PostSLGray Thu 17 Nov 2016, 20:30

Exactly is not the group ID: the letter and number?
STBW
STBW

Gender : Unspecified
Posts : 33
Points : 3590
Reputation : 2
Language : Spanish
Browser : Browser : Google Chrome Forum Version : Forum Version : Forumactif Edge

PostSTBW Fri 18 Nov 2016, 04:28

Ace 1
Ace 1
Valued Member
Gender : Unspecified
Age : 25
Posts : 2153
Points : 5530
Reputation : 95
Location : USA
Language : English ?
Browser : Browser : Google Chrome Forum Version : Forum Version : phpBB3
https://fmdesign.forumotion.com/u190

PostAce 1 Mon 21 Nov 2016, 08:35

jessy wrote:_userdata.usergroup Chiuso21

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/ _userdata.usergroup 1f601

@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).

_userdata.usergroup Captur19
STBW
STBW

Gender : Unspecified
Posts : 33
Points : 3590
Reputation : 2
Language : Spanish
Browser : Browser : Google Chrome Forum Version : Forum Version : Forumactif Edge

PostSTBW Mon 21 Nov 2016, 08:41

Appears the number 1
Ace 1
Ace 1
Valued Member
Gender : Unspecified
Age : 25
Posts : 2153
Points : 5530
Reputation : 95
Location : USA
Language : English ?
Browser : Browser : Google Chrome Forum Version : Forum Version : phpBB3
https://fmdesign.forumotion.com/u190

PostAce 1 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.
STBW
STBW

Gender : Unspecified
Posts : 33
Points : 3590
Reputation : 2
Language : Spanish
Browser : Browser : Google Chrome Forum Version : Forum Version : Forumactif Edge

PostSTBW 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 _userdata.usergroup 1f603

EDITED: And what happens if a user is in more than one group?
Ace 1
Ace 1
Valued Member
Gender : Unspecified
Age : 25
Posts : 2153
Points : 5530
Reputation : 95
Location : USA
Language : English ?
Browser : Browser : Google Chrome Forum Version : Forum Version : phpBB3
https://fmdesign.forumotion.com/u190

PostAce 1 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:

https://fmdesign.forumotion.com/g6-auction-group is the first page of the default group.
https://fmdesign.forumotion.com/g6-auction-group?start=30 is the second page of the default group.
https://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.
jessy
jessy

Gender : Female
Posts : 102
Points : 3351
Reputation : 14
Language : italy
Browser : Browser : Google Chrome Forum Version : Forum Version : Invision
http://ilgiornaledibordo.forumattivo.com/

Postjessy 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
STBW
STBW

Gender : Unspecified
Posts : 33
Points : 3590
Reputation : 2
Language : Spanish
Browser : Browser : Google Chrome Forum Version : Forum Version : Forumactif Edge

PostSTBW Wed 23 Nov 2016, 11:42

Same here, still not working _userdata.usergroup 1f625 (in my main forum at least, I tested it in another one I own and there it worked..)
Ace 1
Ace 1
Valued Member
Gender : Unspecified
Age : 25
Posts : 2153
Points : 5530
Reputation : 95
Location : USA
Language : English ?
Browser : Browser : Google Chrome Forum Version : Forum Version : phpBB3
https://fmdesign.forumotion.com/u190

PostAce 1 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.
jessy
jessy

Gender : Female
Posts : 102
Points : 3351
Reputation : 14
Language : italy
Browser : Browser : Google Chrome Forum Version : Forum Version : Invision
http://ilgiornaledibordo.forumattivo.com/

Postjessy Sun 04 Dec 2016, 10:14

does not work,never mind thank you very much for your availability _userdata.usergroup 1f339
Ace 1
Ace 1
Valued Member
Gender : Unspecified
Age : 25
Posts : 2153
Points : 5530
Reputation : 95
Location : USA
Language : English ?
Browser : Browser : Google Chrome Forum Version : Forum Version : phpBB3
https://fmdesign.forumotion.com/u190

PostAce 1 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.
STBW
STBW

Gender : Unspecified
Posts : 33
Points : 3590
Reputation : 2
Language : Spanish
Browser : Browser : Google Chrome Forum Version : Forum Version : Forumactif Edge

PostSTBW Sat 14 Jan 2017, 01:11

A lot of thaaankss!! _userdata.usergroup 1f600 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 _userdata.usergroup 1f609



Ace 1
Ace 1
Valued Member
Gender : Unspecified
Age : 25
Posts : 2153
Points : 5530
Reputation : 95
Location : USA
Language : English ?
Browser : Browser : Google Chrome Forum Version : Forum Version : phpBB3
https://fmdesign.forumotion.com/u190

PostAce 1 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.
STBW
STBW

Gender : Unspecified
Posts : 33
Points : 3590
Reputation : 2
Language : Spanish
Browser : Browser : Google Chrome Forum Version : Forum Version : Forumactif Edge

PostSTBW 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 >.<
Ace 1
Ace 1
Valued Member
Gender : Unspecified
Age : 25
Posts : 2153
Points : 5530
Reputation : 95
Location : USA
Language : English ?
Browser : Browser : Google Chrome Forum Version : Forum Version : phpBB3
https://fmdesign.forumotion.com/u190

PostAce 1 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?
STBW
STBW

Gender : Unspecified
Posts : 33
Points : 3590
Reputation : 2
Language : Spanish
Browser : Browser : Google Chrome Forum Version : Forum Version : Forumactif Edge

PostSTBW 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
Sponsored content

PostSponsored content

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