vForums Support Banner



 

Welcome Guest! Please Login or Register
vForums Support :: Programming & Coding :: Code Requests & Support :: Members List Staff Only - View Topic (Page 1 of 3)Page: 1 2 3
Topic Rating: *****
Printable View
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 {Unsure} 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]
Recoding the future

Posts: 4,043
Status: Offline
Gender: Male
Location: UK
Joined:  

Additional Groups:
Coding Team
***


Reputation: 58%  


pmtwittervForum
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. {Unsure}
dog199200
Guest
Re: Members List Staff Only (13th Jan 10 at 6:44am UTC)
something like that?

Code:
 
  1. <script type="text/javascript">
  2. <!--
  3. if(vf_usergroup == "3" || vf_usergroup == "2" || vf_usergroup == "1"){
  4.     if(location.href.match(/\/members(\/|$)/i)) {
  5.         document.write('An Error Has Occurred');
  6.     }
  7. }
  8. //-->
  9. </script>
 


or maybe this:

Code:
 
  1. <script type="text/javascript">
  2. <!--
  3. if(vf_usergroup == "3" || vf_usergroup == "2" || vf_usergroup == "1"){
  4.     if(location.href.match(/\/members(\/|$)/i)) {
  5.         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>';
  6.     }
  7. }
  8. //-->
  9. </script>
 


my js sucks, but i'm sure i'm on the right path.

Michael
Moderator
*****

[Avatar]
Recoding the future

Posts: 4,043
Status: Offline
Gender: Male
Location: UK
Joined:  

Additional Groups:
Coding Team
***


Reputation: 58%  


pmtwittervForum
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! {Smile}

I won't do it for you at the moment, but will if you don't get it down! {Smile}
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 {Unsure}
Michael
Moderator
*****

[Avatar]
Recoding the future

Posts: 4,043
Status: Offline
Gender: Male
Location: UK
Joined:  

Additional Groups:
Coding Team
***


Reputation: 58%  


pmtwittervForum
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. {Sad}
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]
Recoding the future

Posts: 4,043
Status: Offline
Gender: Male
Location: UK
Joined:  

Additional Groups:
Coding Team
***


Reputation: 58%  


pmtwittervForum
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. {Tongue Out}
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:
 
  1. <script type="text/javascript">
  2. <!--
  3. if(vf_usergroup != "1" || vf_usergroup != "2" || vf_usergroup != "3"){
  4.     if(location.href.match(/\/members(\/|$)/i)) {
  5.         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>';
  6.     }
  7. }
  8. //-->
  9. </script>
 


I realized that i screwed up and put == when i needed !=, and even when using this it don't work:

Code:
 
  1. <script type="text/javascript">
  2. <!--
  3. if(vf_username != "dfsdfsdf"){
  4.     if(location.href.match(/\/members(\/|$)/i)) {
  5.         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>';
  6.     }
  7. }
  8. //-->
  9. </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 {Unsure}




Edit: I've even tried this:
Code:
 
  1. <script type="text/javascript">
  2. <!--
  3. if(vf_username != "gdsfgds"){
  4.     if(location.href.match(/action\/members(\/|$)/i)) {
  5.         document.getElementById("members_list").style.display = "none";
  6.     }
  7. }
  8. //-->
  9. </script>
 


Code:
 
  1. <script type="text/javascript">
  2. <!--
  3. if(vf_usergroup != "1" || vf_usergroup != "2" || vf_usergroup != "3"){
  4.     if(location.href.match(/action\/members(\/|$)/i)) {
  5.         document.getElementById("members_list").style.display = "none";
  6.     }
  7. }
  8. //-->
  9. </script>
 


and yet no go {Unsure}

Michael
Moderator
*****

[Avatar]
Recoding the future

Posts: 4,043
Status: Offline
Gender: Male
Location: UK
Joined:  

Additional Groups:
Coding Team
***


Reputation: 58%  


pmtwittervForum
Re: Members List Staff Only (13th Jan 10 at 7:45am UTC)
Code:
 
  1. <script type="text/javascript">
  2. <!--
  3. for(i = 0, block = false; i < vf_usergroup.length; i++)
  4.     if(!vf_usergroup[i].match(/^(1|2|3)$/)){
  5.         block = true;
  6.         break;
  7.     }
  8.  
  9. if(block){
  10.     if(location.href.match(/\/members(\/|$)/i)) {
  11.         get('members_list','id').innerHTML = '<tr><td class="title1"><center><b>An Error Has Occurred</b></center></td></tr>';
  12.     }
  13. }
  14. //-->
  15. </script>
 


Try that in the main footers. {Smile}
dog199200
Guest
Re: Members List Staff Only (13th Jan 10 at 7:54am UTC)
{Tongue Out} ok thanks, but I was trying lol
Michael
Moderator
*****

[Avatar]
Recoding the future

Posts: 4,043
Status: Offline
Gender: Male
Location: UK
Joined:  

Additional Groups:
Coding Team
***


Reputation: 58%  


pmtwittervForum
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. {Smile}
dog199200
Guest
Re: Members List Staff Only (13th Jan 10 at 8:03am UTC)
umm for some reason its blocking me out {Tongue 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 {Unsure}

but yes i was trying the header and not the footer lol



Edit: Plus I made a few edits:
Code:
 
  1. <script type="text/javascript">
  2. <!--
  3. for(i = 0, block = false; i < vf_usergroup.length; i++)
  4.     if(!vf_usergroup[i].match(/^(1|2)$/)){
  5.         block = true;
  6.         break;
  7.     }
  8.  
  9. if(block){
  10.     if(location.href.match(/\/members(\/|$)/i)) {
  11.             var f = document.title.split(" - ")[0];
  12.             document.title = f + " - An Error Has Occurred";
  13.             get('nav_tree','id').innerHTML = "<a href='/'>" + f + "</a> :: An Error Has Occurred";
  14.         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>';
  15.     }
  16. }
  17. //-->
  18. </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]
Recoding the future

Posts: 4,043
Status: Offline
Gender: Male
Location: UK
Joined:  

Additional Groups:
Coding Team
***


Reputation: 58%  


pmtwittervForum
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)
{Unsure} 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 {Tongue Out}
 Printable View
Page: 1 2 3

All times are GMT+0 :: The current time is 4:40am
Page generated in 1.0011 seconds
This Forum is Powered By vForums (v2.4)
Create a Forum for Free | Find Forums