Post by SubDevo on Mar 15, 2010 17:50:17 GMT -8
Mass PM Certain Member Groups by SubDevo
Tested in IE, FF, Opera, Safari and Chrome
This code allows you to send a mass PM to an individual member group or multiple groups! (excluding the sender of course) The code gives you a dropdown box next to "New PM" in the top bar of your inbox and outbox page. You control which staff members can see the jump. You MUST have cookies enabled for this code to work.
Important!
After you install the code and set your options, the staff you entered in the code must "build" their member group list by visiting every page of your Member list. Once that is done, the code scans every page you visit for new members and if they are not in your cookie, it will add them. Also be aware that these mass PM's will show up in your outbox. Sending a mass PM to 50 members, gets you 50 messages in your outbox... I also have no way to tell if a member deletes their account. Their name will still remain in your cookies. If you know of any deleted accounts while using this code, it would be best to delete your cookie or If you know how to do it, find the cookie for your forum in your browser options, and delete the cookie value called "grouptest". Then refresh your list again by visiting the member listings.
You may also delete your cookie by copy/paste the following line into your address bar and hit ENTER.
javascript:if(confirm("Click OK to delete your Member Groups cookie.")){doCook(1);}
Enjoy!!!
SubDevo
Variables: Edit the Maroon portions.
var fStaff=/^(admin|staff1)$/i; // Usernames of Staff allowed to send Group PMs.
Enter the usernames (NOT display names) of the members allowed to send the mass PMs.
Separate the names with a "|". Do NOT put a "|" after the last name.
var mGroups=[ /* ["Group ID", "Name in the dropdown"]. */
["0","Members"],
["3","Moderators"],
["2","Global Mods"],
["5","Co-Admin"],
["2|3|5","All Staff"] <----- NO COMMA
];
These are examples only! Your group ID's will be different.
Enter the group ID followed by the name you wish to appear in the jump for that group.
Use any name you want! Copy/paste one of the lines to add more groups.
Do not put a comma after the last line in the list.
You may also send to multiple groups at a time. Look at the last line in the above example.
Enter two or more group ID's separated with a "|". Easy huh?
Here is another "trick". You may access the group PMs from a link. Place it anywhere on your board. You do not have to use the jump. Use this as the href of your link:
/index.cgi?action=pmsend&type=pmgroup1|2|3|5
You may even change the group number(s) at the end, to a group that isn't in the code and it will still find all the members in that group! nice...
How do I find my Group ID's?
Simple! Go to your "Modify Profile" page.
Then copy/paste the following line of code into your address bar and hit ENTER.
javascript:var n=document.getElementsByName("membergroup")[0].options;var b="";for(x=2;x<n.length;x++){b+=n[x].value+" = "+n[x].text+"\n";}alert(b);
You will get an alert box with a list of all your member groups and IDs.
Location: Global Footer
<script type="text/javascript">
<!--
/* Mass PM Certain Member Groups by SubDevo */
/* Global Footer - Please leave this header intact. Do not repost. */
/* interoceandesigns.proboards.com or lsdp.proboards.com */
var fStaff=/^(admin|staff1)$/i; // Usernames of Staff allowed to send Group PMs.
var mGroups=[ // ["Group ID", "Name in the dropdown"].
["0","Members"],
["3","Moderators"],
["2","Global Mods"],
["5","Co-Admin"],
["2|3|5","All Staff"]
];
// DO NOT EDIT BELOW
function doCook(a){document.cookie="grouptest="+nG+"; expires=Sat, 17 Jan "+((a)?"1984":"2050")+" 12:12:12 UTC; path=/";}
function getCook(){ return ((document.cookie.match(/grouptest=(.+@);?/))?RegExp.$1:"");}
if(pb_username.match(fStaff)){ var nT=""; var mUser=""; var nG=getCook(); var n=document.links;
for(var x=0; x<n.length;x++){with(n[x].href){
if(match(/\=viewprofile&user\=/)){nT=slice(lastIndexOf("=")+1); mUser="#"+nT+"@";
if(!nG.match(mUser)&&pb_username!=nT){nG+=n[x].className.replace("group","")+mUser;}
}}
} doCook(0);
if(document.pmForm){
var tr=document.pmForm.parentNode.getElementsByTagName("tr")[2].lastChild.firstChild;
var cc='<select onchange="document.location.href=this.value" name="pmgroupjump" size="1">'+
'<option value="" selected="">PM Group</option>';
var cd='<option value="/index.cgi?action=pmsend&type=pmgroup'; var ce="";
for(var x=0;x<mGroups.length;x++){ ce+=cd+mGroups[x][0]+'" >'+mGroups[x][1]+'</option>';}
tr.innerHTML=cc+ce+'</select> '+tr.innerHTML;
}
if(location.href.match(/type=pmgroup(.+)/)){ var a=RegExp.$1;
var cData=getCook().split("@"); var nData=""; var pS="";
for(var x=0;x<cData.length;x++){
nData=cData[x].split("#"); if(nData[0].match(a)){pS+=nData[1]+",";}
} document.postForm.to.value=pS.replace(/\,$/,"");
}}
// -->
</script>
Tested in IE, FF, Opera, Safari and Chrome
This code allows you to send a mass PM to an individual member group or multiple groups! (excluding the sender of course) The code gives you a dropdown box next to "New PM" in the top bar of your inbox and outbox page. You control which staff members can see the jump. You MUST have cookies enabled for this code to work.
Important!
After you install the code and set your options, the staff you entered in the code must "build" their member group list by visiting every page of your Member list. Once that is done, the code scans every page you visit for new members and if they are not in your cookie, it will add them. Also be aware that these mass PM's will show up in your outbox. Sending a mass PM to 50 members, gets you 50 messages in your outbox... I also have no way to tell if a member deletes their account. Their name will still remain in your cookies. If you know of any deleted accounts while using this code, it would be best to delete your cookie or If you know how to do it, find the cookie for your forum in your browser options, and delete the cookie value called "grouptest". Then refresh your list again by visiting the member listings.
You may also delete your cookie by copy/paste the following line into your address bar and hit ENTER.
javascript:if(confirm("Click OK to delete your Member Groups cookie.")){doCook(1);}
Enjoy!!!
SubDevo
Variables: Edit the Maroon portions.
var fStaff=/^(admin|staff1)$/i; // Usernames of Staff allowed to send Group PMs.
Enter the usernames (NOT display names) of the members allowed to send the mass PMs.
Separate the names with a "|". Do NOT put a "|" after the last name.
var mGroups=[ /* ["Group ID", "Name in the dropdown"]. */
["0","Members"],
["3","Moderators"],
["2","Global Mods"],
["5","Co-Admin"],
["2|3|5","All Staff"] <----- NO COMMA
];
These are examples only! Your group ID's will be different.
Enter the group ID followed by the name you wish to appear in the jump for that group.
Use any name you want! Copy/paste one of the lines to add more groups.
Do not put a comma after the last line in the list.
You may also send to multiple groups at a time. Look at the last line in the above example.
Enter two or more group ID's separated with a "|". Easy huh?
Here is another "trick". You may access the group PMs from a link. Place it anywhere on your board. You do not have to use the jump. Use this as the href of your link:
/index.cgi?action=pmsend&type=pmgroup1|2|3|5
You may even change the group number(s) at the end, to a group that isn't in the code and it will still find all the members in that group! nice...
How do I find my Group ID's?
Simple! Go to your "Modify Profile" page.
Then copy/paste the following line of code into your address bar and hit ENTER.
javascript:var n=document.getElementsByName("membergroup")[0].options;var b="";for(x=2;x<n.length;x++){b+=n[x].value+" = "+n[x].text+"\n";}alert(b);
You will get an alert box with a list of all your member groups and IDs.
Location: Global Footer
<script type="text/javascript">
<!--
/* Mass PM Certain Member Groups by SubDevo */
/* Global Footer - Please leave this header intact. Do not repost. */
/* interoceandesigns.proboards.com or lsdp.proboards.com */
var fStaff=/^(admin|staff1)$/i; // Usernames of Staff allowed to send Group PMs.
var mGroups=[ // ["Group ID", "Name in the dropdown"].
["0","Members"],
["3","Moderators"],
["2","Global Mods"],
["5","Co-Admin"],
["2|3|5","All Staff"]
];
// DO NOT EDIT BELOW
function doCook(a){document.cookie="grouptest="+nG+"; expires=Sat, 17 Jan "+((a)?"1984":"2050")+" 12:12:12 UTC; path=/";}
function getCook(){ return ((document.cookie.match(/grouptest=(.+@);?/))?RegExp.$1:"");}
if(pb_username.match(fStaff)){ var nT=""; var mUser=""; var nG=getCook(); var n=document.links;
for(var x=0; x<n.length;x++){with(n[x].href){
if(match(/\=viewprofile&user\=/)){nT=slice(lastIndexOf("=")+1); mUser="#"+nT+"@";
if(!nG.match(mUser)&&pb_username!=nT){nG+=n[x].className.replace("group","")+mUser;}
}}
} doCook(0);
if(document.pmForm){
var tr=document.pmForm.parentNode.getElementsByTagName("tr")[2].lastChild.firstChild;
var cc='<select onchange="document.location.href=this.value" name="pmgroupjump" size="1">'+
'<option value="" selected="">PM Group</option>';
var cd='<option value="/index.cgi?action=pmsend&type=pmgroup'; var ce="";
for(var x=0;x<mGroups.length;x++){ ce+=cd+mGroups[x][0]+'" >'+mGroups[x][1]+'</option>';}
tr.innerHTML=cc+ce+'</select> '+tr.innerHTML;
}
if(location.href.match(/type=pmgroup(.+)/)){ var a=RegExp.$1;
var cData=getCook().split("@"); var nData=""; var pS="";
for(var x=0;x<cData.length;x++){
nData=cData[x].split("#"); if(nData[0].match(a)){pS+=nData[1]+",";}
} document.postForm.to.value=pS.replace(/\,$/,"");
}}
// -->
</script>