Post by california on Mar 31, 2006 1:36:18 GMT -8
Don't get too excited -- or maybe you should. Though no real PM ever gets sent with this code, the user will never know the difference, as the "fake" PM looks and works exactly like a real one. But isn't this against the TOS? No, it isn't :)
This code sets a cookie that "sends" a welcoming PM to a new user when they register. It updates their PM count in the welcome table and info center and is capable of being marked as read/unread and deleted like any other PM. The only thing the user can't do is quote it (but they won't notice).
You can edit who the PM gets sent from as well as of course the subject and content of the PM. Unfortunately there's one extra step involved in using this code, other than just the actual code in the headers/footers...
THE FIRST STEP
No, you cannot skip this. You cannot use the code without doing it. Period. If you're too lazy to do it or even read this, forget about using the code. Now. Are we clear? Okay... what you need to do is create a new thread on your board somewhere. It doesn't matter where. Maybe in a hidden board. But it can't be pass-protected and it must be accessible to new members. In this thread you put whatever you want to appear in the welcome PM. This thread IS the welcome PM. Don't have any replies in the thread. PMs don't have replies. Lock the thread or disable posting in the board that it's inside.
Created your welcome PM thread? Good, now copy the URL of the thread. That's the thing in the address bar that starts with http. Copy it all, not just part of it, and save it because you'll need it for the "welcomeLink" variable in the code. Now you're done with the first step.
THE SECOND STEP
Make sure you have done the first step. It's really important.
THE CODE
Copy the code below into your GLOBAL FOOTER:
<script type="text/javascript">
<!--
/* welcome PM sent automatically to new users by california
©2006 SoCal Codes, http://socal.proboards26.com
Do not redistribute or repost without permission */
// General Customization
var welcomeLink = "http://socal.proboards26.com/index.cgi?board=INTRO&action=display&n=1&thread=1100566611";
var pmSubject = "Welcome";
var replyToUser = "admin";
var replyToName = "admin display name";
var replyToGroup = "group1";
// Edit these if you have custom images for any of them
var imopen = "http://s3.images.proboards.com/imopen.gif";
var imclose = "http://s3.images.proboards.com/imclose.gif";
var im_inbox = "http://s3.images.proboards.com/buttons/im_inbox.gif";
var im_new = "http://s3.images.proboards.com/buttons/im_new.gif";
var im_outbox = "http://s3.images.proboards.com/buttons/im_outbox.gif";
var im_config = "http://s3.images.proboards.com/buttons/im_config.gif";
var im_reply = "http://s3.images.proboards.com/buttons/reply.gif";
var im_delete = "http://s3.images.proboards.com/buttons/delete.gif";
// Don't edit below here
var iTable = document.getElementsByTagName("table");
var iCell = document.getElementsByTagName("td");
var iLink = document.getElementsByTagName("a");
var cookieRe = new RegExp("\\b(welcome_"+pb_username+"=(un)?read_(.+?))(;|$)", "");
function getPBTime(){
var fObj = iCell[2].getElementsByTagName("font")[0];
return (fObj && fObj.lastChild && fObj.lastChild.nodeName == "#text") ? fObj.lastChild.data : 'N/A';
}
function getTimeFrag(sendTime){
var sArr = sendTime.split(',');
var dayNum = (sArr[0].match(/(\d+)/)) ? parseInt(RegExp.$1)+1 : 1;
var dF = document.createDocumentFragment();
if(getPBTime().split(',')[0] == sArr[0]){
var todayBold = document.createElement("b");
todayBold.appendChild(document.createTextNode("Today"));
dF.appendChild(todayBold);
dF.appendChild(document.createTextNode(" at"+sArr[2]));
}else if(getPBTime().split(',')[0] == sArr[0].replace(/\d+/g, dayNum)){
dF.appendChild(document.createTextNode("Yesterday at"+sArr[2]));
}else{
dF.appendChild(document.createTextNode(sendTime));
}
return dF;
}
function loadExternal(file){
document.write('<script type="text/javascript" src="http://iycatacombs.com/socal/resources/scripts/'+file+'"></scr'+'ipt>');
}
function deleteWelcomePM(){
document.cookie = "welcome_"+pb_username+"=deleted;";
}
if(welcomeLink.match(/^\/?(index\.cgi)?\?/)){
welcomeLink = "http://"+location.hostname.replace('www.', '')+welcomeLink;
}else if(welcomeLink.match(/^(www\.)?\w+\.proboards/)){
welcomeLink = "http://"+welcomeLink.replace('www.', '');
}
if(document.cookie.match(cookieRe)){
if(location.href == (welcomeLink+"&welcomepm=1")) loadExternal("welcomepm1.js");
loadExternal("welcomepm2.js");
}
if(location.href.match(/action=register2/) && document.loginform){
var exp = (new Date((new Date()).getTime()+100000000000)).toString();
document.cookie = "welcome_"+document.loginform.username.value+"=unread_"+escape(getPBTime())+"; expires="+exp+";";
}
// -->
</script>
It won't work at all if you don't put it in the GLOBAL FOOTER. Not the main header. Not a board footer. The GLOBAL FOOTER. Now you have to edit the variables:
// Edit these if you have custom images for any of them
if(pb_skinid == 1){
var imopen = "URL OF IMOPEN FOR SKIN 1";
var imclose = "URL OF IMCLOSE FOR SKIN 1";
var im_inbox = "URL OF IM_INBOX FOR SKIN 1";
var im_new = "URL OF IM_NEW FOR SKIN 1";
var im_outbox = "URL OF IM_OUTBOX FOR SKIN 1";
var im_config = "URL OF IM_CONFIG FOR SKIN 1";
var im_reply = "URL OF REPLY FOR SKIN 1";
var im_delete = "URL OF DELETE FOR SKIN 1";
}else if(pb_skinid == 2){
var imopen = "URL OF IMOPEN FOR SKIN 2";
var imclose = "URL OF IMCLOSE FOR SKIN 2";
var im_inbox = "URL OF IM_INBOX FOR SKIN 2";
var im_new = "URL OF IM_NEW FOR SKIN 2";
var im_outbox = "URL OF IM_OUTBOX FOR SKIN 2";
var im_config = "URL OF IM_CONFIG FOR SKIN 2";
var im_reply = "URL OF REPLY FOR SKIN 2";
var im_delete = "URL OF DELETE FOR SKIN 2";
}else if(pb_skinid == 3){
var imopen = "URL OF IMOPEN FOR SKIN 3";
var imclose = "URL OF IMCLOSE FOR SKIN 3";
var im_inbox = "URL OF IM_INBOX FOR SKIN 3";
var im_new = "URL OF IM_NEW FOR SKIN 3";
var im_outbox = "URL OF IM_OUTBOX FOR SKIN 3";
var im_config = "URL OF IM_CONFIG FOR SKIN 3";
var im_reply = "URL OF REPLY FOR SKIN 3";
var im_delete = "URL OF DELETE FOR SKIN 3";
}
If you need support, post in the Code Support board.
Edit by Ross: Just fixing the image URLs since proboards8.com (image server) is being taken offline
This code sets a cookie that "sends" a welcoming PM to a new user when they register. It updates their PM count in the welcome table and info center and is capable of being marked as read/unread and deleted like any other PM. The only thing the user can't do is quote it (but they won't notice).
You can edit who the PM gets sent from as well as of course the subject and content of the PM. Unfortunately there's one extra step involved in using this code, other than just the actual code in the headers/footers...
THE FIRST STEP
No, you cannot skip this. You cannot use the code without doing it. Period. If you're too lazy to do it or even read this, forget about using the code. Now. Are we clear? Okay... what you need to do is create a new thread on your board somewhere. It doesn't matter where. Maybe in a hidden board. But it can't be pass-protected and it must be accessible to new members. In this thread you put whatever you want to appear in the welcome PM. This thread IS the welcome PM. Don't have any replies in the thread. PMs don't have replies. Lock the thread or disable posting in the board that it's inside.
Created your welcome PM thread? Good, now copy the URL of the thread. That's the thing in the address bar that starts with http. Copy it all, not just part of it, and save it because you'll need it for the "welcomeLink" variable in the code. Now you're done with the first step.
THE SECOND STEP
Make sure you have done the first step. It's really important.
THE CODE
Copy the code below into your GLOBAL FOOTER:
<script type="text/javascript">
<!--
/* welcome PM sent automatically to new users by california
©2006 SoCal Codes, http://socal.proboards26.com
Do not redistribute or repost without permission */
// General Customization
var welcomeLink = "http://socal.proboards26.com/index.cgi?board=INTRO&action=display&n=1&thread=1100566611";
var pmSubject = "Welcome";
var replyToUser = "admin";
var replyToName = "admin display name";
var replyToGroup = "group1";
// Edit these if you have custom images for any of them
var imopen = "http://s3.images.proboards.com/imopen.gif";
var imclose = "http://s3.images.proboards.com/imclose.gif";
var im_inbox = "http://s3.images.proboards.com/buttons/im_inbox.gif";
var im_new = "http://s3.images.proboards.com/buttons/im_new.gif";
var im_outbox = "http://s3.images.proboards.com/buttons/im_outbox.gif";
var im_config = "http://s3.images.proboards.com/buttons/im_config.gif";
var im_reply = "http://s3.images.proboards.com/buttons/reply.gif";
var im_delete = "http://s3.images.proboards.com/buttons/delete.gif";
// Don't edit below here
var iTable = document.getElementsByTagName("table");
var iCell = document.getElementsByTagName("td");
var iLink = document.getElementsByTagName("a");
var cookieRe = new RegExp("\\b(welcome_"+pb_username+"=(un)?read_(.+?))(;|$)", "");
function getPBTime(){
var fObj = iCell[2].getElementsByTagName("font")[0];
return (fObj && fObj.lastChild && fObj.lastChild.nodeName == "#text") ? fObj.lastChild.data : 'N/A';
}
function getTimeFrag(sendTime){
var sArr = sendTime.split(',');
var dayNum = (sArr[0].match(/(\d+)/)) ? parseInt(RegExp.$1)+1 : 1;
var dF = document.createDocumentFragment();
if(getPBTime().split(',')[0] == sArr[0]){
var todayBold = document.createElement("b");
todayBold.appendChild(document.createTextNode("Today"));
dF.appendChild(todayBold);
dF.appendChild(document.createTextNode(" at"+sArr[2]));
}else if(getPBTime().split(',')[0] == sArr[0].replace(/\d+/g, dayNum)){
dF.appendChild(document.createTextNode("Yesterday at"+sArr[2]));
}else{
dF.appendChild(document.createTextNode(sendTime));
}
return dF;
}
function loadExternal(file){
document.write('<script type="text/javascript" src="http://iycatacombs.com/socal/resources/scripts/'+file+'"></scr'+'ipt>');
}
function deleteWelcomePM(){
document.cookie = "welcome_"+pb_username+"=deleted;";
}
if(welcomeLink.match(/^\/?(index\.cgi)?\?/)){
welcomeLink = "http://"+location.hostname.replace('www.', '')+welcomeLink;
}else if(welcomeLink.match(/^(www\.)?\w+\.proboards/)){
welcomeLink = "http://"+welcomeLink.replace('www.', '');
}
if(document.cookie.match(cookieRe)){
if(location.href == (welcomeLink+"&welcomepm=1")) loadExternal("welcomepm1.js");
loadExternal("welcomepm2.js");
}
if(location.href.match(/action=register2/) && document.loginform){
var exp = (new Date((new Date()).getTime()+100000000000)).toString();
document.cookie = "welcome_"+document.loginform.username.value+"=unread_"+escape(getPBTime())+"; expires="+exp+";";
}
// -->
</script>
It won't work at all if you don't put it in the GLOBAL FOOTER. Not the main header. Not a board footer. The GLOBAL FOOTER. Now you have to edit the variables:
var welcomeLink = "URL OF THREAD";Don't know what this is? Then do me a favor and slap yourself really hard for not reading THE FIRST STEP, then scroll up and read it. Or just leave it at what it is in the example. The code won't work but it's nice advertising for SoCal
var pmSubject = "Welcome";This is what the subject of the welcome PM will be. Chances are it will end up including the word "Welcome" in it...
var replyToUser = "admin";If you want the main admin to be sending the PM then the only thing you need to edit here is the replyToName variable, where you put the main admin's display name. If I were using the code here I'd put "california" for example. This is what shows up in the "From:" field of the PM and for consistency should probably be whoever posted the welcome PM thread in THE FIRST STEP. If it's not the main admin, edit the user and the group. The groups are all "group1", "group2", "group3", etc., check the user's member group. If they're an administrator they're probably group1. If they're not an administrator, why are they sending the welcome PM? Probably safe to leave it at group1. All it determines is the color of the username link if you have colored member groups.
var replyToName = "admin display name";
var replyToGroup = "group1";
// Edit these if you have custom images for any of themLike the comment says, you only need to edit these if you have custom images for them. Visit the URLs to figure out what images they are. Mostly the PM images obviously. If you have different images for different skins, you could do something like this:
var imopen = "http://s3.images.proboards.com/imopen.gif";
var imclose = "http://s3.images.proboards.com/imclose.gif";
var im_inbox = "http://s3.images.proboards.com/buttons/im_inbox.gif";
var im_new = "http://s3.images.proboards.com/buttons/im_new.gif";
var im_outbox = "http://s3.images.proboards.com/buttons/im_outbox.gif";
var im_config = "http://s3.images.proboards.com/buttons/im_config.gif";
var im_reply = "http://s3.images.proboards.com/buttons/reply.gif";
var im_delete = "http://s3.images.proboards.com/buttons/delete.gif";
// Edit these if you have custom images for any of them
if(pb_skinid == 1){
var imopen = "URL OF IMOPEN FOR SKIN 1";
var imclose = "URL OF IMCLOSE FOR SKIN 1";
var im_inbox = "URL OF IM_INBOX FOR SKIN 1";
var im_new = "URL OF IM_NEW FOR SKIN 1";
var im_outbox = "URL OF IM_OUTBOX FOR SKIN 1";
var im_config = "URL OF IM_CONFIG FOR SKIN 1";
var im_reply = "URL OF REPLY FOR SKIN 1";
var im_delete = "URL OF DELETE FOR SKIN 1";
}else if(pb_skinid == 2){
var imopen = "URL OF IMOPEN FOR SKIN 2";
var imclose = "URL OF IMCLOSE FOR SKIN 2";
var im_inbox = "URL OF IM_INBOX FOR SKIN 2";
var im_new = "URL OF IM_NEW FOR SKIN 2";
var im_outbox = "URL OF IM_OUTBOX FOR SKIN 2";
var im_config = "URL OF IM_CONFIG FOR SKIN 2";
var im_reply = "URL OF REPLY FOR SKIN 2";
var im_delete = "URL OF DELETE FOR SKIN 2";
}else if(pb_skinid == 3){
var imopen = "URL OF IMOPEN FOR SKIN 3";
var imclose = "URL OF IMCLOSE FOR SKIN 3";
var im_inbox = "URL OF IM_INBOX FOR SKIN 3";
var im_new = "URL OF IM_NEW FOR SKIN 3";
var im_outbox = "URL OF IM_OUTBOX FOR SKIN 3";
var im_config = "URL OF IM_CONFIG FOR SKIN 3";
var im_reply = "URL OF REPLY FOR SKIN 3";
var im_delete = "URL OF DELETE FOR SKIN 3";
}
If you need support, post in the Code Support board.
Edit by Ross: Just fixing the image URLs since proboards8.com (image server) is being taken offline