The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
![]()
OK this is something I meant to do a while ago but
seeing it in 2.0 reminded me. So for all you 1.x'ers, here is PM pop ups to alert you to new PM's no matter where you are on the board. I have no idea if this is the same functionality as 2.0's, I don't have the code, so this is from scratch. 1) Create table: CREATE TABLE pmpopup ( fromid smallint(5) DEFAULT '0' NOT NULL, fromname varchar(50) NOT NULL, toid smallint(5) DEFAULT '0' NOT NULL, msgid mediumint(8) DEFAULT '0' NOT NULL, title varchar(100) NOT NULL, UNIQUE toid (toid) ); 2) Modify your user table: ALTER TABLE user ADD pmpopup TINYINT (1) DEFAULT '1' not null ; 3) In private.php FIND: Code:
$senderid = verifyusername($username,$password); $touser2 = addslashes($touser); if ($touserinfo = $DB_site->query_first("SELECT userid,email,usergroupid,receivepm,emailonpm FROM user WHERE username='$touser2'")) { //added pmpopup $touserid = $touserinfo[userid]; Code:
$senderid = verifyusername($username,$password); $touser2 = addslashes($touser); if ($touserinfo = $DB_site->query_first("SELECT userid,email,usergroupid,receivepm,emailonpm,pmpopup FROM user WHERE username='$touser2'")) { //added pmpopup $touserid = $touserinfo[userid]; 4) Right below that in Private.php FIND: Code:
$DB_site->query("INSERT INTO pmstats (id, toid, fromid, datetime) VALUES (NULL, '$touserid', '$senderid', NOW())"); if ($replyto) { $DB_site->query("UPDATE privatercvd SET repliedto=1 WHERE msgid=$replyto"); } Code:
// PM POP UP HACK if($touserinfo[pmpopup] !=0) { if($checkuser=$DB_site->query_first("SELECT msgid FROM pmpopup WHERE toid='$touserid'")) { $DB_site->query("UPDATE pmpopup SET fromid='$senderid',fromname='$username',toid='$touserid',msgid='$theid',title='".addslashes($title)."' WHERE toid='$touserid'"); } else { $DB_site->query("INSERT INTO pmpopup (fromid,fromname,toid,msgid,title) VALUES ('$senderid','$username','$touserid','$theid','".addslashes($title)."')"); } } // END HACK 5) Open global.php and FIND: Code:
// load vars $vars=$DB_site->query("SELECT * FROM replacement ORDER BY replacementid DESC"); Code:
// PM POP UP HACK if (($pmpopup=$DB_site->query_first("SELECT fromid,fromname,toid,msgid,title FROM pmpopup WHERE toid='$bbuserid'")) and $bbpassword !="") { $javascriptalert="<script language=\"javascript\">input_box=confirm(\"You have a new private message from $pmpopup[fromname] entitled '$pmpopup[title]'!\\n\\nClick OK to view it now.\"); if (input_box==true) { // Output when OK is clicked window.open('private.php?rt=".time()."&action=show&table=privatercvd&password=&msgid=$pmpopup[msgid]','pmnew','width=600,height=500,menubar=yes,scrollbars=yes,toolbar=yes,location=yes,directories=yes,resizable=yes,top=50,left=50'); }</script>"; $DB_site->query("DELETE FROM pmpopup WHERE toid='$bbuserid'"); } // END HACK 6) Last step. Open up your footer template and at the bottom above $CloseDB, ADD: $javascriptalert That's it, enjoy your 2.0 pop up functionality ![]() If you want to give your users an option to turn it off, you'll have to edit your profile options page and give it a radio button. |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|