MyBB Community Forums

Full Version: [F] Notification about new PM from MyBB Engine [R] [C-StefanT]
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
If you got a PM from "MyBB Engine" the name links to member.php?action=profile&uid= in the new PM banner.
I can Reproduce. It shouldn't be clickable at all, or at least to the uid of 1.
(2009-05-06, 05:48 AM)Imad Jomaa Wrote: [ -> ]I can Reproduce. It shouldn't be clickable at all, or at least to the uid of 1.

What if there is no '1' uid? Not sure whether this is the "best" way; the main problem I see is that the link (<a href=) is in the actual language file, therefore no matter what we do it's almost impossible to fix without linking it to an Admin's profile or moving the link variables. I think this is the best way; Feel free to give it a jiggle - it removes the link if the username is "MyBB Engine"...

In global.php, find:

	if($pm['fromuid'] == 0)
	{
		$pm['fromusername'] = 'MyBB Engine';
	}
	
	if($mybb->user['pms_unread'] == 1)
	{
		$privatemessage_text = $lang->sprintf($lang->newpm_notice_one, get_profile_link($pm['fromuid']), htmlspecialchars_uni($pm['fromusername']), $pm['pmid'], htmlspecialchars_uni($pm['subject']));
	}
	else
	{
		$privatemessage_text = $lang->sprintf($lang->newpm_notice_multiple, $mybb->user['pms_unread'], get_profile_link($pm['fromuid']), htmlspecialchars_uni($pm['fromusername']), $pm['pmid'], htmlspecialchars_uni($pm['subject']));
	}

...and replace it with:

	if($pm['fromuid'] == 0)
	{
		$pm['fromusername'] = 'MyBB Engine';
		$user_text = $pm['fromusername'];
	}
	else
	{
		$user_text = "<a href=\"".get_profile_link($pm['fromuid'])."\">".htmlspecialchars_uni($pm['fromusername'])."</a>";
	}
	
	if($mybb->user['pms_unread'] == 1)
	{
		$privatemessage_text = $lang->sprintf($lang->newpm_notice_one, $user_text, $pm['pmid'], htmlspecialchars_uni($pm['subject']));
	}
	else
	{
		$privatemessage_text = $lang->sprintf($lang->newpm_notice_multiple, $mybb->user['pms_unread'], $user_text, $pm['pmid'], htmlspecialchars_uni($pm['subject']));
	}

In global.lang.php, find:

$l['newpm_notice_one'] = "<strong>You have one unread private message</strong> from <a href=\"{1}\">{2}</a> titled <a href=\"private.php?action=read&amp;pmid={3}\" style=\"font-weight: bold;\">{4}</a>";
$l['newpm_notice_multiple'] = "<strong>You have {1} unread private messages.</strong> The most recent is from <a href=\"{2}\">{3}</a> titled <a href=\"private.php?action=read&amp;pmid={4}\" style=\"font-weight: bold;\">{5}</a>";

...and replace with:

$l['newpm_notice_one'] = "<strong>You have one unread private message</strong> from {1} titled <a href=\"private.php?action=read&amp;pmid={2}\" style=\"font-weight: bold;\">{3}</a>";
$l['newpm_notice_multiple'] = "<strong>You have {1} unread private messages.</strong> The most recent is from {2} titled <a href=\"private.php?action=read&amp;pmid={3}\" style=\"font-weight: bold;\">{4}</a>";
I agree with Tom M's changes but I think you can use

$user_text = build_profile_link($pm['fromusername'], $pm['fromuid']);

instead of

$user_text = "<a href=\"".get_profile_link($pm['fromuid'])."\">".htmlspecialchars_uni($pm['fromusername'])."</a>";
Thank you for your bug report.

This bug has been fixed in our internal code repository. Please note that the problem will not be fixed here until these forums are updated.

With regards,
MyBB Group
(2009-05-07, 04:44 PM)Ryan Gordon Wrote: [ -> ]I agree with Tom M's changes but I think you can use

$user_text = build_profile_link($pm['fromusername'], $pm['fromuid']);

instead of

$user_text = "<a href=\"".get_profile_link($pm['fromuid'])."\">".htmlspecialchars_uni($pm['fromusername'])."</a>";

Thanks, that is the point...