We hope you enjoy your visit.

You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.


Join our community!


If you're already a member please log in to your account to access all of our features:

Username:   Password:
Add Reply
Multi PM Recipients; Modification; By Chris
Topic Started: Feb 3 2010, 11:55 PM (3,143 Views)
Reid
Member Avatar
È una trappola!

This topic has been moved from our official support board.

Originally posted by: Chris
Multi PM Recipients; Modification
 
Notice: This is just like sending each PM individually, so if you have ad-removal, do not think that this will only take one credit away. It will take away one for every recipient - just like if you were sending them each one by one.

I am glad to bring everyone the first method of having multi PM recipients for ZetaBoards. This is a very complex script and I put a good days work into it. It only shows up when you can see the "Quick Compose Message" table at the moment; but I might get to having it work on other pages like the Forward page.

All features that you can use in the regular Quick Compose will work with this system. For example, the search for existing users names (and non existing) still works; and you can track the messages - though not individually. I've added in a few features of my own, too. For one you can Remove All recipients, or just choose one in particular to remove. When you press submit, you will get a PM Toast telling you there is an error (and a description), or how many messages / total messages has been sent until the script is done.

For a preview click the link in my mini-profile and register. Then click "Inbox" at the top, and scroll down to the Quick Compose Message block. You should see a button that reads "Multi Recipients" to the right of the Send To: Box

Okay, enough of my ramblings.. lets get to the code! You have a few options to choose from. I recommend the first or third.

The one you choose should go in the Board Template under Below Board

Option 1 - Hosted and Packed version
Code:
 
<script src="http://z3.ifrm.com/51/32/0/f158567/multiRecipients.min.js" type="text/javascript"></script>


Option 2 - Hosted and non-Packed version
Code:
 
<script src="http://z3.ifrm.com/51/32/0/f158568/multiRecipients.js" type="text/javascript"></script>


Option 3 - non-Hosted Packed version
Code:
 
<script type="text/javascript">
//<![CDATA[
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('9(1j.1k.1l(T+"U/")){f=$("1m:G(V W v)");f.X("<g w=\'1n\' d=\'h\' x=\'0\' />");c=$("1o:G(V W v)").H().H();a=c.Y("Z").10(".11").4("12:k(0)");s=c.Y("Z").10(".11").4("12:k(1)");a.1p("1q").4("g").1r("<y I=\'l\' z=\'13: 14;\'><J z=\'1s-1t: 0;\' d=\'15\' 5=\'6\'><b x=\'0\'>1u</b></J><e K=\'16\' w=\'e\'>1v</e> 1w: </y>").H().7("L",0).X("<e K=\'h\' z=\'1x:1y\' w=\'e\'>17 18</e>").19(" <e I=\'l\' K=\'o\' z=\'13: 14;\' w=\'e\'>1z 1a</e>");m=f.4("g[@d=h]");n=f.4("g[@d=1A]");s=f.4("e:G(1B v)");M=$("#16");o=$("#o");A=$("#1C");h=$("#h");l=$(".l");8=f.4("J[@d=15]");B=f.4("g[@d=1b]");p=f.4("g[@d=p]");j=$("#1D");C=f.4("g[@d=C]");D=f.4("g[@d=D]");o.E(q(){9(m.2()==1){9($.r(j.2())!=""){8.7("5",t).19("<b x=\'"+$.r(j.2())+"\'>"+$.r(j.2())+"</b>");j.2("");j.1E()}}});M.E(q(){9(8.7("5")==t){9(8.2()=="0"){8.7("5",6).4("b:F(:k(0))").N()}u{8.4("b[@x="+8.2()+"]").N();9(8.4("b").O()==1){8.7("5",6)}}}});h.E(q(){9(m.2()==0){m.2(1);h.P("1F 1a")}u 9(m.2()==1){m.2(0);h.P("17 18");8.7("5",6).4("b:F(:k(0))").N()}l.1G()});s.E(q(){9(m.2()==0){1c 6}u 9(m.2()==1){9(8.7("5")==t){9($.r(B.2())!=""){9($.r(A.2())!=""){M.7("5",6);o.7("5",6);A.7("5",6);s.7("5",6);8.7("5",6);B.7("5",6);p.7("5",6);j.7("5",6);Q("1H!","<y I=\'1d\'>0</y> 1I "+(R.S(8.4("b").O())-1)+" 1J 1K.",t);L(i=1;i<=(R.S(8.4("b").O())-1);i++){$.1e(T+"U/?c=3&1L=1",{"C":C.2(),"D":D.2(),"d":8.4("b:k("+i+")").2(),"1b":B.2(),"1e":A.2(),"p":p.2()},q(){$(".1d").P(R.S(i-1))})}$("#1M").1N("1O")}u{Q("1f","1g 1h F 1i a v L 1P 1Q.",6)}}u{Q("1f","1g 1h F 1i a 1R.",6)}}1c t}})}',62,116,'||val||find|disabled|true|attr|send|if||option||name|button||input|mode||user|eq|multi|||add|track|function|trim||false|else|Message|type|value|span|style|message|subject|xc|secure|click|not|contains|parent|class|select|id|for|del|remove|size|text|Toast|Math|round|main_url|msg|Quick|Compose|prepend|siblings|tbody|children|row1|td|display|none|sendto|delete|Multiple|Recipients|append|Recipient|title|return|msgsent|post|Error|You|have|entered|location|href|match|form|hidden|th|removeAttr|width|before|margin|left|All|Remove|Search|float|right|Add|names|Send|quickcompose|username_find|keyup|Single|toggle|Success|of|messages|sent|sd|pmclose|show|slow|the|recipients|Subject'.split('|'),0,{}))
//]]>
</script>


Option 4 - non-Hosted non-Packed version
Code:
 
<script type="text/javascript">
//<![CDATA[
if (location.href.match(main_url+"msg/")){
f = $("form:contains(Quick Compose Message)");

f.prepend("<input type='hidden' name='mode' value='0' />");

c = $("th:contains(Quick Compose Message)").parent().parent();
a = c.siblings("tbody").children(".row1").find("td:eq(0)");
s = c.siblings("tbody").children(".row1").find("td:eq(1)");

a.removeAttr("width").find("input").before("<span class='multi' style='display: none;'><select style='margin-left: 0;' name='sendto' disabled='true'><option value='0'>All</option></select><button id='delete' type='button'>Remove</button> Search: </span>").parent().attr("for", 0).prepend("<button id='mode' style='float:right' type='button'>Multiple Recipients</button>").append(" <button class='multi' id='add' style='display: none;' type='button'>Add Recipient</button>");

m = f.find("input[@name=mode]");
n = f.find("input[@name=names]");
s = f.find("button:contains(Send Message)");

del = $("#delete");
add = $("#add");
message = $("#quickcompose");
mode = $("#mode");
multi = $(".multi");
send = f.find("select[@name=sendto]");
subject = f.find("input[@name=title]");
track = f.find("input[@name=track]");
user = $("#username_find");
xc = f.find("input[@name=xc]");
secure = f.find("input[@name=secure]");

add.click(function(){
if (m.val() == 1){
if ($.trim(user.val()) != ""){
send.attr("disabled", false).append("<option value='"+$.trim(user.val())+"'>"+$.trim(user.val())+"</option>");
user.val("");
user.keyup();
}}});

del.click(function(){
if (send.attr("disabled") == false){
if (send.val() == "0"){
send.attr("disabled", true).find("option:not(:eq(0))").remove();
} else {
send.find("option[@value="+send.val()+"]").remove();
if (send.find("option").size() == 1){
send.attr("disabled", true)
}
}
}
});

mode.click(function(){

if (m.val() == 0){
m.val(1);
mode.text("Single Recipient");
} else if (m.val() == 1){
m.val(0);
mode.text("Multiple Recipients");
send.attr("disabled", true).find("option:not(:eq(0))").remove();
}

multi.toggle();
});

s.click(function(){

if (m.val() == 0){
return true;
} else if (m.val() == 1){
if (send.attr("disabled") == false){

if ($.trim(subject.val()) != ""){

if ($.trim(message.val()) != ""){
del.attr("disabled", true);
add.attr("disabled", true);
message.attr("disabled", true);
s.attr("disabled", true);
send.attr("disabled", true);
subject.attr("disabled", true);
track.attr("disabled", true);
user.attr("disabled", true);

Toast("Success!", "<span class='msgsent'>0</span> of "+(Math.round(send.find("option").size()) - 1)+" messages sent.", false);
for (i = 1; i <= (Math.round(send.find("option").size()) - 1); i++){
$.post(main_url+"msg/?c=3&sd=1", {
"xc" : xc.val(),
"secure" : secure.val(),
"name" : send.find("option:eq("+i+")").val(),
"title" : subject.val(),
"post" : message.val(),
"track" : track.val()
}, function(){
$(".msgsent").text(Math.round(i - 1));
});
}
$("#pmclose").show("slow");
} else {
Toast("Error", "You have not entered a Message for the recipients.", true);
}

} else {
Toast("Error", "You have not entered a Subject.", true);
}

}
return false;
}

});
}
//]]>
</script>


As for the final step, EVERYONE needs to put this into their Board Templates under Javascripts.
Code:
 
<script type="text/javascript">//<![CDATA[
function Toast(t,a,b){$("#pmtoast").remove();if(b==true){b="<a id='pmclose'>Close</a>"}else{b="<a id='pmclose' style='display: none'>Close</a>"}$("body").append("<div id='pmtoast' style='display: block;'><a id='pmlink'><big>"+t+"</big>"+a+"</a>"+b+"</div>");$("#pmclose").click(function(){$("#pmtoast").hide("slow");return false})}
//]]></script>
Offline Profile Quote Post Goto Top
 
Bhagavan
Member Avatar
Member
[ *  * ]
I cannot get this to work. :(
Offline Profile Quote Post Goto Top
 
ApexPalace
Member Avatar
I'm a newb.
[ *  * ]
How do I send a message to multiple users? I installed this but it isn't working?
Offline Profile Quote Post Goto Top
 
Chris P
Member Avatar
Member
[ *  * ]
I made this code to work with a much older version of jQuery. I recommend using the code made by Viral.
Offline Profile Quote Post Goto Top
 
ringthebellamy
Member Avatar
Dum Spiro Spero
[ * ]
Is this one still work?
Offline Profile Quote Post Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · ZetaBoards Codes & Modifications · Next Topic »
Add Reply