- Readme First! - Read and follow the rules, otherwise your posts will be closed
There are currently, 65 guest(s) and 0 member(s) that are online. You are Anonymous user. You can register for free by clicking here
Nuke Cops :: View topic - Pop up Private messages anywhere. [ ]
Author
Message
mikem
Theme Guru
Joined: Jan 13, 2003
Posts: 1582
Location: Corn fields of Indiana
Posted:
Sun Mar 30, 2003 4:00 pm
I don't know if anyone is interested in this little trick.
By default, phpBB has a Pop-Up Private message notification built in. However, this ONLY works when you enter the forums.
Here's how to make it so your Pop-Up for PM's work on any page of Nuke.
Credit goes to
feignofdeath aka Elantra
of
http://webpromod.sourceforge.net
Code:
blocks/block-Who_is_online.php (Note: This block must be on the lefthand side for the popup to appear @ every location, if you don't use this block follow alternate step)
Add this chunk on the line before ?> (line 65)
cookiedecode($user);
$username = $cookie[1];
$result = sql_query("select user_new_privmsg from ".$user_prefix."_users where username='$username'", $dbi);
list($numrow) = sql_fetch_row($result, $dbi);
if ($numrow > 0) {
$content .= "<script language='javascript'>\n"
."<!--\n"
."var win = window.open('modules.php?name=Private_Messages&popup=1&mode=newpm', '', 'height=225,width=400')"
."//-->\n"
."</script>";
}
/////////////////// END OF HACK UNLESS YOU NEED ALTERNATE BLOCK STEP /////////////////////
Alternate Step for 2nd part of hack
first make sure that the block at least has a statement that reads:
global $user, $cookie, $prefix, $dbi, $user_prefix;
this line should be near the top (normally within the first 10 lines of code)
if not add that line as for this hack needs it.
You should now be able to copy this code into any block you want that shows up in the lefthand side:
cookiedecode($user);
$username = $cookie[1];
$result = sql_query("select user_new_privmsg from ".$user_prefix."_users where username='$username'", $dbi);
list($numrow) = sql_fetch_row($result, $dbi);
if ($numrow > 0) {
$content .= "<script language='javascript'>\n"
."<!--\n"
."var win = window.open('modules.php?name=Private_Messages&popup=1&mode=newpm', '', 'height=225,width=400')"
."//-->\n"
."</script>";
}
/////////////////// END OF ALTERNATE BLOCK STEP HACK ///////////////////////////////////
If you have a problem... Post on the boards @ http://webpromod.sourceforge.net
mikem
_________________Getting Started | My Projects Last edited by mikem on Sun Mar 30, 2003 5:33 pm; edited 1 time in total
sixonetonoffun
Major
Joined: Jan 13, 2003
Posts: 892
Posted:
Sun Mar 30, 2003 4:45 pm
Shouldn't that be changed to something like this?? To avoid the MySQL fetch row result warnings??? (I didn't test this)
Code:
cookiedecode($user);
$username = $cookie[1];
$sql = "select user_new_privmsg from ".$user_prefix."_users where username='$username'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$user_new_privmsg = $row[user_new_privmsg];
if ($user_new_privmsg > 0) {
$content .= "<script language='javascript'>\n"
."<!--\n"
."var win = window.open('modules.php?name=Private_Messages&popup=1&mode=newpm', '', 'height=225,width=400')"
."//-->\n"
."</script>";
}
_________________www.netflake.com
www.glowoptics.com
mikem
Theme Guru
Joined: Jan 13, 2003
Posts: 1582
Location: Corn fields of Indiana
Posted:
Sun Mar 30, 2003 5:27 pm
probably should be. This code was written for Nuke6.0 with Tom's phpBBport2.0.6, but I have it running as-is on our site running the latest 6.5 release with all patches and it works perfectly.
The uname should defiantely be changed to username...
mikem
_________________Getting Started | My Projects
sixonetonoffun
Major
Joined: Jan 13, 2003
Posts: 892
Posted:
Sun Mar 30, 2003 5:47 pm
Edit Ooops
Ok here is what I did for 6.5 maybe someone else would like to too
In footer.php after
if (eregi("footer.php",$_SERVER['PHP_SELF'])) {
Header("Location: index.php");
die();
}
Code:
global $user, $cookie, $prefix, $dbi, $user_prefix;
cookiedecode($user);
$username = $cookie[1];
$sql = "select user_new_privmsg from ".$user_prefix."_users where username='$username'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$user_new_privmsg = $row[user_new_privmsg];
if ($user_new_privmsg > 0) {
echo "<script language=\"JavaScript\" src=\"includes/pm.js\"></script>\n";
}
Then upload this file HERE pm.js to your includes directory.
Dunno why I bothered I hate popups in any way shape or form
But some people like the pm one for some reason or other
Edit*
Well that don't work for chit in some parts of the site so I guess the gawd dayumed things gotta stay in the block.
_________________www.netflake.com
www.glowoptics.com
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum