Post by california on Mar 15, 2006 19:25:13 GMT -8
Only staff can use this feature to prevent it from being abused by spammers. Staff is anyone who can view the admin panel. The code adds a link in the info center to PM all the users in the users online list. Clicking the link opens up a new PM with all the names already in the "to:" field.
Main Footer
<script type="text/javascript">
<!--
/* admins can PM all online users in info center by california */
var linkTextOrImg = "[pm all]";
var linkPosition = 1;
var iRow = document.getElementsByTagName("tr");
if(location.href.match(/com\/?((\index\.cgi)?\??(action=home)?)?(#.+)?$/) && iRow[2].innerHTML.match(/action=admin/)){
for(r=iRow.length-1; r>0; r--){
if(iRow[r].cells[0].className == "catbg" && iRow[r].cells[0].innerHTML.match(/Users Online/)){
var uoSplit = iRow[r+1].cells[1].innerHTML.split(/&?user=/);
var uoArr = [];
for(u=1; u<uoSplit.length; u++){
uoArr.push(uoSplit.split(/\W/)[0]);
}
var pmLink = document.createElement("a");
if(linkTextOrImg.match(/http:/)){
pmLink.appendChild(new Image());
pmLink.firstChild.src = linkTextOrImg;
pmLink.firstChild.border = "0";
}else{
pmLink.appendChild(document.createTextNode(linkTextOrImg));
}
pmLink.href = "/index.cgi?action=pmsend&to="+uoArr.join(', ');
if(linkPosition == 1){
iRow[r].cells[0].lastChild.appendChild(document.createTextNode(" - "));
iRow[r].cells[0].lastChild.appendChild(pmLink);
}else if(linkPosition == 2){
var pmDiv = iRow[r+1].cells[1].appendChild(document.createElement("div"));
pmDiv.align = "right";
pmDiv.appendChild(pmLink);
}else{
iRow[r+1].cells[0].firstChild.style.cursor = "pointer";
iRow[r+1].cells[0].firstChild.title = linkTextOrImg;
iRow[r+1].cells[0].firstChild.onclick = function(){location = pmLink.href;}
}
break;
}
}
}
// -->
</script>
Main Footer
linkTextOrImg should be text if you want the link to be a text link. If you want it to be an image link, put the URL of the image (including http://).
There are three possible positions:
1 - In the "Users Online" bar.
2 - In the users online list cell, on the right.
3 - Special position, instead of adding a link somewhere, it turns the online icon image in the cell to the left of the users online list into the link. The linkTextOrImg becomes the image title/alt (what you get when you hover over the image).
The code may not work properly if you have a custom info center like Info Center 102 or Ultimate Info Center, etc. I am not willing to modify the code to work with custom info centers I'm afraid, but try all three positions and see if any of them happen to work. Also try this code above or below the custom info center code. Do not PM me for support.
Note: You can change the Users Online in bold to Today's Birthdays if you want to send a happy-birthday PM instead.
Main Footer
<script type="text/javascript">
<!--
/* admins can PM all online users in info center by california */
var linkTextOrImg = "[pm all]";
var linkPosition = 1;
var iRow = document.getElementsByTagName("tr");
if(location.href.match(/com\/?((\index\.cgi)?\??(action=home)?)?(#.+)?$/) && iRow[2].innerHTML.match(/action=admin/)){
for(r=iRow.length-1; r>0; r--){
if(iRow[r].cells[0].className == "catbg" && iRow[r].cells[0].innerHTML.match(/Users Online/)){
var uoSplit = iRow[r+1].cells[1].innerHTML.split(/&?user=/);
var uoArr = [];
for(u=1; u<uoSplit.length; u++){
uoArr.push(uoSplit.split(/\W/)[0]);
}
var pmLink = document.createElement("a");
if(linkTextOrImg.match(/http:/)){
pmLink.appendChild(new Image());
pmLink.firstChild.src = linkTextOrImg;
pmLink.firstChild.border = "0";
}else{
pmLink.appendChild(document.createTextNode(linkTextOrImg));
}
pmLink.href = "/index.cgi?action=pmsend&to="+uoArr.join(', ');
if(linkPosition == 1){
iRow[r].cells[0].lastChild.appendChild(document.createTextNode(" - "));
iRow[r].cells[0].lastChild.appendChild(pmLink);
}else if(linkPosition == 2){
var pmDiv = iRow[r+1].cells[1].appendChild(document.createElement("div"));
pmDiv.align = "right";
pmDiv.appendChild(pmLink);
}else{
iRow[r+1].cells[0].firstChild.style.cursor = "pointer";
iRow[r+1].cells[0].firstChild.title = linkTextOrImg;
iRow[r+1].cells[0].firstChild.onclick = function(){location = pmLink.href;}
}
break;
}
}
}
// -->
</script>
Main Footer
linkTextOrImg should be text if you want the link to be a text link. If you want it to be an image link, put the URL of the image (including http://).
There are three possible positions:
1 - In the "Users Online" bar.
2 - In the users online list cell, on the right.
3 - Special position, instead of adding a link somewhere, it turns the online icon image in the cell to the left of the users online list into the link. The linkTextOrImg becomes the image title/alt (what you get when you hover over the image).
The code may not work properly if you have a custom info center like Info Center 102 or Ultimate Info Center, etc. I am not willing to modify the code to work with custom info centers I'm afraid, but try all three positions and see if any of them happen to work. Also try this code above or below the custom info center code. Do not PM me for support.
Note: You can change the Users Online in bold to Today's Birthdays if you want to send a happy-birthday PM instead.