Post by CFP wolf on Sept 28, 2009 11:17:12 GMT -5
This code is an "enhanced" version of the 'Guests Cannot View Profiles' code.
I had a different approach this time. Instead of catching when a guest tries to search/view profile, this code simply replaces the URL in all Search and/or member's Display Name links, to redirect the guest to whatever page you want them to see.
This is the login page by default. But you can use ANY URL. A neat trick is to create a hidden board and make a locked thread with a message about your forum inviting them to join.
You can also optionally hide non-staff member name links and/or Search links. These items will be hidden on every page that they appear. Even if they are hidden, the link still points to your guest "error" page. If a guest enters the direct URL to a profile or search page, the code will still catch it. This time, presenting the guest with a blank page and an alert box with a message you provide.
<script type="text/javascript">
<!--
/* Guests Cannot Search or View Profiles by SubDevo */
/* Global Footer - Please leave this header intact. Do not repost. */
/* interoceandesigns.proboards.com or lsdp.proboards.com */
var gMsg='Sorry, You do not have Permission to Access this Area.\nPlease Click "Back" to Continue.';
var gSrch=[0,0]; // Guests can Search? , Hide Search Link? 1=Yes, 0=No.
var gProf=[0,1]; // Guests can View Profiles? , Hide Non-Staff? 1=Yes, 0=No.
var gURL="/index.cgi?action=login"; // URL to "Error" page for Guests.
if(pb_username=="Guest"){ var nx="viewprofile&user=";
var iLoc=(document.searchForm||document.title.match(/search\sresults/i))?1:0;
if(!gProf[0]&&location.href.match(nx)||(!gSrch[0]&&iLoc)){
var tb=document.getElementsByTagName("table");
for(var x=4;x<tb.length;x++){tb[x].style.display="none";} alert(gMsg);
}else{ var ti=document.links;
for(var x=0;x<ti.length;x++){rLink(gSrch,"search",0); rLink(gProf,nx,1);}
}
}
function rLink(nA,nB,nC){
with(ti[x]){if(!nA[0]&&href.match(nB)){ href=gURL;
if(nA[1]){if(!nC||(nC&&className=="group0")){style.display="none"; if(nC){innerHTML="";}}}}
}
}
// -->
</script>
Put this in your [/b]Global footer. It is still possible to view profiles and/or search a forum (even with this code) if you have the knowledge. This code helps deter gleening your member's info by making it less convenient for the snoopy casual users. The only way to make sure this info is completely blocked is server side... That means making your forum members only. This code just bridges the gap between completely no guests and open to guests, while still giving some privacy to your members info.
I had a different approach this time. Instead of catching when a guest tries to search/view profile, this code simply replaces the URL in all Search and/or member's Display Name links, to redirect the guest to whatever page you want them to see.
This is the login page by default. But you can use ANY URL. A neat trick is to create a hidden board and make a locked thread with a message about your forum inviting them to join.
You can also optionally hide non-staff member name links and/or Search links. These items will be hidden on every page that they appear. Even if they are hidden, the link still points to your guest "error" page. If a guest enters the direct URL to a profile or search page, the code will still catch it. This time, presenting the guest with a blank page and an alert box with a message you provide.
<script type="text/javascript">
<!--
/* Guests Cannot Search or View Profiles by SubDevo */
/* Global Footer - Please leave this header intact. Do not repost. */
/* interoceandesigns.proboards.com or lsdp.proboards.com */
var gMsg='Sorry, You do not have Permission to Access this Area.\nPlease Click "Back" to Continue.';
var gSrch=[0,0]; // Guests can Search? , Hide Search Link? 1=Yes, 0=No.
var gProf=[0,1]; // Guests can View Profiles? , Hide Non-Staff? 1=Yes, 0=No.
var gURL="/index.cgi?action=login"; // URL to "Error" page for Guests.
if(pb_username=="Guest"){ var nx="viewprofile&user=";
var iLoc=(document.searchForm||document.title.match(/search\sresults/i))?1:0;
if(!gProf[0]&&location.href.match(nx)||(!gSrch[0]&&iLoc)){
var tb=document.getElementsByTagName("table");
for(var x=4;x<tb.length;x++){tb[x].style.display="none";} alert(gMsg);
}else{ var ti=document.links;
for(var x=0;x<ti.length;x++){rLink(gSrch,"search",0); rLink(gProf,nx,1);}
}
}
function rLink(nA,nB,nC){
with(ti[x]){if(!nA[0]&&href.match(nB)){ href=gURL;
if(nA[1]){if(!nC||(nC&&className=="group0")){style.display="none"; if(nC){innerHTML="";}}}}
}
}
// -->
</script>
Put this in your [/b]Global footer. It is still possible to view profiles and/or search a forum (even with this code) if you have the knowledge. This code helps deter gleening your member's info by making it less convenient for the snoopy casual users. The only way to make sure this info is completely blocked is server side... That means making your forum members only. This code just bridges the gap between completely no guests and open to guests, while still giving some privacy to your members info.