Advertisement:

Author Topic: Enhancements to recent posts  (Read 38010 times)

Offline davidhs

  • Sophist Member
  • *****
  • Posts: 1,055
  • Gender: Male
Enhancements to recent posts
« on: October 01, 2013, 02:37:41 PM »
Link to Mod

Enhancements to recent posts

ABOUT...

Enhancements to recent posts, 2.0.9
© 2013-2019 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:
Quote
Hide 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:
Quote
Hide 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:
Quote
Hide 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:
Quote
Hide 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.15.
  • SMF 2.1 Beta 3 and RC1 to RC2.

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

Code: [Select]
Legend:   ! Fixed   + Added   - Removed   * Changed   @ Note

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.
« Last Edit: May 24, 2015, 06:51:25 AM by Illori »

Offline impreza

  • Sophist Member
  • *****
  • Posts: 1,054
    • infomiasto.eu
Re: Enhancements to recent posts
« Reply #1 on: October 01, 2013, 04:34:58 PM »
Very cool and useful modification, thank you for it
Portal infomiasto.eu - treści w postaci artykułów i filmów tematycznych

Offline Matthew K.

  • SMF Super Hero
  • *******
  • Posts: 12,430
  • Gender: Male
    • matthew.kerle on Facebook
    • @matthew_kerle on Twitter
Re: Enhancements to recent posts
« Reply #2 on: October 01, 2013, 04:44:14 PM »
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.
Code: [Select]
// 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!




Offline davidhs

  • Sophist Member
  • *****
  • Posts: 1,055
  • Gender: Male
Re: Enhancements to recent posts, 2.0 (SMF 1.1-1.1.18, 2.0-2.0.5)
« Reply #3 on: October 05, 2013, 07:37:04 AM »
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
Quote
There is no need to use braces (curly brackets) for a single control structure after a control structure.
but really is
Quote
There 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.

Offline Matthew K.

  • SMF Super Hero
  • *******
  • Posts: 12,430
  • Gender: Male
    • matthew.kerle on Facebook
    • @matthew_kerle on Twitter
Re: Enhancements to recent posts, 2.0 (SMF 1.1-1.1.18, 2.0-2.0.5)
« Reply #4 on: October 05, 2013, 12:10:44 PM »
The guidelines have definitely changed from what they used to be. But if I'm correct, that would mean that
Code: [Select]
if ($condition === 1)
$someBool = true;
Would be acceptable. While more nested conditions and so forth should include braces.

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,621
    • StoryBB/StoryBB on GitHub
Re: Enhancements to recent posts, 2.0 (SMF 1.1-1.1.18, 2.0-2.0.5)
« Reply #5 on: October 05, 2013, 12:58:56 PM »
Guidelines are simply that: guidelines. Means it is nice if they are followed but it's not necessarily a problem if they are not.
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline Matthew K.

  • SMF Super Hero
  • *******
  • Posts: 12,430
  • Gender: Male
    • matthew.kerle on Facebook
    • @matthew_kerle on Twitter
Re: Enhancements to recent posts, 2.0 (SMF 1.1-1.1.18, 2.0-2.0.5)
« Reply #6 on: October 05, 2013, 01:13:37 PM »
Never said it was a problem, actually. Just ways to follow closer to SMF's coding style.

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,621
    • StoryBB/StoryBB on GitHub
Re: Enhancements to recent posts, 2.0 (SMF 1.1-1.1.18, 2.0-2.0.5)
« Reply #7 on: October 05, 2013, 01:14:19 PM »
Which as stated is in itself inconsistent.
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline Matthew K.

  • SMF Super Hero
  • *******
  • Posts: 12,430
  • Gender: Male
    • matthew.kerle on Facebook
    • @matthew_kerle on Twitter
Re: Enhancements to recent posts, 2.0 (SMF 1.1-1.1.18, 2.0-2.0.5)
« Reply #8 on: October 05, 2013, 01:48:52 PM »
Well then you might as well not even try huh?

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,621
    • StoryBB/StoryBB on GitHub
Re: Enhancements to recent posts, 2.0 (SMF 1.1-1.1.18, 2.0-2.0.5)
« Reply #9 on: October 05, 2013, 01:51:01 PM »
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.
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline davidhs

  • Sophist Member
  • *****
  • Posts: 1,055
  • Gender: Male
Re: Enhancements to recent posts, 2.0.1 (SMF 1.1-1.1.18, 2.0-2.0.5)
« Reply #10 on: October 13, 2013, 08:51:23 AM »
New version:
Code: [Select]
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.

Offline lmerega

  • Newbie
  • *
  • Posts: 5
Re: Enhancements to recent posts, 2.0.1 (SMF 1.1-1.1.18, 2.0-2.0.5)
« Reply #11 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
« Last Edit: October 24, 2013, 01:47:39 AM by lmerega »

Offline davidhs

  • Sophist Member
  • *****
  • Posts: 1,055
  • Gender: Male
Re: Enhancements to recent posts, 2.0.1 (SMF 1.1-1.1.18, 2.0-2.0.5)
« Reply #12 on: October 24, 2013, 05:55:39 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. :)

Offline lmerega

  • Newbie
  • *
  • Posts: 5
Re: Enhancements to recent posts, 2.0.1 (SMF 1.1-1.1.18, 2.0-2.0.5)
« Reply #13 on: October 24, 2013, 12:49:38 PM »
Ok, in attachment Italian and Italian UTF8.

Just my 2 cents :)

.luca

Offline davidhs

  • Sophist Member
  • *****
  • Posts: 1,055
  • Gender: Male
Re: Enhancements to recent posts, 2.0.1 (SMF 1.1-1.1.18, 2.0-2.0.5)
« Reply #14 on: October 24, 2013, 04:08:41 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.

Offline lmerega

  • Newbie
  • *
  • Posts: 5
Re: Enhancements to recent posts, 2.0.1 (SMF 1.1-1.1.18, 2.0-2.0.5)
« Reply #15 on: October 25, 2013, 01:30:20 AM »
I thought you prefered the original name.  ;D
In italian it is:
"Miglioramenti ai post recenti"

.luca

Offline davidhs

  • Sophist Member
  • *****
  • Posts: 1,055
  • Gender: Male
Re: Enhancements to recent posts, 2.0.2 (SMF 1.1-1.1.19, 2.0-2.0.6)
« Reply #16 on: October 25, 2013, 04:40:47 PM »
New version:
Code: [Select]
2.0.2   2013-10-25
------------------
+ SMF compatibility: 1.1.19 and 2.0.6.
+ Languages: italian, italian-utf8, thanks to lmerega.

Offline davidhs

  • Sophist Member
  • *****
  • Posts: 1,055
  • Gender: Male
Re: Enhancements to recent posts, 2.0.3 (SMF 1.1-1.1.19, 2.0-2.0.7)
« Reply #17 on: January 25, 2014, 12:09:39 PM »
New version:
Code: [Select]
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.

Offline audioforall

  • Newbie
  • *
  • Posts: 5
Re: Enhancements to recent posts, 2.0.3 (SMF 1.1-1.1.19, 2.0-2.0.7)
« Reply #18 on: January 26, 2014, 12:12:34 PM »
Hello,
I have tried to translate in French France, please see files attached

Offline davidhs

  • Sophist Member
  • *****
  • Posts: 1,055
  • Gender: Male
Re: Enhancements to recent posts, 2.0.3 (SMF 1.1-1.1.19, 2.0-2.0.7)
« Reply #19 on: January 26, 2014, 12:41:34 PM »
Hello,
I have tried to translate in French France, please see files attached
Thank you :) I will add on next update.