Solved: 5 Years, 6 Months ago Private Message title in dropdown of header_welcomeblock_member?
Solved: 5 Years, 6 Months ago
Thank you RateU!!! Big Grin It works


In global.php BEFORE of this line:

// Load appropriate welcome block for the current logged in user

(Thank you Leefish for the place Big Grin )

I added this code:

// Dropdown PM
	$query = $db->query("
		SELECT pm.subject, pm.pmid, pm.status, pm.dateline, fu.username AS fromusername, fu.uid AS fromuid
		FROM ".TABLE_PREFIX."privatemessages pm
		LEFT JOIN ".TABLE_PREFIX."users fu on (fu.uid=pm.fromid)
		WHERE pm.folder = '1' AND pm.uid = '{$mybb->user['uid']}'
		ORDER BY pm.dateline DESC
	$private_dropdown_dateline = my_date($mybb->settings['dateformat'], $private_dropdown['dateline']);
	while($private_dropdown = $db->fetch_array($query))
		$private_dropdown_link = htmlspecialchars_uni($private_dropdown['pmid']);
		$private_dropdown_status = htmlspecialchars_uni($private_dropdown['status']);
		$private_dropdown_subject = htmlspecialchars_uni($private_dropdown['subject']);
		$private_dropdown_fromuser = htmlspecialchars_uni($private_dropdown['fromusername']);
		$private_dropdown_dateline = my_date($mybb->settings['dateformat'], $private_dropdown['dateline']);
	eval("\$private_dropdown_template_template .= \"".$templates->get("private_dropdown_template_template")."\";");
eval("\$private_dropdown_template = \"".$templates->get("private_dropdown_template")."\";");

Created a new template called "private_dropdown_template" with inside only this variable:


And created a new template called "private_dropdown_template_template" with status PM (unread/read), date, from user, subject, link to PM:

<if ($private_dropdown['status'] == 0) then>

<a href="private.php?action=read&amp;pmid={$private_dropdown['pmid']}">
<strong>{$private_dropdown_subject} from {$private_dropdown_fromuser}, <span class="icon-stopwatch"></span> <?=my_date($mybb->settings['dateformat'], $private_dropdown['dateline'])?> <?=my_date($mybb->settings['timeformat'], $private_dropdown['dateline'])?> Unread

<a href="private.php?action=read&amp;pmid={$private_dropdown['pmid']}">{$private_dropdown_subject} from {$private_dropdown_fromuser}, <span class="icon-stopwatch"></span> <?=my_date($mybb->settings['dateformat'], $private_dropdown['dateline'])?> <?=my_date($mybb->settings['timeformat'], $private_dropdown['dateline'])?></a>	


(With PHP and Template Conditionals Plugin)

The result

[Image: 3cuvgAa.png]

I used:

<?=my_date($mybb->settings['dateformat'], $private_dropdown['dateline'])?>
<?=my_date($mybb->settings['timeformat'], $private_dropdown['dateline'])?>

because with {$private_dropdown['dateline']} I had UNIX datetime like "1444702684"

Other thing about PM status. If I used this code:

if($pm['status'] == 0)
		$private_lang_unread = "<span style=\"font-weight: bold;\">Unread !</span>";
if($pm['status'] == 1)
		$private_lang_unread = "Already read";

with {$private_lang_unread} I had always and only "Unread" mark , also on all other PM's already read.

Maybe not 100% perfect but it seems to work Big Grin

Thank you again Smile

Messages In This Thread
RE: Private Message title in dropdown of header_welcomeblock_member? - by niere8 - 2015-10-13, 03:22 AM

Forum Jump:

Users browsing this thread: 1 Guest(s)