Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 2.x > vBulletin 2.x Beta Releases
FAQ Community Calendar Today's Posts Search

Closed Thread
 
Thread Tools
Details »»

Version: 1.00, by TWTCommish TWTCommish is offline
Developer Last Online: Dec 2022 Show Printable Version Email this Page

Version: 2.2.x Rating:
Released: 01-14-2002 Last Update: Never Installs: 4
Is in Beta Stage  
No support by the author.

Alright, this is pretty straightforward. Using this, your users will be redirected right to their most recent PM, rather than just their Inbox. Furthermore, you'll be able to use the username and title of the message in the popup. Only known downside: if they have more than one PM, it just takes them to the most recent one. I might work on this later to let them know that they've got a few waiting for them, but I've found that this is a very minor problem that rarely comes up.

This is in the Beta forum for one simple reason: I had trouble putting it together, and strongly suspect there's an easier way to do this. I figured I'd take a chance and post it anyway. Started off just for my own board, but I found it so useful I thought I'd post it. Here's how it's done:

Open global.php in your main forums directory. Find this:

Code:
$newpmmsg=1;
RIGHT after it (before the eval() line), put this:

Code:
  $latest_pm = $DB_site->query_first("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 readtime = '0' AND touserid = '$bbuserinfo[userid]' AND p.fromuserid = u.userid ORDER BY dateline DESC LIMIT 1");
  extract($latest_pm);
Save and upload. Then, edit the template head_newpm. You can now use $pm_popup_id, $pm_popup_username, and $pm_popup_title within this template to refer to the ID of the PM, the username of the person who sent it, and the title of the message.

I'm sure you can all figure out for yourselves from then on how to get it to redirect and all that. Here's the template I'm using:

Code:
<script language="JavaScript">
<!--
function confirm_newpm() {
	input_box=confirm("You have a new private message from $pm_popup_username entitled \"$pm_popup_title\".\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 $inboxname in the current window.)");
		if (second_box==true) {
			window.open('private.php?s=$session[sessionhash]&action=show&privatemessageid=$pm_popup_id','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?s=$session[sessionhash]&action=show&privatemessageid=$pm_popup_id";
		}
	} else {
	// Output when Cancel is clicked
	}
}
-->
</script>
Enjoy! Screenshot attached. Please let me know if I'm being a moron, if I've missed something, etc.

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #2  
Old 01-15-2002, 02:40 PM
Scott MacVicar Scott MacVicar is offline
 
Join Date: Oct 2001
Location: Glasgow, Scotland
Posts: 1,199
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This only shows the last pm though you could have had multiple, anyway as your onyl selecting one use query_first instead of query and then fetch array.

PHP 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 readtime = '0' AND touserid = '$bbuserinfo[userid]' AND p.fromuserid = u.userid ORDER BY dateline DESC LIMIT 1");
  
extract($DB_site->fetch_array($latest_pm)); 
can be
PHP Code:
  $latest_pm $DB_site->query_first("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 readtime = '0' AND touserid = '$bbuserinfo[userid]' AND p.fromuserid = u.userid ORDER BY dateline DESC LIMIT 1");
  
extract($latest_pm); 
  #3  
Old 01-15-2002, 02:44 PM
TWTCommish's Avatar
TWTCommish TWTCommish is offline
 
Join Date: Oct 2001
Location: Pittsburgh, PA, USA
Posts: 783
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ah, I see. Well, I'm glad no larger problems exist. Is it particularly faster either way? I've edited the original post anyway.

And yeah, I'm aware of it taking you to the latest one. Hence this, from my post. Maybe you missed it.

Quote:
Only known downside: if they have more than one PM, it just takes them to the most recent one. I might work on this later to let them know that they've got a few waiting for them, but I've found that this is a very minor problem that rarely comes up.
  #4  
Old 01-16-2002, 03:04 PM
ptbyjason's Avatar
ptbyjason ptbyjason is offline
 
Join Date: Dec 2001
Location: TX
Posts: 116
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks, I thought about this a while back, but I didn't think it was possible.
  #5  
Old 01-16-2002, 03:25 PM
TWTCommish's Avatar
TWTCommish TWTCommish is offline
 
Join Date: Oct 2001
Location: Pittsburgh, PA, USA
Posts: 783
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Naw, 'tis very possible. I've been trying to have it detect whether there's more than one, and display the typical message and all that...but it's giving me a hard time, even though it seems like it ought to work. If I get it working, I'll be sure to post it as a hack.
Closed Thread


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 02:11 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.07284 seconds
  • Memory Usage 2,244KB
  • Queries Executed 18 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (3)bbcode_code
  • (2)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (5)post_thanks_box
  • (5)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (5)post_thanks_postbit_info
  • (4)postbit
  • (5)postbit_onlinestatus
  • (5)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete