Post by SubDevo on Sept 18, 2009 17:42:28 GMT -8
Hide Email/Age From Staff if Hidden by SubDevo
Tested in IE, FF, Opera and Safari
There are NO loops in this code. Straight DOM. Fast...
This code is for a specific ProBoards privacy issue.
Privacy Issue:
The Email address of a member who chooses to hide their email on their "Modify Profile" page, is still visible to a moderator that has the power to modify profiles, even if this moderator is not allowed to view hidden emails ("Group Options" in "Modify Group").
The Age of a member who chose to hide their Age on their "Modify Profile" page, can be made visible to the moderator if he/she sets the option, "Show Age", to "Yes".
Results with this moderator:
Email Address Visibility:
Hidden on the "View Profile" page. (good)
Visible on the "Modify Profile" page. (bad)
This moderator can change the "Hide Email" option to "No". (bad)
(The email would then be visible to ALL members)
Age Visibility:
Hidden on the "View Profile" page. (good)
Hidden on the "Modify Profile" page. (good)
This moderator can change the "Show Age" option to "Yes". (bad)
(The Age would then be visible to ALL members and this moderator.)
When modifying a profile, this code:
Removes the email address field and the "Hide Email" option if "Hide Email" is set to "Yes".
Removes the "Show Age" option if "Show Age" is set to "No".
In other words, this moderator can only HIDE the member Age and/or Email address, NOT make it visible.
This code only runs on the "Modify Profile" page.
This code ignores Members modifying their own profile and staff placed in the code.
Variables:
Only three options:
var fStaff=/^(admin|staff2)$/; // Staff to allow viewing of hidden options.
Put the usernames (not display names) of the Staff that can bypass this code. Seperate the names with a "|". Do NOT put one after the last name in the list. Any names listed here will not be affected by the code.
var hEmail=1; // Hide "Hide Email" if hidden?
1= Hide the email address and the box to change it to visible.
0= Show the Email address normally. (code is bypassed)
var hAge=1; // Hide "Show Age" if hidden?
1= Hide the "Show Age" option.
0= Show the "Show Age" option normally. (code is bypassed)
NOTE:
The options are hidden on the "Modify Profile" page, ONLY if the member has set the Email and/or Age option to hidden.
Enjoy!!!
SubDevo
Location: Main Footer
<script type="text/javascript">
<!--
/* Hide Email/Age From Staff if Hidden by SubDevo -Idea by Nikki- */
/* Main Footer - Please leave this header intact. Do not repost. */
/* interoceandesigns.proboards.com or lsdp.proboards.com */
var fStaff=/^(admin)$/; // Staff to allow viewing of hidden options.
var hEmail=1; // Hide "Hide Email" if hidden?
var hAge=1; // Hide "Show Age" if hidden?
var m=document.modifyForm;
if(m&&!(pb_username.match(fStaff)||m.password)){
if(hEmail&&m.hideemail.selectedIndex=="1"){hE(m.hideemail);hE(m.email);}
if(hAge&&m.showage.selectedIndex=="0"){hE(m.showage);}
} function hE(a,b){a.parentNode.parentNode.parentNode.style.display="none";}
// -->
</script>
Tested in IE, FF, Opera and Safari
There are NO loops in this code. Straight DOM. Fast...
This code is for a specific ProBoards privacy issue.
Privacy Issue:
The Email address of a member who chooses to hide their email on their "Modify Profile" page, is still visible to a moderator that has the power to modify profiles, even if this moderator is not allowed to view hidden emails ("Group Options" in "Modify Group").
The Age of a member who chose to hide their Age on their "Modify Profile" page, can be made visible to the moderator if he/she sets the option, "Show Age", to "Yes".
Results with this moderator:
Email Address Visibility:
Hidden on the "View Profile" page. (good)
Visible on the "Modify Profile" page. (bad)
This moderator can change the "Hide Email" option to "No". (bad)
(The email would then be visible to ALL members)
Age Visibility:
Hidden on the "View Profile" page. (good)
Hidden on the "Modify Profile" page. (good)
This moderator can change the "Show Age" option to "Yes". (bad)
(The Age would then be visible to ALL members and this moderator.)
When modifying a profile, this code:
Removes the email address field and the "Hide Email" option if "Hide Email" is set to "Yes".
Removes the "Show Age" option if "Show Age" is set to "No".
In other words, this moderator can only HIDE the member Age and/or Email address, NOT make it visible.
This code only runs on the "Modify Profile" page.
This code ignores Members modifying their own profile and staff placed in the code.
Variables:
Only three options:
var fStaff=/^(admin|staff2)$/; // Staff to allow viewing of hidden options.
Put the usernames (not display names) of the Staff that can bypass this code. Seperate the names with a "|". Do NOT put one after the last name in the list. Any names listed here will not be affected by the code.
var hEmail=1; // Hide "Hide Email" if hidden?
1= Hide the email address and the box to change it to visible.
0= Show the Email address normally. (code is bypassed)
var hAge=1; // Hide "Show Age" if hidden?
1= Hide the "Show Age" option.
0= Show the "Show Age" option normally. (code is bypassed)
NOTE:
The options are hidden on the "Modify Profile" page, ONLY if the member has set the Email and/or Age option to hidden.
Enjoy!!!
SubDevo
Location: Main Footer
<script type="text/javascript">
<!--
/* Hide Email/Age From Staff if Hidden by SubDevo -Idea by Nikki- */
/* Main Footer - Please leave this header intact. Do not repost. */
/* interoceandesigns.proboards.com or lsdp.proboards.com */
var fStaff=/^(admin)$/; // Staff to allow viewing of hidden options.
var hEmail=1; // Hide "Hide Email" if hidden?
var hAge=1; // Hide "Show Age" if hidden?
var m=document.modifyForm;
if(m&&!(pb_username.match(fStaff)||m.password)){
if(hEmail&&m.hideemail.selectedIndex=="1"){hE(m.hideemail);hE(m.email);}
if(hAge&&m.showage.selectedIndex=="0"){hE(m.showage);}
} function hE(a,b){a.parentNode.parentNode.parentNode.style.display="none";}
// -->
</script>