geke hand
E Z B O A R D
Customize Content for Users / Groups

<< updated: 4/6/2003

Summary: This script gives you the ability to customize content for specific users on the main board and forum pages by showing and hiding different elements based on username.

Details:

This script uses a combination of CSS, HTML and Javascript to achieve it's effects. In order to create the content that is "customizable" by user, you must understand the use of display: none in CSS and giving tags an HTML ID attribute so they can be styled in CSS and referenced through javascript.

The script is not designed as a one-stop solution for board customization, but rather as a "proof-of-concept" that the content displayed can be customized.

If you don't have an understanding of the CSS, HTML and Javascript involved, you may not be able to use the script to achieve the effect you desire.

However, here is a basic explanation:

The script uses a "group" model, where every member that we want to give custom content to is a member of a group. A group must have at least one member, but need not have more than one. Each group has a unique number, with the first group being group 0. Group numbers MUST go in sequence.

The code for a group looks like this:

groupMembers[X] = "bob joe john harry mary jane wayne fred jim";

Where X is the unique number for the group.

To define what custom elements this group sees that are normally hidden, we add this below the group membership line:

customVisible[X] = "news help linklist joke";

Where X is the unique number of the group and the different items in the string (news, help, linklist and joke) are the IDs of elements that we will make visible.

To define what custom elements this group doesn't see that are normally visible (or defined as visible by some other group membership), we add this below the custom visible line:

customHidden[X] = "randomquote warning banner";

Where X is the unique number of the group and the different items in the string (randomquote, warning and banner) are the IDs of elements that we will make hidden.

Create all the DIVs with IDs that represents their content. IDs must be unique on every page and should only contain letters and numbers. They can be anywhere on the page, but the script only supports customization of the main board and forum pages.

HEAD: (box #1)

<script type="text/javascript">
/* BEGIN EZURL */
ezURL = document.location.href.match("http:\/\/((?:pub|b|p)([0-9]+)|beta|vanchau|inbox)\.ezboard\.com\/(b|f)([a-zA-Z0-9]+(?=frm[0-9]+)|[a-zA-Z0-9]+(?!frm[0-9]+))(frm[0-9]+|)(?:(?:[\.]{1})([a-zA-Z0-9\=\+\&\.]+)|)(?:(?:[\x3F]{1})([a-zA-Z0-9\=\+\&\.]+)|)(?:.*)");
try {
if (ezURL.length > 0) {
ezPub = ezURL[2].length > 0 ? ezURL[2] : ezURL[1];
ezFullPub = ezURL[1];
ezIsBoard = ezURL[3] == "b" ? true : false;
ezBoardID = ezURL[4];
ezForum = ezURL[5];
ezPage = ezURL[6];
ezQuery = ezURL[7];
}
} catch (e) { }
ezURL = null;
/* END EZURL */
</script>

HEAD Notes:

This script is used in many of the other scripts offered here. Only one copy should be installed.

HEAD: (box #1)

<style type="text/css">

#news, #help, #joke, #randomquote, #linklist, #warning { display: none; }
#banner { display: block; }

</style>

HEAD Notes:

Example CSS, modify it to reflect your own styles and your own custom content boxes IDs.

HEADER: (box #3)

<div id="news">
This is a div containing news items.
</div>

<div id="linklist">
This is a div containing links.
</div>

<div id="help">
This is a div containing help text and links.
</div>

<div id="randomquote">
This is a div containing random quotes.
</div>

<div id="joke">
This is a div containing a random joke.
</div>

<div id="warning">
This is a div containing a warning.
</div>

HEADER Notes:

Examples of custom content DIVs which would only be displayed to certain users.

FOOTER: (box #4)

<script type="text/javascript">
/* Custom Content displayed for users and groups */
if (!(ezPage && ezQuery)) {

var ezUser = "";

for ( dl = 0; dl < document.links.length; dl++ ) {
if ( document.links[dl].href.indexOf("showInBoxFolder") != -1 || document.links[dl].href.indexOf("InboxServer") != -1) {
ezUser = document.links[dl].href.match("u([a-zA-Z0-9\@]*)\.(showInBoxFolder|boardRedirectToInboxServer)")[1];
break;
}
}

if (ezUser.length > 0) {

var groupMembers = new Array();
var reGroup = new Array();
var customVisible = new Array();
var customHidden = new Array();

/* show group 0 news and affiliates, but hide help */
groupMembers[0] = "markwars1972 blueduck37 jmurray3";
customVisible[0] = "news affiliates";
customHidden[0] = "help";

/* show group 1 help, but hide news */
groupMembers[1] = "B0bFrankend0rfer Barnacleez beerbaron blueduck37 GuyIncognito HamSalad jara19";
customVisible[1] = "help";
customHidden[1] = "news";

/* show group 2 news and help, hide affiliates */
groupMembers[2] = "phalen180";
customVisible[2] = "news help";
customHidden[2] = "affiliates";

for ( gm = 0; gm < groupMembers.length; gm++ ) {
reGroup[gm] = new RegExp(groupMembers[gm].split(/\s/).join("|"), "i");
}
groupMembers = null;

for ( ag = 0; ag < reGroup.length; ag++ ) {
if ( reGroup[ag].test(ezUser) ) {
hideEm = customHidden[ag].split(/\s/);
for ( ch = 0; ch < hideEm.length; ch++ ) {
document.getElementById(hideEm[ch]).style.display = "none";
}
hideEm = null;

showEm = customVisible[ag].split(/\s/);
for ( cv = 0; cv < showEm.length; cv++ ) {
document.getElementById(showEm[cv]).style.display = "block";
}
showEm = null;
}
}
}
}
/* END: Custom Content displayed for users and groups */
</script>

FOOTER Notes:

Modify as described in the Details section.

History:

4/6/2003 - created

Credits:

phalen180

E Z B O A R D

design by G E K E . N E T
best viewed in 1024x768 screen resolution using a standards compliant browser
logo based on a public domain drawing of a hand making the sign of the cross, no disrespect is intended
all other contents and code copyright © 2002-2005 jonathan cook

Valid HTML 4.01! Valid CSS!