Welcome Guest [Log In] [Register]
Search Members Calendar | Rules ZB Code Index IF Code Index
ZBCode
  • Navigation
  • ZBCode
  • Coding Resources
  • Zetaboards Modifications
  • ZetaBoards Auto-PM on Registration v1.2
Hey, welcome to ZBCode, the premier coding forum for ZB. Here you fill find some of the best Invisionfree and Zetaboards Codes on the network! Unfortunately, you're sorta hovering around in guest mode at the moment; why not join in on the fun? Register an account and you can start accessing the wealth of resources we have available here. Enjoy your stay at ZBCode, and remember to tell all your friends about us; the more members, the more codes available. ;)

Interested in joining? Click here.


If you are already a member of ZBCode, feel free to login right here:

Username:   Password:
Locked Topic
  • Pages:
  • 1
  • 2
  • …
  • 6
ZetaBoards Auto-PM on Registration v1.2
Tweet Topic Started: Jun 8 2009, 05:59 PM (5,829 Views)
Viral Jun 8 2009, 05:59 PM Post #1


Posts:
342
Group:
Dedicated
Member
#48
Joined:
Jul 17, 2008
Coding language
PHP
What this does: Automatically sends a PM to a user when they register. They are also given a pop up message to show they have it (like you would normally).
Browsers Tested: Internet Explorer 8.0, Google Chrome (latest), Safari (latest), Firefox (latest)
Notes: Don't remove the copyright, redistribute or edit (besides the necessary parts). If you have IE 7.0 or 6.0, please test for me.
Placement: Below the Board/ Above Copyright
Code:
Code: HTML
 
<script type="text/JavaScript">
//<![CDATA[
// Auto PM on Registration Created by Viral - http://zbaio.zetabin.com
var pm = {};
pm.newmessage = "New Message";
pm.from = "System Message";
pm.subject = "Welcome to the Forum!";
pm.content = 'Hello and welcome!';
pm.sent = "One minute ago";
pm.url = "#";
pm.id = $("#top_info strong a").text();
pm.sendmessage = function()
{
$.get(main_url+"msg/?c=2",{},function(data)
{
pm.xc = $("input[name=xc]",data).val();
pm.secure = $("input[name=secure]",data).val();
$.post(main_url+"msg/?c=3&sd=1",{name:pm.id,xc:pm.xc,msg:0,fwd:0,convo:0,draft_edit:0,secure:pm.secure,title:"wJf3V99o_I8hI_c8q-P",post:pm.content,track:1},function(){window.name = window.name.replace("reg=1","");pm.getmessage();});
});
}
pm.toast = function(url,newmessage,from,subject,sent)
{
$("#copyright").after('<div id="pmtoast" style="display: block;"><a id="pmlink" href="'+url+'"><big>'+newmessage+'</big><small>From:</small><strong>'+from+'</strong><br/><small>Subject:</small><strong>'+subject+'</strong><br/><small>Sent:</small><strong>'+sent+'</strong></a><a id="pmclose" href="#">Close</a></div>');
$("#pmclose").click(function(){$(this).parent().hide("slow");});
}
pm.getmessage = function()
{
$.get(main_url+"msg/?folder=-2",{},function(data){
pm.data = $("table.pm.togglechecks tr.row1:first td:first a",data);
pm.url = pm.data.attr("href");
with(pm)
{
toast(url,newmessage,from,subject,sent);
}
});
}
pm.clean = function()
{
if(document.title == "wJf3V99o_I8hI_c8q-P"){
document.title = pm.subject;
var theTitle = $("#boardmeta").next().children();
theTitle.eq(0).html(theTitle.html().replace("wJf3V99o_I8hI_c8q-P",pm.subject));
$("#main a[href="+$('#top_info strong a').attr('href')+"]").parent().html(pm.from);
var nav = document.getElementById("nav");
nav.innerHTML = nav.innerHTML.replace("wJf3V99o_I8hI_c8q-P",pm.subject);
$("#conversation").next().remove();
$("#conversation tr:first td:first img").remove();
}
$("table.pm.togglechecks tr a").each(function()
{
if($(this).text() == "wJf3V99o_I8hI_c8q-P")
{
$(this).text(pm.subject).parent().next().html(pm.from);
}
});
}
pm.register = function()
{
if(location.href.match(/\/register\/\?c=1/gi)){
$("button[type=submit]").click(function()
{
window.name = "reg=1";
});
}
}
pm.logged_in = function()
{
return $("#top_info small a").size() == 1;
}
pm.startAuto = function(){
if(window.name.match("reg=1"))
{
if(pm.logged_in() === true)
{
pm.sendmessage();
}
else
{
window.name = window.name.replace("reg=1","");
}
}
}
pm.startAuto();
pm.register();
pm.clean();
//]]>
</script>


Docs:

Code: HTML
 
pm.newmessage = "New Message";
pm.from = "System Message";
pm.subject = "Welcome to the Forum!";
pm.content = 'Hello and welcome!';
pm.sent = "One minute ago";


Those are the only things you can change. In pm.content you can use BBCode, not HTML. Linebreaks can be done with a \n . If you use quotes (' "), escape it with a backslash: \' \".
Edited by Viral, Jun 15 2009, 10:11 AM.

Posted Image
Offline Profile Goto Top
 
Nicolas Jun 8 2009, 06:10 PM Post #2
Member Avatar
Awesome

Posts:
209
Group:
Dedicated
Member
#1,307
Joined:
Oct 22, 2008
Coding language
HTML/CSS
Very neat idea about it being a PM from the user, to the user. xD
Posted Image
(Thanks to HelenaZF for the awesomesauce signature. )

Big Boards
Hogwarts New Zealand
Offline Profile Goto Top
 
Reid Jun 8 2009, 06:13 PM Post #3
Member Avatar
What? The land of the free? Whoever told you that was your enemy.

Posts:
1,790
Group:
Distinguished Coder
Member
#148
Joined:
Jul 20, 2008
Very nice. But my favorite part is, by far, this:
Code:
 
wJf3V99o_I8hI_c8q-P
The Resource Board
Offline Profile Goto Top
 
Viral Jun 8 2009, 06:28 PM Post #4


Posts:
342
Group:
Dedicated
Member
#48
Joined:
Jul 17, 2008
Coding language
PHP
Thanks guys XD .

And Reid, that is my favourite too.

Posted Image
Offline Profile Goto Top
 
Reid Jun 8 2009, 06:51 PM Post #5
Member Avatar
What? The land of the free? Whoever told you that was your enemy.

Posts:
1,790
Group:
Distinguished Coder
Member
#148
Joined:
Jul 20, 2008
Don't get me wrong, I also like your use of OOP as well. OOP. <3

:P
The Resource Board
Offline Profile Goto Top
 
Aerial Jun 8 2009, 07:25 PM Post #6
Member Avatar


Posts:
177
Group:
Member
Member
#2,952
Joined:
May 8, 2009
Coding language
HTML/CSS
Thank-you so much!!!!!! I have been looking for this code for a while now :D :D :D
Offline Profile Goto Top
 
Viral Jun 8 2009, 07:30 PM Post #7


Posts:
342
Group:
Dedicated
Member
#48
Joined:
Jul 17, 2008
Coding language
PHP
Reid
Jun 8 2009, 06:51 PM
Don't get me wrong, I also like your use of OOP as well. OOP. <3

:P
I only thought of using it because it seemed boring without it. Normally I wouldn't see any use.

Posted Image
Offline Profile Goto Top
 
Aerial Jun 8 2009, 07:41 PM Post #8
Member Avatar


Posts:
177
Group:
Member
Member
#2,952
Joined:
May 8, 2009
Coding language
HTML/CSS
I tested and it didn't work... hmmm.

This is what I am using... anyone know what i did wrong?

Spoiler: click to toggle


<script type="text/JavaScript">
//<![CDATA[
// Automatic PM on Registration - Created by Viral - http://zbaio.zetabin.com
var pm = {};
pm.newmessage = "New Message";
pm.from = "KillzKayZ";
pm.subject = "Welcome to the Forum!";
pm.content = 'Hello and welcome to Aquaventures! We appreciate your registration. Why not start by introducing yourself to everybody in the <a href='http://s1.zetaboards.com/theAquaventure/forum/862019/'>Welcome Wagon Forum?</a>. And don't forget to post some pictures of your fish/aquatics in our <a href='http://s1.zetaboards.com/theAquaventure/forum/863168/'>Photo Cooler.</a> Thanks again for registering, we hope you enjoy your stay here.
pm.sent = "One minute ago";
pm.url = "#";
pm.id = $("#top_info strong a").text();
pm.sendmessage = function()
{
$.get(main_url+"msg/?c=2",{},function(data)
{
pm.xc = $("input[name=xc]",data).val();
pm.secure = $("input[name=secure]",data).val();
$.post(main_url+"msg/?c=3&sd=1",{name:pm.id,xc:pm.xc,msg:0,fwd:0,convo:0,draft_edit:0,secure:pm.secure,title:"wJf3V99o_I8hI_c8q-P",post:pm.content,track:1},function(){window.name = window.name.replace("reg=1","");pm.getmessage();});
});
}
pm.toast = function(url,newmessage,from,subject,sent)
{
$("#copyright").after('<div id="pmtoast" style="display: block;"><a id="pmlink" href="'+url+'"><big>'+newmessage+'</big><small>From:</small><strong>'+from+'</strong><br/><small>Subject:</small><strong>'+subject+'</strong><br/><small>Sent:</small><strong>'+sent+'</strong></a><a id="pmclose" href="#">Close</a></div>');
$("#pmclose").click(function(){$(this).parent().hide("slow");});
}
pm.getmessage = function()
{
$.get(main_url+"msg/?folder=-2",{},function(data){
pm.data = $("table.pm.togglechecks tr.row1:first td:first a",data);
pm.url = pm.data.attr("href");
Offline Profile Goto Top
 
Viral Jun 8 2009, 07:43 PM Post #9


Posts:
342
Group:
Dedicated
Member
#48
Joined:
Jul 17, 2008
Coding language
PHP
You haven't got the whole code, and you didn't escape the quotes.

Code: HTML
 
<script type="text/JavaScript">
//<![CDATA[
// Automatic PM on Registration - Created by Viral - http://zbaio.zetabin.com
var pm = {};
pm.newmessage = "New Message";
pm.from = "KillzKayZ";
pm.subject = "Welcome to the Forum!";
pm.content = 'pm.content = 'Hello and welcome to Aquaventures! We appreciate your registration. Why not start by introducing yourself to everybody in the <a href="http://s1.zetaboards.com/theAquaventure/forum/862019/">Welcome Wagon Forum?</a>. And don't forget to post some pictures of your fish/aquatics in our <a href="http://s1.zetaboards.com/theAquaventure/forum/863168/">Photo Cooler.</a> Thanks again for registering, we hope you enjoy your stay here.';
pm.sent = "One minute ago";
pm.url = "#";
pm.id = $("#top_info strong a").text();
pm.sendmessage = function()
{
$.get(main_url+"msg/?c=2",{},function(data)
{
pm.xc = $("input[name=xc]",data).val();
pm.secure = $("input[name=secure]",data).val();
$.post(main_url+"msg/?c=3&sd=1",{name:pm.id,xc:pm.xc,msg:0,fwd:0,convo:0,draft_edit:0,secure:pm.secure,title:"wJf3V99o_I8hI_c8q-P",post:pm.content,track:1},function(){window.name = window.name.replace("reg=1","");pm.getmessage();});
});
}
pm.toast = function(url,newmessage,from,subject,sent)
{
$("#copyright").after('<div id="pmtoast" style="display: block;"><a id="pmlink" href="'+url+'"><big>'+newmessage+'</big><small>From:</small><strong>'+from+'</strong><br/><small>Subject:</small><strong>'+subject+'</strong><br/><small>Sent:</small><strong>'+sent+'</strong></a><a id="pmclose" href="#">Close</a></div>');
$("#pmclose").click(function(){$(this).parent().hide("slow");});
}
pm.getmessage = function()
{
$.get(main_url+"msg/?folder=-2",{},function(data){
pm.data = $("table.pm.togglechecks tr.row1:first td:first a",data);
pm.url = pm.data.attr("href");
with(pm)
{
toast(url,newmessage,from,subject,sent);
}
});
}
pm.clean = function()
{
if(document.title == "wJf3V99o_I8hI_c8q-P"){
document.title = pm.subject;
var theTitle = $("#boardmeta").next().children();
theTitle.eq(0).html(theTitle.html().replace("wJf3V99o_I8hI_c8q-P",pm.subject));
$("#main a[href="+$('#top_info strong a').attr('href')+"]").parent().html(pm.from);
var nav = document.getElementById("c_nav_txt");
nav.innerHTML = nav.innerHTML.replace("wJf3V99o_I8hI_c8q-P",pm.subject);
}
$("table.pm.togglechecks tr a").each(function()
{
if($(this).text() == "wJf3V99o_I8hI_c8q-P")
{
$(this).text(pm.subject).parent().next().html(pm.from);
}
});
}
pm.register = function()
{
if(location.href.match(/\/register\/\?c=1/gi)){
$("button[type=submit]").click(function()
{
window.name = "reg=1";
});
}
}
pm.logged_in = function()
{
return $("#top_info small a").size() == 1;
}
pm.startAuto = function(){
if(window.name.match("reg=1"))
{
if(pm.logged_in() === true)
{
pm.sendmessage();
}
else
{
window.name = window.name.replace("reg=1","");
}
}
}
pm.startAuto();
pm.register();
pm.clean();
//]]>
</script>

Posted Image
Offline Profile Goto Top
 
Nicolas Jun 8 2009, 08:03 PM Post #10
Member Avatar
Awesome

Posts:
209
Group:
Dedicated
Member
#1,307
Joined:
Oct 22, 2008
Coding language
HTML/CSS
theAquaventure: You should use BBCode, not HTML, in the PM content area. :)
I tested that already. :lol:
Posted Image
(Thanks to HelenaZF for the awesomesauce signature. )

Big Boards
Hogwarts New Zealand
Offline Profile Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
Go to Next Page
« Previous Topic · Zetaboards Modifications · Next Topic »
Locked Topic
  • Pages:
  • 1
  • 2
  • …
  • 6

Track Topic · E-mail Topic Time: 7:48 PM Jul 10
Hosted for free by ZetaBoards · Privacy Policy