MyBB Community Forums

Full Version: Absolute links in PM notice?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Within a PM notice, is it possible to change the link for the subject to an absolute link rather than a relative link?

This is part of my website integration effort, as I have most of my pages pulling the MYBB header.

Right now on a page it will show up as
www.mywebsite.com/private.php

However, I want it to show up as
www.mywebsite.com/forum/private.php

I tired to change the global language file, but it didn't work. :/

I don't understand what you mean, www.mywebsite.com/private.php is not good as it shows? Or you want it to be www.mywebsite.com/forum/private.php instead of this first one?
(2011-12-09, 03:16 PM)JovanJ. Wrote: [ -> ]I don't understand what you mean, www.mywebsite.com/private.php is not good as it shows? Or you want it to be www.mywebsite.com/forum/private.php instead of this first one?


I want it as the latter.

This is because I have php pages on my website root directory that will integrate the forum header (which includes PM notice). When the PM notice shows up on these pages, the link to the message subject title does not reflect the forum directory.

Unfortunately I don't have a live example to display because this is a new redesign I've been working on offline.
yes it is possible as I have done it myself, but it does require several file changes

in global.php

find:
$privatemessage_text = $lang->sprintf($lang->newpm_notice_one, $user_text, $pm['pmid'], htmlspecialchars_uni($pm['subject']));

replace:
$privatemessage_text = $lang->sprintf($lang->newpm_notice_one, $user_text, $mybb->settings['bburl'], $pm['pmid'], htmlspecialchars_uni($pm['subject']));

find:
$privatemessage_text = $lang->sprintf($lang->newpm_notice_multiple, $mybb->user['pms_unread'], $user_text, $pm['pmid'], htmlspecialchars_uni($pm['subject']));

replace:
$privatemessage_text = $lang->sprintf($lang->newpm_notice_multiple, $mybb->user['pms_unread'], $user_text, $mybb->settings['bburl'], $pm['pmid'], htmlspecialchars_uni($pm['subject']));


in inc/languages/<language>/global.lang.php (do this for all your supported languages)

find:
$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>";

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

find:
$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>";

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


Template changes:

in global_pm_alert you need to insert $mybb->settings['bburl'] into the image tags

<div class="pm_alert" id="pm_notice">
	<div class="float_right"><a href="{$mybb->settings['bburl']}/private.php?action=dismiss_notice&amp;my_post_key={$mybb->post_code}" title="{$lang->dismis_notice}" onclick="return MyBB.dismissPMNotice()"><img src="{$mybb->settings['bburl']}/{$theme['imgdir']}/dismiss_notice.gif" alt="{$lang->dismis_notice}" title="[x]" /></a></div>
	<div>{$privatemessage_text}</div>
</div>
Thank you very much, that's exactly what I needed!