Public feed #891802

Stuff

public text v1 · immutable
Raw Edit
·published 2008-02-04 22:24 UTC
rendered paste body
//################################################################################//
//         MOD NAME: Unread PMs                                                  #//
//################################################################################//
//      DESCRIPTION: Let's users view only unread PMs                            #//
//                   Sorry, folks; this couldn't be done via a plug-in because   #//
//                   it requires changing lines of code which explicitly use     #//
//                   a folder id to identify "system" folders.                   #//
//################################################################################//
//               BY: MPDev                                                       #//
//             DATE: 4.07.07                                                     #//
//          VERSION: 1.0                                                         #//
//################################################################################//
//      FILES UPDATED:                                                           #//
//                   private.php                                                 #//
//                   includes/functions_misc.php                                 #//
//################################################################################//

Please make backups of these two files before editting them so you can back
it out if you want.

//################################################################################//
//                                 private.php                                   #//
//################################################################################//

Find:

	$pmfolders = array('0' => $vbphrase['inbox'], '-1' => $vbphrase['sent_items']);

change to:

	$pmfolders = array('0' => $vbphrase['inbox'], '-1' => $vbphrase['sent_items'], '-2' => 'Unread PMs');

//################################################################################//

Find:

			switch ($vbulletin->GPC['folderid'])
			{
				case -1:

change to:

			switch ($vbulletin->GPC['folderid'])
			{
    			// MDP
				case -2:
					$fromfolder = 'Unread PMs';
					break;
			    // MDP
				case -1:

//################################################################################//


Find:

	($hook = vBulletinHook::fetch_hook('private_messagelist_start')) ? eval($hook) : false;

Add after:

    $foldernames["-2"] = "Unread PMs";
	$show['showunread'] = iif($vbulletin->userinfo['pmunread'], true, false);

//################################################################################//

Find:

		    $pms = $db->query_read_slave("
    			SELECT pm.*, pmtext.*
				    " . iif($vbulletin->options['privallowicons'], ", icon.title AS icontitle, icon.iconpath") . "
			    FROM " . TABLE_PREFIX . "pm AS pm
			    LEFT JOIN " . TABLE_PREFIX . "pmtext AS pmtext ON(pmtext.pmtextid = pm.pmtextid)
			    " . iif($vbulletin->options['privallowicons'], "LEFT JOIN " . TABLE_PREFIX . "icon AS icon ON(icon.iconid = pmtext.iconid)") . "
			    WHERE pm.userid=" . $vbulletin->userinfo['userid'] . " AND pm.folderid=" . $vbulletin->GPC['folderid'] . "
			    ORDER BY pmtext.dateline DESC
			    LIMIT $startat, " . $vbulletin->GPC['perpage'] . "
		    ");


Replace with:

		if ( $vbulletin->GPC['folderid'] == -2 )
		{
		    $pms = $db->query_read_slave("
    			SELECT pm.*, pmtext.*
				    " . iif($vbulletin->options['privallowicons'], ", icon.title AS icontitle, icon.iconpath") . "
			    FROM " . TABLE_PREFIX . "pm AS pm
			    LEFT JOIN " . TABLE_PREFIX . "pmtext AS pmtext ON(pmtext.pmtextid = pm.pmtextid)
			    " . iif($vbulletin->options['privallowicons'], "LEFT JOIN " . TABLE_PREFIX . "icon AS icon ON(icon.iconid = pmtext.iconid)") . "
			    WHERE pm.userid=" . $vbulletin->userinfo['userid'] . " AND pm.folderid=0 AND pm.messageread=0
			    ORDER BY pmtext.dateline DESC
			    LIMIT $startat, " . $vbulletin->GPC['perpage'] . "
		    ");
		}
		else
		{
		    $pms = $db->query_read_slave("
    			SELECT pm.*, pmtext.*
				    " . iif($vbulletin->options['privallowicons'], ", icon.title AS icontitle, icon.iconpath") . "
			    FROM " . TABLE_PREFIX . "pm AS pm
			    LEFT JOIN " . TABLE_PREFIX . "pmtext AS pmtext ON(pmtext.pmtextid = pm.pmtextid)
			    " . iif($vbulletin->options['privallowicons'], "LEFT JOIN " . TABLE_PREFIX . "icon AS icon ON(icon.iconid = pmtext.iconid)") . "
			    WHERE pm.userid=" . $vbulletin->userinfo['userid'] . " AND pm.folderid=" . $vbulletin->GPC['folderid'] . "
			    ORDER BY pmtext.dateline DESC
			    LIMIT $startat, " . $vbulletin->GPC['perpage'] . "
		    ");
		}

//################################################################################//
//                          includes/functions_misc.php                          #//
//################################################################################//

Find:

			$folders = array('0' => $vbphrase['inbox'], '-1' => $vbphrase['sent_items']);

replace with:

            $messagecounters["-2"] = $vbulletin->userinfo['pmunread'];
			$folders = array('0' => $vbphrase['inbox'], '-1' => $vbphrase['sent_items'], '-2' => 'Unread');