Post by Peter on Oct 31, 2004 15:11:53 GMT
Alright, this code allows members to edit or make their own custom title in their profiles!
User Features:
To change your custom title, just go to your profile, and right under your avatar hieght, is says "Custom Title:", there is a box to the right of it, this is where you put your custom title!
Admin Features:
To disable a certain users custom title priviledges, just goto their profile, and under the box where their custom title is, there is a checkbox with the word "Disable" next to it, check this box, and that users custom title priviledges will be suspended until you go back and uncheck the box
To use the Custom Title Restrictions feature, goto the admin page, and look in the "Manage Members" sections, and click the link that says "Set Custom Title Restrictions"
In this page, you will see that your first option is a checkbox, this check box is if you want to disable the Custom Title Feature in all, just check it, and it will be disabled until you go back and uncheck the box
The second option is a box that has "0" in it, this is the number for the Post Restrictions Feature, this feature is to make it so that members can't use their Custom Title until they reach the amount of posts that you put into this box. if you don't want a Post Restriction, leave the number at "0"
now that you know the features, here's the codes!
HAVE FUN!!
MAIN FOOTER
/*Custom Title In Profile and Restrictions in Admin Page
Coded by NCGI (Uchiha Sasuke)
This code may NOT be reposted at any board without express permission from it's creator. these credits must stay in tact at all time
*/
document.write('<form name="specialform" id="specialform"><input type="hidden" name="endnumber" id="endnumber" value="0"><input type="hidden" name="disablectc" id="disablectc" value="false"></form>');
var iTable = document.getElementsByTagName('table');
var iTD = document.getElementsByTagName('td');
var form = document.getElementsByTagName('form');
var textarea = document.getElementsByTagName('textarea');
if (iTD[5].innerHTML.match(/action=admin/gi)) {userposition = "staff"}
else {userposition = "member"}
if (location.href.indexOf('action=admin') != -1) {
for (a=0;a<iTD.length;a++) {
if (iTD.width=="50%" && iTD.innerHTML.match(/<b>Manage Members<\/b>/gi)) {iTD.innerHTML = iTD.innerHTML.replace(/Groups<\/a><br><\/ul>/gi,'Groups</A><br/><a href="index.cgi?action=headersfooters&type=customtitle">Set Custom Title Restrictions</a><br/></ul>');
}}}
function recordrestrictions() {
if (document.getElementById('postlimit').value=="") {
document.getElementById('postlimit').value="0"}
for (e=0;e<textarea.length;e++) {
textarea[e].value = textarea[e].value.replace('id="endnumber" value="'+document.specialform.endnumber.value+'">','id="endnumber" value="'+document.getElementById('postlimit').value+'">');
textarea[e].value = textarea[e].value.replace('id="disablectc" value="'+document.specialform.disablectc.value+'">','id="disablectc" value="'+document.getElementById('disablect').checked+'">');
}}
function setrestrictions() {
if (document.specialform.disablectc.value=="true") {
document.getElementById('disablect').checked="true";}
document.getElementById('postlimit').value=document.specialform.endnumber.value;
document.getElementById('hdisablect').value=document.getElementById('disablect').checked
}
if (location.href.indexOf('type=customtitle') != -1) {
window.onload = setrestrictions;
iTD[1].innerHTML = iTD[1].innerHTML.replace(/« Edit Headers \/ Footers »/gi,'« Set Custom Title Restrictions »');
document.title = document.title.replace(/Edit Headers \/ Footers/gi,'Set Custom Title Restrictions');
for (n=0;n<iTable.length;n++) {
if (iTable[n].rows(0).cells(0).innerHTML.match(/Or Select Board To Mimic:/gi)) {
iTable[n].firstChild.style.display="none";}}
for (p=0;p<form.length;p++) {
if (form
.action=="index.cgi?action=headersfooters2") {
form
.getElementsByTagName('input')[0].style.display="none";
form
.getElementsByTagName('input')[1].style.display="none";
form
.action="index.cgi?action=headersfooters2&type=savedcustomtitle";
CTadmin='<table width="92%" class="bordercolor" cellspacing="1" cellpadding="0"><tr><td>';
CTadmin+='<table width="100%" class="titlebg" align="center"><tr><td><font size="2"><b>Custom Title Restrictions</b></font></td></tr></table> </td></tr><tr><td>';
CTadmin+='<table width="100%" class="windowbg" cellpadding="1" cellspacing="1"><tr><td><br/></td></td><tr><td width="50%" align="left">Check the box to <b><u>Disable</u></b> the Custom Title feature</td>';
CTadmin+='<td width="50%" align="left"><input type="checkbox" name="disablect" id="disablect" value="yes">Disable</td></tr>'
CTadmin+='<tr><td width="50%" align="left">This is Post limit that the users have to be at before their<br/>custom title starts to work. if you don\'t want to have a Post <br/>limit, then leave the number at 0</td>'
CTadmin+='<td width="50%" align="left"><input type="text" size="2" name="postlimit" id="postlimit" value="0"></td>'
CTadmin+='</tr><tr><td><input type="hidden" name="hdisablect" id="hdisablect"></td>'
CTadmin+='</tr><tr width="100%"><td align="center" width="100%"><br/><input type="submit" value="Save Custom Title Restrictions" onclick="recordrestrictions()"></td></tr><tr><td><br/></td></tr></table></td></tr></table><div style="display: none;">';
form
.innerHTML=CTadmin+form
.innerHTML;
document.write('</div>');
}}}
if (location.href.indexOf('type=savedcustomtitle') != -1) {
for (g=0;g<iTD.length;g++) {
iTD[1].innerHTML = iTD[1].innerHTML.replace(/« Edit Headers \/ Footers »/gi,'« Custom Title Restrictions Settings Saved »');
document.title = document.title.replace(/Edit Headers \/ Footers/gi,'Custom Title Restrictions Settings Saved');
iTD[g].innerHTML = iTD[g].innerHTML.replace(/Edit Headers \/ Footers/gi,'Custom Title Restrictions Settings Saved');
iTD[g].innerHTML = iTD[g].innerHTML.replace(/Your headers and footers have been edited successfully./gi,'Your Custom Title Restrictions Settings have been successfully saved');
}}
function doTitle(title) {
if (document.creator.websiteurl.value=="") {
if (location.href.match(/(.+?)action=/i)) {
document.creator.websitetitle.value = "Home";
document.creator.websiteurl.value = RegExp.$1;}}
if (document.creator.websiteurl.value.match(/\?ctitle=(.+?)\?titleuser=(.+?)\?disabled=(.+?)\?/gi)) {
if (document.specialform.disablectc.value=="false") {
if (RegExp.$3=="true") {document.creator.usertitle.disabled=true;
document.creator.staffdisable.checked=true;}
document.creator.usertitle.value=RegExp.$1;}
document.creator.websiteurl.value = document.creator.websiteurl.value.replace('?ctitle='+RegExp.$1+'?titleuser='+RegExp.$2+'?disabled='+RegExp.$3+'?','');
doTitle();
}}
function makeTitle() {
if (document.creator.websiteurl.value.match(/\?ctitle=(.+?)\?titleuser=(.+?)\?disabled=(.+?)\?/gi)) { document.creator.websiteurl.value = document.creator.websiteurl.value.replace('?ctitle='+RegExp.$1+'?titleuser='+RegExp.$2+'?disabled='+RegExp.$3+'?',''); makeTitlte()}
if (document.creator.usertitle.value=="") {document.creator.usertitle.value="[regular]";}
document.creator.websiteurl.value+="?ctitle="+document.creator.usertitle.value+"?titleuser="+document.creator.username.value+"?disabled="+document.creator.staffdisable.checked+"?";
}
if (location.href.indexOf('action=profile&') != -1) {
if (document.specialform.disablectc.value=="true") {window.onload = doTitle;} else {for (x=0;x<iTable.length;x++) {
for (v=0;v<iTable[x].rows.length;v++) {
for (w=0;w<iTable[x].rows(v).cells.length;w++) {
if (iTable[x].width=="100%" && iTable[x].cellPadding=="3" && iTable[x].rows(v).cells(w).innerHTML.match(/Personal Text/gi)) {
ctr = iTable[x].insertRow();
ctr.insertCell().innerHTML = '<font size="2"><b>Custom Title: </b></font>';
ctr.insertCell().innerHTML = '<input type="text" maxlength="30" name="usertitle" size="50">';
staffTable = iTable[x].insertRow();
staffTable.insertCell().innerHTML='<font size="2"><b>Disable Custom Title:</b></font><br/><font size="1">Check this box if you want this users Custom Title feature disabled</font>';
staffTable.insertCell().innerHTML='<input type="checkbox" name="staffdisable" value="yes">Disable';
if (userposition=="member") {staffTable.style.display="none"}
doTitle(); document.creator.moda[0].onclick = makeTitle;
}}}}}}
function RemoveFactors() { for (i=0;i<iTD.length;i++) {
if (iTD.innerHTML.match(/\?ctitle=(.+?)\?titleuser=(.+?)\?disabled=(.+?)\?/)) {
iTD.innerHTML = iTD.innerHTML.replace('?ctitle='+RegExp.$1+'?titleuser='+RegExp.$2+'?disabled='+RegExp.$3+'?','');
RemoveFactors();
}}}
if (location.href.indexOf('action=profile2') != -1 || location.href.indexOf('action=viewprofile') != -1) {
if (document.specialform.disablectc.value=="true") {RemoveFactors();} else {
for (t=0;t<iTD.length;t++) {
if (iTD[t].innerHTML.match(/Posts: (\d+)/gi)) {postamount = RegExp.$1;}
if (iTD[t].innerHTML.match(/\?ctitle=(.+?)\?titleuser=(.+?)\?disabled=(.+?)\?/)) {
newtitle = RegExp.$1;usersname = RegExp.$2;ctdisabled = RegExp.$3;cf = "true"}
else {cf = "false"} if (cf=="true") {
if (newtitle=="[regular]" || Math.round(document.specialform.endnumber.value)>Math.round(postamount) || ctdisabled=="true") {}
else { if (iTD[t].innerHTML.match(/<font size=2>(.+?)<br><img/gi)) {
iTD[t].innerHTML = iTD[t].innerHTML.replace(RegExp.$1,newtitle);}}
}}
RemoveFactors();}}
</script>