Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.5 > vBulletin 3.5 Add-ons

Reply
 
Thread Tools
New PM Alert (Replacement For PM Popup) Details »»
New PM Alert (Replacement For PM Popup)
Version: 1.00, by .Tim .Tim is offline
Developer Last Online: Mar 2013 Show Printable Version Email this Page

Version: 3.5.3 Rating:
Released: 12-03-2005 Last Update: Never Installs: 9
Template Edits
Code Changes  
No support by the author.

This is a port of this:

https://vborg.vbsupport.ru/showthread.php?t=59890

Not much was changed from the original, other than a few minor code changes. Don't know if it was done in the best way but it works. I don't know of a way this could be done without file edits. If anyone has any ideas, they're more than welcome. And I also plan on making this optional for users, so they can decide if they want this or the normal popup.

-------------------
Open root/global.php
-------------------
------------
Find:
------------

Code:
// new private message script
	'pm_popup_script',
-------------
Replace with:
-------------

Code:
// new private message script
	'pm_new_globals',
------------
Find:
------------

Code:
// #############################################################################
// get new private message popup
$shownewpm = false;
if ($vbulletin->userinfo['pmpopup'] == 2 AND $vbulletin->options['checknewpm'] AND $vbulletin->userinfo['userid'] AND !defined('NOPMPOPUP'))
{
	$userdm =& datamanager_init('User', $vbulletin, ERRTYPE_SILENT);
	$userdm->set_existing($vbulletin->userinfo);
	$userdm->set('pmpopup', 1);
	$userdm->save(true, 'pmpopup');	// 'pmpopup' tells db_update to issue a shutdownquery of the same name
	unset($userdm);

	if (THIS_SCRIPT != 'private' AND THIS_SCRIPT != 'login')
	{
		$newpm = $db->query_first("
			SELECT pm.pmid, title, fromusername
			FROM " . TABLE_PREFIX . "pmtext AS pmtext
			LEFT JOIN " . TABLE_PREFIX . "pm AS pm USING(pmtextid)
			WHERE pm.userid = " . $vbulletin->userinfo['userid'] . "
			ORDER BY dateline DESC
			LIMIT 1
		");
		$newpm['username'] = addslashes_js(unhtmlspecialchars($newpm['fromusername'], true), '"');
		$newpm['title'] = addslashes_js(unhtmlspecialchars($newpm['title'], true), '"');
		$shownewpm = true;
	}
}
-------------
Replace with:
-------------

Code:
// get new private message alert - hack
$newpmmsg = 0;
$shownewpm = false;
if ($vbulletin->userinfo['pmpopup'] == 2 AND $vbulletin->options['checknewpm'] AND $vbulletin->userinfo['userid'] AND $vbulletin->userinfo['pmpopup'] == 2)
{

$userdm =& datamanager_init('User', $vbulletin, ERRTYPE_SILENT);
	$userdm->set_existing($vbulletin->userinfo);
	$userdm->set('pmpopup', 1);
	$userdm->save(true, 'pmpopup');	// 'pmpopup' tells db_update to issue a shutdownquery of the same name
	unset($userdm);	

	if (THIS_SCRIPT != 'private')
	{
		$newpmmsg = 1;
		$newpm = $db->query_first("
			SELECT pm.pmid, title, fromusername, fromuserid
			FROM " . TABLE_PREFIX . "pmtext AS pmtext
			LEFT JOIN " . TABLE_PREFIX . "pm AS pm USING(pmtextid)
			WHERE pm.userid = ". $vbulletin->userinfo['userid'] ." 
			ORDER BY dateline DESC
			LIMIT 1
		");

require_once('./includes/functions_user.php');
        $pm_avaurl = fetch_avatar_url($newpm['fromuserid']);

		if (empty($pm_avaurl))
		{
			$showpm_ava = false;
		}
		else
		{
			$showpm_ava = true;
		}
        // end hack - new pm notifacation    
		$newpm['username'] = unhtmlspecialchars($newpm['fromusername'], true);
		$newpm['userid'] = unhtmlspecialchars($newpm['fromuserid'], true);
		$newpm['title'] = unhtmlspecialchars($newpm['title'], true);
		$shownewpm = true;
		
	}
}
-----------
Find:
-----------

Code:
if ($shownewpm)
{
	if ($vbulletin->userinfo['pmunread'] == 1)
	{
		$pmpopupurl = 'private.php?' . $vbulletin->session->vars['sessionurl_js'] . "do=showpm&pmid=$newpm[pmid]";
	}
	else
	{
		if (!empty($vbulletin->session->vars['sessionurl_js']))
		{
			$pmpopupurl = 'private.php?' . $vbulletin->session->vars['sessionurl_js'];
		}
		else
		{
			$pmpopupurl = 'private.php';
		}
	}
	eval('$footer .= "' . fetch_template('pm_popup_script') . '";');
}

-------------
Replace with:
-------------

Code:
if ($shownewpm)
{
	eval('$newpm = "' . fetch_template('pm_new_globals') . '";');
}
else
{
	$newpm = '';
}

/* - end file edits, now for the templates!:

---------------------
Open template: navbar
---------------------

At the very end of the template add:

Code:
<br />
$newpm
--------------------------------
Add new template: pm_new_globals
--------------------------------

Populate it with:

Code:
<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tr><if condition="$newpm">
	<td class="alt1" width="100%">
			<div class="smallfont"><img src="./image.php?u=$newpm[userid]" alt="$newpm[username]'s avatar" border="0" /></div>
		</td>	</if>
		<td class="alt2" valign="top" nowrap="nowrap">
		<div class="smallfont">$bbuserinfo[username] you have a new private message from $newpm[username], subject: '$newpm[title]'<br /><a 

href="private.php?$session[sessionurl]" TARGET="_blank">Click here to enter your private message area</a></div>
		</td>
		</tr>
</table>

Show Your Support

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

Comments
  #12  
Old 08-24-2006, 11:45 PM
OneFastM3 OneFastM3 is offline
 
Join Date: Jun 2006
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Chris-FH
THX for this modification...

Is there a chance to hold the pm alert on top until the pm is viewed? Like here:

https://vborg.vbsupport.ru/showpost....2&postcount=27

C.
Replace his if statement with:

if ($vbulletin->userinfo['pmunread'] >= 1)

and unread pm's will alway appear. Also, it doesn't matter what their popup option is set to.
Reply With Quote
Reply

Thread Tools

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 01:35 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.06624 seconds
  • Memory Usage 2,211KB
  • Queries Executed 16 (?)
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
  • (8)bbcode_code
  • (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
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (2)post_thanks_box
  • (2)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (2)post_thanks_postbit_info
  • (1)postbit
  • (2)postbit_onlinestatus
  • (2)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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete