PDA

View Full Version : private message pop-up


Slapyo
12-10-2004, 02:18 PM
On my homepage I have it display how many new private messages there are and how many total private messages they have. It works perfectly and displays the proper information. However, if you have pop-up notification turned on and then you visit the message board, there is no pop-up to notify you of the new private messages. I have included a few files such as global.php and wonder if the code for determining if it should pop-up or not is in one of those files.

Anyone know how I can get the pop-up to display on my homepage if the user has pop-ups turned on? Which files I need to include and the code.

Thanks.

Slapyo
12-10-2004, 03:11 PM
So far i have this:


chdir("./forums/");
require_once("./global.php");
chdir("../");

if (($bbuserinfo['pmpopup']) && ($bbuserinfo['pmunread'] > 0)) {
echo "<script type=\"text/javascript\">";
echo " confirm(\"You have a new PM from $newpm[username] ... it's called $newpm[title]\");";
echo "</script>";
}


The pop up works if you have a new PM, but it doesn't display the username and title of the PM. Is there a variable that stores this information? I am currently looking through the different portals to see what they have and haven't figured it out.

Slapyo
12-10-2004, 05:59 PM
Well I have it down to this now. I found the variables are all in global.php.

if ($shownewpm && $bbuserinfo['userid'] == 1) {
$pmpopupurl = "http://www.veteransresources.org/forums/private.php?$session[sessionurl_js]do=showpm&pmid=$newpm[pmid]";
echo " <script type=\"text/javascript\">\n";
echo " <!--\n";
echo " // script to show new private message popup\n\n";
echo " if (confirm(\"You have a new private message.\n\nSender: $newpm[username]\nTitle: '$newpm[title]'\n\nClick OK to view it, or cancel to hide this prompt.\"))\n";
echo " {\n";
echo " // Output when OK is clicked\n";
echo " if (confirm(\"Open the message in a new window?\n\n(Press cancel to open in the current window.)\"))\n";
echo " {\n";
echo " var winobj = window.open(\"$pmpopupurl\", \"pmnew\", \"menubar=yes,scrollbars=yes,toolbar=yes,location=ye s,directories=yes,resizable=yes,top=50,left=50\");\n";
echo " if (winobj == null)\n";
echo " {\n";
echo " alert(\"Unable to open a new browser window,\n This might be due to a 'popup blocker'\");\n";
echo " }\n";
echo " }\n";
echo " else\n";
echo " {\n";
echo " window.location = \"$pmpopupurl\";\n";
echo " }\n";
echo " }\n\n";
echo " // end pm popup script\n";
echo " //-->\n";
echo " </script>\n";
}

The bbuserinfo == 1 is so that I only see it and my users can't till I can get it figured out.