Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Topic started by: Dwev on January 23, 2018, 11:12:31 AM

Title: "Unread posts" and "New replies" in Profile?
Post by: Dwev on January 23, 2018, 11:12:31 AM
In the theme we're using there are no links to "Unread posts" and "New replies" in the header.

So I would like to add them to /profile

Would anybody be able (and be so kind) to tell me how I can achieve this?

Any help is very much appreciated!
Title: Re: "Unread posts" and "New replies" in Profile?
Post by: Aleksi "Lex" Kilpinen on January 23, 2018, 11:25:55 AM
Where in the profile? Perhaps show a screencap of the desired location?
The links in themselves are easy.

Basically add these links where you want them.


<a href="', $scripturl, '?action=unread">', $txt['unread_since_visit'], '</a>
<a href="', $scripturl, '?action=unreadreplies">', $txt['show_unread_replies'], '</a>
Title: Re: "Unread posts" and "New replies" in Profile?
Post by: Dwev on January 23, 2018, 11:59:31 AM
I've added a screenshot of how it looks right now.

I think between Show Posts and Show Stats would be perfect.

Title: Re: "Unread posts" and "New replies" in Profile?
Post by: Aleksi "Lex" Kilpinen on January 23, 2018, 12:02:51 PM
What theme is that? :)

In Curve, I think you could do this

In profile.template.php

FIND

echo '
<a href="', $scripturl, '?action=profile;area=showposts;u=', $context['id_member'], '">', $txt['showPosts'], '</a><br />
<a href="', $scripturl, '?action=profile;area=statistics;u=', $context['id_member'], '">', $txt['statPanel'], '</a>
</p>';


REPLACE WITH

echo '
<a href="', $scripturl, '?action=profile;area=showposts;u=', $context['id_member'], '">', $txt['showPosts'], '</a><br />
<a href="', $scripturl, '?action=unread">', $txt['unread_since_profile'], '</a><br />
<a href="', $scripturl, '?action=unreadreplies">', $txt['show_unread_rep_profile], '</a><br />
<a href="', $scripturl, '?action=profile;area=statistics;u=', $context['id_member'], '">', $txt['statPanel'], '</a>
</p>';


Then add to modifications.english.php


$txt['unread_since_profile'] = 'Unread topics';
$txt['show_unread_rep_profile'] = 'Unread replies';
Title: Re: "Unread posts" and "New replies" in Profile?
Post by: Dwev on January 23, 2018, 05:16:16 PM
The theme is our own, based on bootstrap (can be seen in action here (https://www.applezone.nl)).

I put your first code in Profile.template.php of Themes/default/ and the second bit of code in Themes/default/languages/Modifications.english-utf8.php.

But both "unread_since_profile" and "show_unread_rep_profile" show as black (instead of the normal red) in the editor and the site throws the following error when I try to open the Profile-page:

syntax error, unexpected '/'

Would it help if I attached some of those files here?
Title: Re: "Unread posts" and "New replies" in Profile?
Post by: Aleksi "Lex" Kilpinen on January 23, 2018, 10:15:18 PM
I could look at them, specifically both of the mentioned files - They should be correct,
and I did try those codes on the original files and didn't notice anything off.
Title: Re: "Unread posts" and "New replies" in Profile?
Post by: Dwev on January 24, 2018, 02:42:06 AM
Both included with this post.
Title: Re: "Unread posts" and "New replies" in Profile?
Post by: Aleksi "Lex" Kilpinen on January 24, 2018, 03:06:37 AM
Thanks, it'll take about an hour or so before I'm back at the keyboard, but I'll get back to you. :)
Title: Re: "Unread posts" and "New replies" in Profile?
Post by: Aleksi "Lex" Kilpinen on January 24, 2018, 05:28:51 AM
I'm so sorry, I made a typo in my original code here. I left out one small '

The edit to profile.template should be this:


echo '
<a href="', $scripturl, '?action=profile;area=showposts;u=', $context['id_member'], '">', $txt['showPosts'], '</a><br />
<a href="', $scripturl, '?action=unread">', $txt['unread_since_profile'], '</a><br />
<a href="', $scripturl, '?action=unreadreplies">', $txt['show_unread_rep_profile'], '</a><br />
<a href="', $scripturl, '?action=profile;area=statistics;u=', $context['id_member'], '">', $txt['statPanel'], '</a>
</p>';


Your modifications.english-utf8 seems fine to me. :)
Title: Re: "Unread posts" and "New replies" in Profile?
Post by: Dwev on January 24, 2018, 07:37:38 AM
Yes, that did the job!

You're my hero!!!   ;D ;D ;D
Title: Re: "Unread posts" and "New replies" in Profile?
Post by: Aleksi "Lex" Kilpinen on January 24, 2018, 07:38:16 AM
You are welcome :)