Version: 1.00, by TWTCommish
Developer Last Online: Dec 2022
Version: 2.2.x
Rating:
Released: 01-21-2002
Last Update: Never
Installs: 41
No support by the author.
What's it do?
Simple: it checks to see how many new PMs a user has. If they've only got one (which is usually the case...I don't think many people get tons of new PMs), the popup JavaScript alert displayed to them will let them know who sent them the message, what it's title is, and, rather than take them to the Inbox, it'll take them directly to the message.
If there's more than one, it'll display a more vague message, letting them know just how many new messages they have, and redirecting them to their Inbox (which is where the current popup directs you). Anyway, here's the hack:
Open global.php. Around line 266 you should see the following:
Code:
$newpmmsg=1;
RIGHT below it, place this (REPLACE your current code for this hack with the code below, if you happen to be one of the few people who actually intalled this originally from the Beta Hacks forum. )
Code:
$latest_pm = $DB_site->query("SELECT p.privatemessageid AS pm_popup_id, p.title AS pm_popup_title, u.username AS pm_popup_username FROM privatemessage p, user u WHERE messageread = 0 AND p.userid = $bbuserinfo[userid] AND p.fromuserid = u.userid ORDER BY dateline DESC");
$hack_pm_total = $DB_site->num_rows($latest_pm);
if ($hack_pm_total > 1) {
eval("\$pm_popup_text = \"".gettemplate('pm_popup_multiple')."\";");
eval("\$pm_popup_url = \"".gettemplate('pm_popup_url_multiple')."\";");
} else {
extract($DB_site->fetch_array($latest_pm));
eval("\$pm_popup_text = \"".gettemplate('pm_popup')."\";");
eval("\$pm_popup_url = \"".gettemplate('pm_popup_url')."\";");
}
Now, create the four new templates. I've attached a file to this post containing the names of the four templates, and the text I've used to populate them -- which will probably be the same text and such you'll want to use. Don't be intimidated...they're all very small.
After that, edit your head_newpm template to make use of the new variables. Here's my use of it (highly suggested):
Code:
<script language="JavaScript">
<!--
function confirm_newpm() {
input_box = confirm("$pm_popup_text");
if (input_box == true) { // Output when OK is clicked
second_box = confirm("Open in new window?\n\n(Press cancel to open your $inboxname in the current window.)");
if (second_box == true) {
window.open('$pm_popup_url','pmnew','width=600,height=500,menubar=yes,scrollbars=yes,toolbar=yes,location=yes,directories=yes,resizable=yes,top=50,left=50');
} else {
window.location = "$pm_popup_url";
}
} else {
// Output when Cancel is clicked
}
}
-->
</script>
Enjoy.
Show Your Support
This modification may not be copied, reproduced or published elsewhere without author's permission.
on the forum index page but I have to wait for one to test it on site index page, cause when I log in it takes me straight into forum index. Usually they popup when I get on site.
I've just checked, and the script is being called into the page when I get a new message, but it's not doing anything, here is the script:
Code:
<!-- BEGIN TEMPLATE: head_newpm -->
<script language="JavaScript">
<!--
function confirm_newpm() {
input_box = confirm("<!-- BEGIN TEMPLATE: pm_popup -->
You have a new private message from ofDan entitled \"Re: test.\"\nClick OK to view it, or cancel to hide this prompt.
<!-- END TEMPLATE: pm_popup -->");
if (input_box == true) { // Output when OK is clicked
second_box = confirm("Open in new window?\n\n(Press cancel to open your Inbox in the current window.)");
if (second_box == true) {
window.open('<!-- BEGIN TEMPLATE: pm_popup_url -->
private.php?action=show&privatemessageid=674
<!-- END TEMPLATE: pm_popup_url -->','pmnew','width=600,height=500,menubar=yes,scrollbars=yes,toolbar=yes,location=yes,directories=yes,resizable=yes,top=50,left=50');
} else {
window.location = "<!-- BEGIN TEMPLATE: pm_popup_url -->
private.php?action=show&privatemessageid=674
<!-- END TEMPLATE: pm_popup_url -->";
}
} else {
// Output when Cancel is clicked
}
}
-->
</script>
<!-- END TEMPLATE: head_newpm -->
I just saw a problem, I had my template tags turned on, which I believed might have been the cause of the problem, so I tuned them off, and it's still not working
Code:
<script language="JavaScript">
<!--
function confirm_newpm() {
input_box = confirm("You have a new private message from ofDan entitled \"Re: test.\"\nClick OK to view it, or cancel to hide this prompt.");
if (input_box == true) { // Output when OK is clicked
second_box = confirm("Open in new window?\n\n(Press cancel to open your Inbox in the current window.)");
if (second_box == true) {
window.open('private.php?action=show&privatemessageid=676','pmnew','width=600,height=500,menubar=yes,scrollbars=yes,toolbar=yes,location=yes,directories=yes,resizable=yes,top=50,left=50');
} else {
window.location = "private.php?action=show&privatemessageid=676";
}
} else {
// Output when Cancel is clicked
}
}
-->
</script>
Originally posted by TWTCommish
Any progress? I'd be glad to help if I can. Are you sure you've tried it with any new PMs? Sometimes the vBulletin PM popups don't popup, for no apparent reason. You might want to try it more than once.
it have the popup window but still the old one!! :dead:
now i change the head_pm template like ur first post say
If I get more than one PM, the popup says you have an email from (blank) entitled (blank) but that is not the problem... It gets confused an open me a page that says the message cannot be found... maybe we should redirect to PM box?
Are you sure? You have more than one new PM, and yet it only acts as if there's one? Keep in mind that if you have 2 new PMs and get a popup, and then send yourself another, the popup will only "see" one. That's the way the system works.
Daniel: that looks like it should work. Does your <body> tag on that same page at the same time have an onload="" attribute calling the confirm_newpm() function?
squawell: as Lionel said, please replace your head_newpm template with the one now listed in the first post of this thread.