Welcome Guest [Log In] [Register]
Viewing Single Post From: Automatic Welcome PM v1.5
Dove
xtrm.exe now loading...
[ *  *  * ]
This code is based on MKII's Automatic Welcome PM and I have a modiefied it a bit so it shows the left side panel. (avatar and post details)

Be sure to add a + at the of every line but except for the last one. For extra space (extra line) add a \n right after the \n before it and before the " after it.

Username You Want To Appear
(Set the number to the user's id number that you want it to appear as, ex:#1 is usually the admin.)


Welcome Message :: PM Title
(This is the topic's title)


Body :: PM Message.
(This is where you post the message you want to send to the new member)


Quote:
 
<script language="javascript" type="text/javascript">
<!--
/*
Automatic Welcome PM
Originally by MKII
*/

appearFrom = ["Username You Want To Appear", 1]
msgTitle = "Welcome Message :: PM Title"
msgContents = "Body :: PM Message.\n"

home = "http://"+location.hostname
home += location.pathname.match(/\/[^\/]+\//) ? "/" + location.pathname.substr(1).substr(0, location.pathname.substr(1).indexOf("/") + 1) : location.pathname + "/"
home += "index.php?"

if(document.forms['REG'])
document.forms['REG'].onsubmit = function()
{
if(!Validate())
return false
document.cookie = "newMember=1; expires=" + new Date("1/1/2010").toGMTString()
return true
}

userLinks = document.getElementById("userlinks")
userName = userLinks.getElementsByTagName("A")[0].innerHTML.replace(/<[^>]+>/g, "")

if(userLinks.innerHTML.match("Logged in")&&document.cookie.match("newMember=1"))
{
document.cookie = "newMember=0; expires=" + new Date().toGMTString()
document.write("<iframe src='" + home + "act=Msg&CODE=4&MODE=1&entered_name=" + escape(userName) + "&msg_title=" + escape(msgTitle) + "&Post=" + escape(msgContents) + "' style='display:none'></iframe>")
alert("You have a new personal message from "+ appearFrom[0])
}

if(location.href.match(/act=Msg&CODE=0*1/))
{
td = document.getElementsByTagName("TD")
for(i = 0; i < td.length; i++)
if(td.innerHTML.replace(/<[^>]+>/g, "") == msgTitle)
{
a = td[i + 1].getElementsByTagName("A")
a[0].href = home + "showuser=" + appearFrom[1]
a[0].innerHTML = appearFrom[0]
a[1].href = a[1].href.replace(/MID=\d+/, "MID=" + appearFrom[1])
}
}

if(location.href.match(/MSID=\d+/))
{
b = document.getElementsByTagName("B")
for(i = 0; i < b.length; i++)
if(b.innerHTML == msgTitle && b.parentNode.className == "postdetails")
{
td = document.getElementsByTagName("TD")
for(n = 0; n < td.length; n++)
if((td[n].className == "post1") && td[n].width != "100%")
{
a = td[n - 2].getElementsByTagName("A")[0]
if(a.innerHTML.replace(/<[^>]+>/g,"") != userName)
break
a.href = home + "showuser=" + appearFrom[1]
a.innerHTML = appearFrom[0]
div = td[n + 1].getElementsByTagName("DIV")
for(x = 0; x < div.length; x++)
if(div[x].className == "signature")
div[x].removeNode(false)
a = td[n + 3].getElementsByTagName("A")
for(x = 0; x < a.length; x++)
if(a[x].href.match(/MID=\d+/))
a[x].href = a[x].href.replace(/MID=\d+/, "MID=" + appearFrom[1])
td[n + 1].colSpan = "2"
td[n].removeNode(false)
break
}
break
}
}

//-->
</script>


PS: This code goes in the Footer of your Board Wrappers.
Offline Profile Quote Post
Automatic Welcome PM v1.5 · Code Snippets