dog199200 Guest | Members List Staff Only (13th Jan 10 at 6:30am UTC) | | Would it be possible to get a code that make it so that only assigned usergroups can see the members list? I know i could just hide the link how i have it, but in i dont want normal members to see it and yes i know the whole, you can just disable it in JS thing, but i can careless, also keep in mind if i don't mind side server hosting codes to prevent then from going down with js. | |
|
Michael Moderator
    
![[Avatar]](http://av.wservices.co.uk/av.png) Recoding the future Posts: 4,043 Status: Offline Gender: Male Location: UK Joined:
Additional Groups: Coding Team
  
pmvForum | Re: Members List Staff Only (13th Jan 10 at 6:34am UTC) | | You could write a code to replace the table if they're not in the group. Have it say that they're not allowed to view it or something. | |
|
dog199200 Guest | Re: Members List Staff Only (13th Jan 10 at 6:44am UTC) | | something like that?
 Code: - <script type="text/javascript">
- <!--
- if(vf_usergroup == "3" || vf_usergroup == "2" || vf_usergroup == "1"){
- if(location.href.match(/\/members(\/|$)/i)) {
- document.write('An Error Has Occurred');
- }
- }
- //-->
- </script>
or maybe this:
 Code: - <script type="text/javascript">
- <!--
- if(vf_usergroup == "3" || vf_usergroup == "2" || vf_usergroup == "1"){
- if(location.href.match(/\/members(\/|$)/i)) {
- get('members_list','id').innerHTML = '<table cellpadding=0 width=100% cellspacing=0 border=1 class="window1"><tr><td class="title1"><center><b>An Error Has Occurred</b></center></td></tr></table>';
- }
- }
- //-->
- </script>
my js sucks, but i'm sure i'm on the right path.
| |
|
Michael Moderator
    
![[Avatar]](http://av.wservices.co.uk/av.png) Recoding the future Posts: 4,043 Status: Offline Gender: Male Location: UK Joined:
Additional Groups: Coding Team
  
pmvForum | Re: Members List Staff Only (13th Jan 10 at 7:09am UTC) | | Your check for the usergroup doesn't work. vf_usergroup Is an array. So you need to loop through it!
I won't do it for you at the moment, but will if you don't get it down! | |
|
dog199200 Guest | Re: Members List Staff Only (13th Jan 10 at 7:12am UTC) | | i've done the usergroup check just like that in the past, and it works fine | |
|
Michael Moderator
    
![[Avatar]](http://av.wservices.co.uk/av.png) Recoding the future Posts: 4,043 Status: Offline Gender: Male Location: UK Joined:
Additional Groups: Coding Team
  
pmvForum | Re: Members List Staff Only (13th Jan 10 at 7:13am UTC) | | Thing is, if the person's in multiple groups it won't work. | |
|
dog199200 Guest | Re: Members List Staff Only (13th Jan 10 at 7:17am UTC) | | oh ok, when i did it before it was with someone that was in a single group
edit: though i think there is something else wrong, cause i did a little debugging and removed the usergroup check and did a username check, and put some random name so that i wouldn't be able to see it, and i was able to, so something other then the usergroup check is wrong | |
|
Michael Moderator
    
![[Avatar]](http://av.wservices.co.uk/av.png) Recoding the future Posts: 4,043 Status: Offline Gender: Male Location: UK Joined:
Additional Groups: Coding Team
  
pmvForum | Re: Members List Staff Only (13th Jan 10 at 7:24am UTC) | | What's your modified code, I hadn't said the rest was correct or not. | |
|
dog199200 Guest | Re: Members List Staff Only (13th Jan 10 at 7:35am UTC) | | well this is what i'm using for the main part:
 Code: - <script type="text/javascript">
- <!--
- if(vf_usergroup != "1" || vf_usergroup != "2" || vf_usergroup != "3"){
- if(location.href.match(/\/members(\/|$)/i)) {
- get('members_list','id').innerHTML = '<table cellpadding=0 width=100% cellspacing=0 border=1 class="window1"><tr><td class="title1"><center><b>An Error Has Occurred</b></center></td></tr></table>';
- }
- }
- //-->
- </script>
I realized that i screwed up and put == when i needed !=, and even when using this it don't work:
 Code: - <script type="text/javascript">
- <!--
- if(vf_username != "dfsdfsdf"){
- if(location.href.match(/\/members(\/|$)/i)) {
- get('members_list','id').innerHTML = '<table cellpadding=0 width=100% cellspacing=0 border=1 class="window1"><tr><td class="title1"><center><b>An Error Has Occurred</b></center></td></tr></table>';
- }
- }
- //-->
- </script>
Which that should be saying if the user assign's username isn't dfsdfsdf then is shows An Error Has Occurred instead of the member table. I seen the member list check done before so i took that from another code that i know works, so the location check should be fine. That makes me wonder if the ID is wrong, but thats the id i found in the source code
Edit: I've even tried this:
 Code: - <script type="text/javascript">
- <!--
- if(vf_username != "gdsfgds"){
- if(location.href.match(/action\/members(\/|$)/i)) {
- document.getElementById("members_list").style.display = "none";
- }
- }
- //-->
- </script>
 Code: - <script type="text/javascript">
- <!--
- if(vf_usergroup != "1" || vf_usergroup != "2" || vf_usergroup != "3"){
- if(location.href.match(/action\/members(\/|$)/i)) {
- document.getElementById("members_list").style.display = "none";
- }
- }
- //-->
- </script>
and yet no go
| |
|
Michael Moderator
    
![[Avatar]](http://av.wservices.co.uk/av.png) Recoding the future Posts: 4,043 Status: Offline Gender: Male Location: UK Joined:
Additional Groups: Coding Team
  
pmvForum | Re: Members List Staff Only (13th Jan 10 at 7:45am UTC) | |  Code: - <script type="text/javascript">
- <!--
- for(i = 0, block = false; i < vf_usergroup.length; i++)
- if(!vf_usergroup[i].match(/^(1|2|3)$/)){
- block = true;
- break;
- }
-
- if(block){
- if(location.href.match(/\/members(\/|$)/i)) {
- get('members_list','id').innerHTML = '<tr><td class="title1"><center><b>An Error Has Occurred</b></center></td></tr>';
- }
- }
- //-->
- </script>
Try that in the main footers. | |
|
dog199200 Guest | Re: Members List Staff Only (13th Jan 10 at 7:54am UTC) | | ok thanks, but I was trying lol
| |
|
Michael Moderator
    
![[Avatar]](http://av.wservices.co.uk/av.png) Recoding the future Posts: 4,043 Status: Offline Gender: Male Location: UK Joined:
Additional Groups: Coding Team
  
pmvForum | Re: Members List Staff Only (13th Jan 10 at 7:56am UTC) | | I know, I think you were probably putting it in the header. Your code would have worked (not sure about the usergroup check though!), but it needed to be in the footer. | |
|
dog199200 Guest | Re: Members List Staff Only (13th Jan 10 at 8:03am UTC) | | umm for some reason its blocking me out my site does use multiple groups so that may be the reasons
but my by group 1 (admin) and my group 2 (mod) need to be working with both group 3 (free account), and group 4 (paid account) and since i'm both group 1 and group 4, it doesn't work lol, i completely forgot about that
but yes i was trying the header and not the footer lol
Edit: Plus I made a few edits:
 Code: - <script type="text/javascript">
- <!--
- for(i = 0, block = false; i < vf_usergroup.length; i++)
- if(!vf_usergroup[i].match(/^(1|2)$/)){
- block = true;
- break;
- }
-
- if(block){
- if(location.href.match(/\/members(\/|$)/i)) {
- var f = document.title.split(" - ")[0];
- document.title = f + " - An Error Has Occurred";
- get('nav_tree','id').innerHTML = "<a href='/'>" + f + "</a> :: An Error Has Occurred";
- get('members_list','id').innerHTML = '<tr><td class="title1"><b>An Error Has Occurred</b></td></tr><tr><td class="window1">Invalid Module</td></tr>';
- }
- }
- //-->
- </script>
anyways the groups need to be pair up like: Group 1 + Group 3 | Group 1 + Group 4 | Group 2 + Group 3 | Group 2 + 4 Group | |
|
Michael Moderator
    
![[Avatar]](http://av.wservices.co.uk/av.png) Recoding the future Posts: 4,043 Status: Offline Gender: Male Location: UK Joined:
Additional Groups: Coding Team
  
pmvForum | Re: Members List Staff Only (13th Jan 10 at 8:38am UTC) | | Then change the regexp match! >.< | |
|
dog199200 Guest | Re: Members List Staff Only (13th Jan 10 at 6:38pm UTC) | | if i know how to do it without making all the groups available i would, only think i can think of is 1|2|3|4 but that makes it available to 3 and 4 and it shouldn't be. I doubt 1|1+3|1+4|2|2+3|2+4 will work | |
|