News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Enhancements to recent posts

Started by davidhs, October 01, 2013, 02:37:41 PM

Previous topic - Next topic

davidhs

Link to Mod

Enhancements to recent posts

ABOUT...

Enhancements to recent posts, 2.0.10
© 2013-2021 by davidhs
© French language 2014 by audioforall
© German and German informal languages (no help) 2014 by fondlyPiranha
© Italian language 2013 by lmerega
© Portuguese for Brazil and Portugal language 2015-2019 by Americano


This work is licensed under a Creative Commons Attribution 3.0 Unported License.

DESCRIPTION

Allows showing or hiding links to unread posts, new replies and recent posts, located in the forum header, in the forum menu and in the categories.

Also allows to show on a single line the links of the forum header and the links of the categories, and, on series SMF 2.0.x and 2.1.x, to show on a single button the links of the forum menu.

Without this MOD the forum shows only these links:

  • In the forum header: "Show unread posts since last visit." and "Show new replies to your posts." (series SMF 1.1.x and 2.0.x) or "Unread Posts" and "Updated Topics" (series SMF 2.1.x), each on one line.
  • In the categories: "Unread Posts" (series SMF 2.0.x).


EXAMPLES

Show all links in the forum header, in the forum menu and in the categories:
QuoteHide link "Show unread posts since last visit." in the forum header: [ ]
Hide link "Show all unread posts." in the forum header: [ ]
Hide link "Show new replies to your posts." in the forum header: [ ]
Hide link "Show the most recent posts." in the forum header: [ ]
Show on a single line the links of the forum header: [ ]


Hide link "Recent Unread Topics" in the forum menu: [ ]
Hide link "All Unread Topics" in the forum menu: [ ]
Hide link "Updated Topics" in the forum menu: [ ]
Hide link "Recent Posts" in the forum menu: [ ]
Show on a single button the links of the forum menu: [ ]


Hide link "Recent Unread Topics" in the categories: [ ]
Hide link "All Unread Topics" in the categories: [ ]
Hide link "Updated Topics" in the categories: [ ]
Hide link "Recent Posts" in the categories: [ ]
Show on a single line the links of the categories: [ ]

Show on a single line all links in the forum header and in the categories and on a single button all links in the forum menu:
QuoteHide link "Show unread posts since last visit." in the forum header: [ ]
Hide link "Show all unread posts." in the forum header: [ ]
Hide link "Show new replies to your posts." in the forum header: [ ]
Hide link "Show the most recent posts." in the forum header: [ ]
Show on a single line the links of the forum header: [X]


Hide link "Recent Unread Topics" in the forum menu: [ ]
Hide link "All Unread Topics" in the forum menu: [ ]
Hide link "Updated Topics" in the forum menu: [ ]
Hide link "Recent Posts" in the forum menu: [ ]
Show on a single button the links of the forum menu: [X]


Hide link "Recent Unread Topics" in the categories: [ ]
Hide link "All Unread Topics" in the categories: [ ]
Hide link "Updated Topics" in the categories: [ ]
Hide link "Recent Posts" in the categories: [ ]
Show on a single line the links of the categories: [X]

Show link "Show all unread posts." in the forum header, link "Recent posts" in the forum menu and on a single line link "New unread posts" in the categories:
QuoteHide link "Show unread posts since last visit." in the forum header: [X]
Hide link "Show all unread posts." in the forum header: [ ]
Hide link "Show new replies to your posts." in the forum header: [X]
Hide link "Show the most recent posts." in the forum header: [X]
Show on a single line the links of the forum header: [ ]


Hide link "Recent Unread Topics" in the forum menu: [X]
Hide link "All Unread Topics" in the forum menu: [X]
Hide link "Updated Topics" in the forum menu: [X]
Hide link "Recent Posts" in the forum menu: [ ]
Show on a single button the links of the forum menu: [ ]


Hide link "Recent Unread Topics" in the categories: [ ]
Hide link "All Unread Topics" in the categories: [X]
Hide link "Updated Topics" in the categories: [X]
Hide link "Recent Posts" in the categories: [X]
Show on a single line the links of the categories: [X]

Hide all links in the forum header, in the forum menu and the categories:
QuoteHide link "Show unread posts since last visit." in the forum header: [X]
Hide link "Show all unread posts." in the forum header: [X]
Hide link "Show new replies to your posts." in the forum header: [X]
Hide link "Show the most recent posts." in the forum header: [X]
Show on a single line the links of the forum header: [ ]


Hide link "Recent Unread Topics" in the forum menu: [X]
Hide link "All Unread Topics" in the forum menu: [X]
Hide link "Updated Topics" in the forum menu: [X]
Hide link "Recent Posts" in the forum menu: [X]
Show on a single button the links of the forum menu: [ ]


Hide link "Recent Unread Topics" in the categories: [X]
Hide link "All Unread Topics" in the categories: [X]
Hide link "Updated Topics" in the categories: [X]
Hide link "Recent Posts" in the categories: [X]
Show on a single line the links of the categories: [ ]

SMF COMPATIBILITY


  • SMF 1.1 to 1.1.21.
  • SMF 2.0 to 2.0.18.
  • SMF 2.1 Beta 3 and RC1 to RC3.

LANGUAGES


  • english, english_british.
  • french (incomplete).
  • german, german_informal (incomplete).
  • italian (incomplete).
  • portuguese_brazilian, brazilian (SMF 1.1.x), portuguese_pt.
  • spanish (SMF 1.1.x), spanish_es, spanish_latin.

DOWNLOAD

Link to MOD

MANUAL INSTALLATION

See https://wiki.simplemachines.org/smf/Manual_installation_of_mods

COLLABORATE WITH THIS MOD

This work is licensed under a Creative Commons Attribution 3.0 Unported License.

You are free to share and adapt this MOD. Also you can collaborate in different ways:

CHANGE LOG

Legend:   ! Fixed   + Added   - Removed   * Changed   @ Note

2.0.10  2021-02-15
------------------
! SMF 1.1.x: Use HTML entities in UTF-8 languages.
! SMF 2.0.x: Do not use HTML entities in ISO-8859-1 languages.
! SMF 2.x: The Quick Search of the Administration Center look for in settings variables of MOD.
+ SMF compatibility: 2.0.16-2.0.18 and 2.1 RC3.

2.0.9   2019-05-02
------------------
! SMF 2.x: The Quick Search of the Administration Center look for in settings variables of MOD.

2.0.8   2019-04-12
------------------
! SMF 2.1 Beta 3: Links were not displayed when user was a guest.
+ Actions of Administration panel are logged to Administration log.
@ Administration log does not exists in SMF 1.1.x.
+ SMF compatibility: 2.1 RC1 to RC2.
+ Languages: New language string in portuguese_brazilian, portuguese_brazilian-utf8, portuguese_pt, portuguese_pt-utf8, thanks to Americano.

2.0.7   2018-07-29
------------------
@ SMF 2.1 Beta 3: Links are not displayed when user is a guest.
+ SMF 2.1.x: Uninstallation code to the configuration variables.
! SMF 2.0.x: Error in HTML code.
+ SMF 2.1 Beta 3: Links in the categories.
+ SMF compatibility: 2.0.12 to 2.0.15 and 2.1 Beta 3.
* SMF 1.1.x and 2.0.x: Languages: Title of each list is used in links.

2.0.6   2015-09-24
------------------
+ SMF compatibility: 1.1.20 to 1.1.21 and 2.0.9 to 2.0.11.
+ Languages: portuguese_brazilian, portuguese_brazilian-utf8, brazilian (SMF 1.1.x), brazilian-utf8 (SMF 1.1.x), portuguese_pt, portuguese_pt-utf8, thanks to Americano.
- SMF 2.0.x: Languages: spanish, spanish-utf8 (these are not used).

2.0.5   2014-06-23
------------------
! Use HTML entities in ISO-8859-1 languages.
+ Languages: german, german-utf8, german_informal, german_informal-utf8 (no help), thanks to fondlyPiranha.
+ SMF compatibility: 2.0.8.

2.0.4   2014-01-30
------------------
+ Languages: french, french-utf8, thanks to audioforall.

2.0.3   2014-01-24
------------------
! SMF 2.0.x: The last item of a submenu should be marked as such.
+ SMF compatibility: 2.0.7.

2.0.2   2013-10-25
------------------
+ Languages: italian, italian-utf8, thanks to lmerega.
+ SMF compatibility: 1.1.19 and 2.0.6.

2.0.1   2013-10-09
------------------
! SMF 2.0.x: Menu button "Post" must be selected if current action is "unread", "unreadreplies" or "recent".
! SMF 2.0.x: Menu button "All unread posts" must be selected if page "All unread posts" is visited.

2.0     2013-08-28
------------------
@ Renames this MOD as "Enhancements to recent posts".
! SMF 2.0.x: Integration hooks functions parameters must be passed by reference.
+ Upgrade code to rename the configuration variables from version 1.0 to 2.0.
+ Links "Recent posts" in the forum header and in the categories.
+ Links "New unread posts", "All unread posts", "New replies" and "Recent posts" in the forum menu.
+ Options to showing or hiding links to recent posts, located in the forum header and in the categories.
+ Options to showing or hiding links to unread posts, new replies and recent posts, located in the forum menu.
+ SMF 2.0.x: Option to show on a single button the links of the forum menu.
+ SMF compatibility: 2.0.5.

1.0     2013-05-03
------------------
@ This work is licensed under a Creative Commons Attribution 3.0 Unported License https://creativecommons.org/licenses/by/3.0/
+ Link "Show all unread posts" in the forum header.
+ Links "All unread posts" and "New replies" in the categories.
+ SMF 1.1.x: Link "New unread posts" in the categories.
+ Options to showing or hiding links to unread posts and new replies, located in the forum header and in the categories.
+ Options to show on a single line the links of the forum header and the links of the categories.
+ Administration panel.
+ SMF compatibility: 1.1 to 1.1.18.
+ SMF compatibility: 2.0 to 2.0.4.
+ Languages: english, english-utf8, spanish_es, spanish_es-utf8, spanish_latin, spanish_latin-utf8.

impreza

Very cool and useful modification, thank you for it
Portal ToTemat.pl - treści w postaci artykułów i filmów tematycznych.

Matthew K.

Looks like a pretty cool mod, for one reason or another I quickly looked at the edits.

Here are a few things that I noticed if you are interested in some constructive feedback.
// BEGIN MOD RecentPostsEnhancement
if (!empty($category['rpe_links']) && !empty($category['show_unread']))
if (empty($modSettings['rpe_category_one_line']))
echo '
<span class="floatright">', implode(' | ', $category['rpe_links']), '</span>';
else
echo '
<span class="floatright">', $txt['posts'], ': ', implode(' / ', $category['rpe_links']), '</span>';
// END MOD RecentPostsEnhancement

As per SMF's coding style, you should really probably utilize { and } at the very least around the wrapping if condition, the second if-else would be debatable, but my guess is quite a few people in SMF would do so. So that's more of a "here's how you can follow the SMF standards better", however, you really should be clearing that floating element which is more of an issue than a matter of style.

I'm not sure what $rpe_links = rpe_links('header'); does, although to me, it kind of seems like a source function, which since you're calling it in a template, completely breaks SMF's MVC model...another kind of break in the logic is that you load $rpe_links even if the mod could be disabled...why not check the $modSettings var first, and THEN if it is enabled and exists, proceed to generate $rpe_links (source side) and then check if it's not empty and go through each one populating the list items.

Once again, quite a few places seem to lack braces that are good practices within SMF to utilize braces.

Best Regards!




davidhs

Quote from: Labradoodle-360 on October 01, 2013, 04:44:14 PM
Here are a few things that I noticed if you are interested in some constructive feedback. [...]
Thank you for your comments.

I thought guideline was
QuoteThere is no need to use braces (curly brackets) for a single control structure after a control structure.
but really is
QuoteThere is no need to use braces (curly brackets) for one line of code after a control structure.

I will review source code in next update.

Matthew K.

The guidelines have definitely changed from what they used to be. But if I'm correct, that would mean that

if ($condition === 1)
$someBool = true;

Would be acceptable. While more nested conditions and so forth should include braces.

Arantor

Guidelines are simply that: guidelines. Means it is nice if they are followed but it's not necessarily a problem if they are not.

Matthew K.

Never said it was a problem, actually. Just ways to follow closer to SMF's coding style.

Arantor


Matthew K.


Arantor

No... following the guidelines is a good thing. Just saying that SMF does not follow the guidelines but over the course of future versions we will try to bring them all consistently under the same guidelines.

davidhs

New version:
2.0.1   2013-10-09
------------------
! SMF 2.0.x: Menu button "Post" must be selected if current action is "unread", "unreadreplies" or "recent".
! SMF 2.0.x: Menu button "All unread posts" must be selected if page "All unread posts" is visited.

lmerega

EDIT:
I am translating in Italian.
I have a little problem.
In Italy we use the ' char very often.
For example "L'angolo del forum".
This is the same char in the XML file for begin/end string.
How can I use it?

I mean:
'Since last visit'
Should become
'Dall'ultima visita'
I have to replace it in wich way?

Thx

.luca

davidhs

Quote from: lmerega on October 24, 2013, 01:27:47 AM
EDIT:
I am translating in Italian.
I have a little problem.
In Italy we use the ' char very often.
For example "L'angolo del forum".
This is the same char in the XML file for begin/end string.
How can I use it?

I mean:
'Since last visit'
Should become
'Dall'ultima visita'
I have to replace it in wich way?

Thx

.luca
You must escape the quote character.
Example:
'Dall\'ultima visita'

I will update soon this MOD for SMF 1.1.19 & 2.0.6. When you translate my MOD, attach here your translation and I will add it. :)

lmerega

Ok, in attachment Italian and Italian UTF8.

Just my 2 cents :)

.luca

davidhs

Quote from: lmerega on October 24, 2013, 12:49:38 PM
Ok, in attachment Italian and Italian UTF8.

Just my 2 cents :)

.luca
Thanks!

Only one question: How do you say (write) in Italian the name of MOD? Enhancements to recent posts

This is the title of tab of setting area and usually I write in user language.

lmerega

I thought you prefered the original name.  ;D
In italian it is:
"Miglioramenti ai post recenti"

.luca

davidhs

New version:
2.0.2   2013-10-25
------------------
+ SMF compatibility: 1.1.19 and 2.0.6.
+ Languages: italian, italian-utf8, thanks to lmerega.

davidhs

New version:
2.0.3   2014-01-24
------------------
! SMF 2.0.x: The last item of a submenu should be marked as such.
+ SMF compatibility: 2.0.7.

audioforall

Hello,
I have tried to translate in French France, please see files attached

davidhs

Quote from: audioforall on January 26, 2014, 12:12:34 PM
Hello,
I have tried to translate in French France, please see files attached
Thank you :) I will add on next update.

Advertisement: