SMF Support > SMF 2.0.x Support
How to display "Show unread posts since last visit" in custom themes?
Vahid Damanafshan:
I'm using a custom theme called Vertex which doesn't have the two buttons "Show unread posts since last visit" and "Show new replies to your posts" by default. Is there a way to put these two buttons just below the "Please sign in or register" denoted in the attached picture.
Edit: My forum is in Persian which is a right-to-left language. My forum address is http://forum.parsilatex.com.
Krash.:
If it's not included in your theme, you can copy the code from /Themes/default/index.templete.php and add it to your theme's index.template.php. It starts here:
--- Code: ---
// If the user is logged in, display stuff like their name, new messages, etc.
--- End code ---
If you replace the existing code that displays "Please sign in or register" in your theme, it should end up where you want it. You may have to add the necessary $txt[ ] variables to your Persian language files if they're not already there.
Vahid Damanafshan:
The attached file is my custom theme's index.template.php. Could you please tell me where I should put the code exactly? Please also put the code which I need to do the job.
Vahid Damanafshan:
Any help?
Krash.:
Don't have this theme, so I can't run the edit, but this should get you started:
--- Code: ---
/// If the user is logged in, display stuff like their name, new messages, etc.
if ($context['user']['is_logged'])
{
echo '
', $txt['vp_help'] ,' ', $context['user']['name'], ' ', $txt['bar_symbol'] ,' <a href="', $scripturl ,'?action=pm">', $txt['view_inbox'] ,'</a> ', $txt['bar_symbol'] ,' <a href="', $scripturl, '?action=pm">', $context['user']['messages'], ' ', $context['user']['messages'] != 1 ? $txt['msg_alert_messages'] : $txt['message_lowercase'], '</a>', $txt['newmessages4'], ' ', $context['user']['unread_messages'], ' ', $context['user']['unread_messages'] == 1 ? $txt['newmessages0'] : $txt['newmessages1'] ,'.
';
echo '
<br><a href="', $scripturl, '?action=unread">', $txt['unread_since_visit'], '</a>
<br><a href="', $scripturl, '?action=unreadreplies">', $txt['show_unread_replies'], '</a>
}
else
--- End code ---
Navigation
[0] Message Index
[#] Next page
Go to full version