Helpful Information
 
 
Category: vBulletin.org Forum
broadcast message

If I want to shutdown my PC for hardware system upgrade, currently, I just powered off the PC so many online members may suddenly cannot connect to the vB.
So I have an ideas but I don't whether is can work thru web

add a section in the admin control panel say
Send broadcast message

so that administrator can enter a message said " The system will be shutdown in 15 mins", click send


then all vB online members will received this message by a pop-up windows

do php, html, dhtml or some others can do such things ?

i hope that we can do this by PM. I am sure that it will be possible to do a message to everyone by PM but doing one to just online users is a good idea i think.

Not all members wish to recieve PMs and have it turned off.

Just put a message in your header - that's what I do on VB-World.

John

Originally posted by PeF
Not all members wish to recieve PMs and have it turned off.

I want this to be able to be over ridden by moderators and admins, if you don't want to do it this way a message in your header is by far the best way.

I agree with PeF.
even members turn on PM however some memebers are rare to read their Pm and while they reading forum they will not notice that a new PM received

If if a pop-up window will be displayed is a very good feature

In your profile you may choose if you want a popup window when a new PM is recieved or not in vB 2.0. Just give it a try here. ;)

I cannot found such option "popup a window when received a new PM"

vB 2.0 only:
Profile -> Edit Options -> Pop up a box when you receive a Private Message?

is there a hack on 1.1.x ?

No.

Well, there is one...I made it yesterday and it's not checked for absolute Cross Browser Compatibility yet. The implementation of this Hack isn't perfect yet, too...but it 's doing a fine job here on a vB 1.1.5(Hm, could be done with templates...some lines could be optimized...). This Hack doesn't only add the requested Popup - in the browser window itself, it can be moved or closed, it also changes the routine, the New PM's are counted. The problem I see here is that in the normal PM Hack they are counted based on $bblastvisit...hm, but if I read a New (yet unread) PM it will still show up as New PM in $pmloggedin...So I added an extra Field to fix this problem, it get's 1 - New PM - by default, now if you read the PM this field is set to 0 - Old PM. Now you see only unread PM's as new PM's in $pmloggedin...Because this field has 1 as default you should do a query (update privatercvd set pmnew=0 where pmnew=1) after you've installed my Hack to set all existing PM's to 0.

I've also included a new Option in the profile, so that each Member can choose if he likes to be notified by this Popup when New PM's are there.

So, here are the instructions (hey, forgive me if they are not perfect;)):



Insert new filed in Table privatercvd:

newpm SMALLINT(1),DEAFULT(1)

Insert new Filed in Table user:

usepopup SMALLINT(1),DEFAULT(1)

Now we gotta do some changes on the following files: private.php, member.php und index.php

private.php:

find:

} #end show


insert above:

$DB_site->query("UPDATE privatercvd SET newpm=0 WHERE msgid=$msgid");


index.php:

find:

$newpmcounta = $DB_site->query_first("SELECT COUNT(msgid) AS msgid FROM privatercvd WHERE toid=$bbuserid AND UNIX_TIMESTAMP(datetime)>$bblastvisit");
$newpmcount = $newpmcounta[msgid];
if ($newpmcount == 0) {
$lightbulb = 'images/off.gif';
} else {
$lightbulb = 'images/on.gif';
}


replace with:

$newpm = $DB_site->query_first("SELECT COUNT(msgid) AS msgid FROM privatercvd WHERE toid=$bbuserid AND newpm=1");
$newpms = $newpm[msgid];
$usepop = $DB_site->query_first("SELECT usepopup FROM user WHERE userid=$bbuserid");
$usepopup = trim($usepop[usepopup]);


find:

$lastuserlink = "<a href=\"private.php?action=show&msgid=$lastsent[msgid]&password=$bbpassword\">$lastuser</a>";

insert below:

if ($usepopup==1 and $newpms>0) {
?>
<div id="showimage" style="position:absolute;width:250px;left:250;top:250">
<table border="1" bordercolor="#ff6600" width="250" bgcolor="#143f70" cellspacing="0" cellpadding="2">
<tr><td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0" height="36">
<tr><td onMousedown="initializedragie()" style="cursor:hand" width="100%"><ilayer width="100%" onSelectStart="return false">
<layer width="100%" onMouseover="dragswitch=1;drag_dropns(showimage)" onMouseout="dragswitch=0"><font face="Verdana"
color="#FFFFFF" size="+1"><b>PN Benachrichtigung</b></font></layer></ilayer></td>
<td style="cursor:hand"><a href="#" onClick="hidebox();return false"><img src="images/cross.gif" width="16"
height="14" border=0></a></td></tr><tr><td width="100%" bgcolor="#FFFFFF" style="padding:4px" colspan="2">
<small><b><font face="Verdana" size="1">Hello <? echo ($username); ?>,</b><br>You've got <b><? echo ($newpms); ?></b> new PM's. The last PM came from <b><? echo ($lastuser); ?></b>. Click <b><a href="private.php?action=show&msgid=<? echo ($lastsent[msgid]); ?>&password=<? echo ($bbpassword); ?>">here</a></b>, to go directly to this message - or <b><a href="private.php">here</a></b>, to go to your PM Box.</small>
</td></tr></table></td></tr></table></div>
<?
}


member.php:

find (will be found two times, do it for both!!!):

$emailonpm=iif($emailonpm=="yes",1,0);


insert below:

//Popup Hack
$usepopup=iif($usepopup=="yes",1,0);
//End Pop Hack


find:

$DB_site->query("UPDATE user SET birthday='$birthday',password='".addslashes($password)."',email='".addslashes($email)."',homepage='".addslashes($homepage)."',icq='".addslashes($icq)."',aim='".addslashes($aim)."',yahoo='".addslashes($yahoo)."',biography='".addslashes($biography)."',signature='".addslashes($signature)."',adminemail=$adminemail,showemail=$showemail,invisible=$invisible,cookieuser=$c ookieuser,daysprune=$prunedays,timezoneoffset=$timezoneoffset,emailnotification= $emailnotification,receivepm=$receivepm,emailonpm=$emailonpm


insert:

,usepopup=$usepopup


find:

$userinfo=$DB_site->query_first("SELECT birthday,email,password,homepage,icq,aim,yahoo,biography,signature,adminemail,sh owemail,invisible,cookieuser,daysprune,timezoneoffset,emailnotification,receivep m,emailonpm

insert:

,usepopup


find:

if ($userinfo[emailonpm]==1) {
$emailonpmchecked="checked";
$emailonpmnotchecked="";
} else {
$emailonpmchecked="";
$emailonpmnotchecked="checked";
}


insert below:

//Popup Hack
if ($userinfo[usepopup]==1) {
$usepopupchecked="checked";
$usepopupnotchecked="";
} else {
$usepopupchecked="";
$usepopupnotchecked="checked";
}
//End Popup Hack


find:

$DB_site->query("INSERT INTO user (birthday,userid,username,password,email,homepage,icq,aim,yahoo,biography,signat ure,adminemail,showemail,invisible,usertitle,joindate,canpost,cookieuser,dayspru ne,lastvisit,lastactivity,usergroupid,timezoneoffset,emailnotification,receivepm ,emailonpm


insert:

,usepopup


direct below find:

('$birthday',NULL,'".addslashes($username)."','".addslashes($password)."','".addslashes($email)."','".addslashes($homepage)."','".addslashes($icq)."','".addslashes($aim)."','".addslashes($yahoo)."','".addslashes($biography)."','".addslashes($signature)."',$adminemail,$showemail,$invisible,'".addslashes($usertitle)."',".time().",1,$cookieuser,$prunedays,".time().",".time().",$newusergroupid,$timezoneoffset,$emailnotification,$receivepm,$emailonpm


insert:

,$usepopup


Template pmloggedin

find:

$newpmconut


replace with:

$newpms


Template modifyprofile:

find:

<TR bgcolor="#DEDEDE">
<TD><normalfont><B>eMail Benachrichtigung bei Privaten Nachrichten (PMs)</B></normalfont><br>
<smallfont>Wählst Du diese Option, dann erhälst Du eine Email, wenn Dir jemand eine Private Nachricht hinterlassen hat.</smallfont></TD>
<TD><normalfont><INPUT TYPE="RADIO" NAME="emailonpm" VALUE="yes" $emailonpmchecked> Ja <INPUT TYPE="RADIO" NAME="emailonpm" VALUE="no" $emailonpmnotchecked> Nein</normalfont>
</TD></tr>


insert below:

<!-- Popup Hack -->
<TR bgcolor="#DEDEDE">
<TD><normalfont><B>Auf neue PN's via Popup Benachrichtigung hinweisen?</B></normalfont><br>
<smallfont>Bitte wähle hier aus, ob Du bei neuen privaten Nachrichten sobald Du das Forum oder die Startseite betrittst mittles eines Popupfensters hingewiesen werden willst.</smallfont></TD><TD><normalfont><INPUT TYPE="RADIO" NAME="usepopup" VALUE="yes" $usepopupchecked> Ja<INPUT TYPE="RADIO" NAME="usepopup" VALUE="no" $usepopupnotchecked> Nein</normalfont>
</TD></tr>
<!-- Popup Hack -->



In your Head include the following script:

<script language="JavaScript1.2">

//drag drop function for NS 4////
/////////////////////////////////


var dragswitch=0
var nsx
var nsy
var nstemp

function drag_dropns(name){
temp=eval(name)
temp.captureEvents(Event.MOUSEDOWN | Event.MOUSEUP)
temp.onmousedown=gons
temp.onmousemove=dragns
temp.onmouseup=stopns
}

function gons(e){
temp.captureEvents(Event.MOUSEMOVE)
nsx=e.x
nsy=e.y
}
function dragns(e){
if (dragswitch==1){
temp.moveBy(e.x-nsx,e.y-nsy)
return false
}
}

function stopns(){
temp.releaseEvents(Event.MOUSEMOVE)
}


//drag drop function for IE 4+////
/////////////////////////////////

var dragapproved=false

function drag_dropie(){
if (dragapproved==true){
document.all.showimage.style.pixelLeft=tempx+event.clientX-iex
document.all.showimage.style.pixelTop=tempy+event.clientY-iey
return false
}
}

function initializedragie(){
iex=event.clientX
iey=event.clientY
tempx=showimage.style.pixelLeft
tempy=showimage.style.pixelTop
dragapproved=true
document.onmousemove=drag_dropie
}


if (document.all){
document.onmouseup=new Function("dragapproved=false")
}

////drag drop functions end here//////

function hidebox(){
if (document.all)
showimage.style.visibility="hidden"
else if (document.layers)
document.showimage.visibility="hide"
}
</script>



And here's the pic for the close button: http://www.nt-wizards.de/close.gif










privacy (GDPR)