Which file deals with the popup "pm_menu" (unread messages)

Started by Julius_2000, September 29, 2022, 07:23:35 AM

Previous topic - Next topic

Julius_2000

Hello everyone,

Question: where can I find the file that handles the pm_menu (that popup window for unread messages in the top_info section)?
I found the alerts counterpart in the profile.template.php but the private messages were not there as well, as I presumed.
I would like to adapt the unread pm popup so that all content in that window is a link instead of just the subject title (just like what "alerts" does).


Doug Heffernan

Quote from: Julius_2000 on September 29, 2022, 07:23:35 AMHello everyone,

Question: where can I find the file that handles the pm_menu (that popup window for unread messages in the top_info section)?
I found the alerts counterpart in the profile.template.php but the private messages were not there as well, as I presumed.
I would like to adapt the unread pm popup so that all content in that window is a link instead of just the subject title (just like what "alerts" does).



That would be the index.template.php file. The relevant code is the following:

// Secondly, PMs if we're doing them
if ($context['allow_pm'])
echo '
<li>
<a href="', $scripturl, '?action=pm"', !empty($context['self_pm']) ? ' class="active"' : '', ' id="pm_menu_top">
<span class="main_icons inbox"></span>
<span class="textmenu">', $txt['pm_short'], '</span>', !empty($context['user']['unread_messages']) ? '
<span class="amt">' . $context['user']['unread_messages'] . '</span>' : '', '
</a>
<div id="pm_menu" class="top_menu scrollable"></div>
</li>';

Julius_2000

Thanks, Doug, but I would need the php code dealing with the content of the pm_menu (such as pm_bar and pm_unread) like it does with alerts in the profile.template.php. Weirdly, it's not there as one would suspect.

/**
 * The "popup" showing the user's alerts
 */
function template_alerts_popup()
{
global $context, $txt, $scripturl;

// Unlike almost every other template, this is designed to be included into the HTML directly via $().load()
echo '
<div class="alert_bar">
<div class="alerts_opts block">
<a href="' . $scripturl . '?action=profile;area=notification;sa=markread;', $context['session_var'], '=', $context['session_id'], '" onclick="return markAlertsRead(this)">', $txt['mark_alerts_read'], '</a>
<a href="', $scripturl, '?action=profile;area=notification;sa=alerts" class="floatright">', $txt['alert_settings'], '</a>
</div>
<div class="alerts_box centertext">
<a href="', $scripturl, '?action=profile;area=showalerts" class="button">', $txt['all_alerts'], '</a>
</div>
</div>
<div class="alerts_unread">';

if (empty($context['unread_alerts']))
template_alerts_all_read();

else
{
foreach ($context['unread_alerts'] as $id_alert => $details)
{
echo '
<', !$details['show_links'] ? 'a href="' . $scripturl . '?action=profile;area=showalerts;alert=' . $id_alert . '" onclick="this.classList.add(\'alert_read\')"' : 'div', ' class="unread_notify">
<div class="unread_notify_image">
', empty($details['sender']['avatar']['image']) ? '' : $details['sender']['avatar']['image'] . '
', $details['icon'], '
</div>
<div class="details">
<span class="alert_text">', $details['text'], '</span> - <span class="alert_time">', $details['time'], '</span>
</div>
</', !$details['show_links'] ? 'a' : 'div', '>';
}
}

echo '
</div><!-- .alerts_unread -->

Diego Andrés

The alerts are profile bits, so naturally for pm you'd find them in the pm bits.
So in PersonalMesssage.template.php you'll find what you're looking for: template_pm_popup()

SMF Tricks - Free & Premium Responsive Themes for SMF.


Advertisement: