News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Topic Start Date on Message Index

Started by GL700Wing, September 19, 2023, 03:26:09 PM

Previous topic - Next topic

GL700Wing

Link to the mod

Topic Start Date on Message Index - v1.3

By default the date/time a topic was started is not shown on the Message Index so it is not possible to sort topics by their start date/time.

This modification displays the date/time a topic was started beside the name of the member who started the topic and also adds the option to sort topics by their start date/time.


Release History:
1.0 - 18-Sep-23
o Initial Release

1.1 - 20-Sep-23
o Added mod setting to configure custom date/time format for topic start date on Message Index (includes option to hide topic start date on Message Index).
o Reduced core file edits by using hooks where possible.

1.2 - 14-Nov-23
o Added option to hide the time when the 'Shorthand Date Display' option is enabled (ie, when 'Today' and/or 'Yesterday' are shown).
o As per Steve's request added option to hide start date/time unless sorting topics by date/time.
o Added support for an alternate text string to use instead of $txt['date']
   (Note: Alternate text string name is $txt['tsdomi_date'] and it's in the Modifications language file).
o SMF 2.0: Fixed bug reported by FragaCampos that occurred when sorting by date and changing pages in boards with multiple topic pages.

1.3 - 15-Nov-23
o Fixed bug reported by Steve that occurred when the 'Hide start date/time unless sorting topics by date/time.'  option is enabled, a board was viewed for the first time and the first sort done was by topic start date.





License
Copyright 2023 Kathy Leslie

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Life doesn't have to be perfect to be wonderful ...

Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

GL700Wing

Version 1.1 - 20-Sep-23
o Added mod setting to configure custom date/time format for topic start date on Message Index (includes option to hide topic start date on Message Index).
o Reduced core file edits by using hooks where possible.


There is now a mod setting to enable the date/time format for the topic start date on the Message Index to be different to the user or system specified date/time format.

In addition, if a value of 'None' is entered for the mod setting the topic start date will not be shown on the Message Index but users will still be able to sort topics in ascending/descending start date order.
Life doesn't have to be perfect to be wonderful ...

Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

Steve

Quote from: GL700Wing on September 20, 2023, 08:30:14 AMThere is now a mod setting
Where is this setting and shouldn't the installation page automatically redirect to where the setting is?

Edit: I found the setting, just missed it somehow the first time but my second question still stands.
DO NOT pm me for support!

GL700Wing

#3
Quote from: Steve on September 20, 2023, 08:53:30 AM
Quote from: GL700Wing on September 20, 2023, 08:30:14 AMThere is now a mod setting
Where is this setting and shouldn't the installation page automatically redirect to where the setting is?

Edit: I found the setting, just missed it somehow the first time but my second question still stands.
Good call - I'll update the package installer to redirect to the mod setting.


Edit: Done!
Life doesn't have to be perfect to be wonderful ...

Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

Steve

Thanks GL!

Rhetorical question, do you ever sleep?  :laugh:
DO NOT pm me for support!

GL700Wing

Quote from: Steve on September 21, 2023, 06:17:43 AMThanks GL!

Rhetorical question, do you ever sleep?  :laugh:
Yeah - but because the timezone I live in is 14 hours different to the timezone you live in I'm probably asleep during the middle of your day ... ;)
Life doesn't have to be perfect to be wonderful ...

Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

FragaCampos

I want to thank you for this, @GL700Wing. After years (!!!) missing this great and useful feature, my forum members are happy.  :)
It's working without errors in a heavy modded forum.


A small contribution:
<file name="$languagedir/Modifications.portuguese_pt-utf8.php" error="skip">
    <operation> <!-- End of File -->
        <search position="end" />
        <add><![CDATA[
// Topic Start Date on Message Index mod
$txt['topic_start_date_mod'] = '<dt><b>Data de Início de Tópico no Índice de Mensagens</b></dt>';
$txt['topic_start_date_time_format'] = 'Formato da data/hora de início para tópicos no Índice de Mensagens';
$txt['topic_start_date_time_format_info'] = 'Introduza o formato de data/hora, a palavra <b>\'None\'</b> para esconder a data/hora de início do tópico, ou deixe em branco para usar o formato de data/hora especificado pelo sistema/utilizador.';
]]></add>
    </operation>
</file>

Requests:
- Would it be possible to add a new string in order to change the "Date" word, on the top of the board index?
- As it is now, when a topic was created yesterday, the mod shows the time after the word "yesterday" in english format. Would be possible to change the format or remove the hour entirely?


Regards.

FragaCampos

I found a bug.
Don't know if it's exclusive to my forum, but when I change from page 1 (where everything is ok) to page 2 (or any other) I get an error message.

Steve

Just an FYI, it works perfectly on mine.
DO NOT pm me for support!

GL700Wing

#9
Quote from: FragaCampos on October 25, 2023, 07:20:56 PMI want to thank you for this, @GL700Wing. After years (!!!) missing this great and useful feature, my forum members are happy.  :)
It's working without errors in a heavy modded forum.
@FragaCampos - You're welcome!

QuoteA small contribution:
<file name="$languagedir/Modifications.portuguese_pt-utf8.php" error="skip">
    <operation> <!-- End of File -->
        <search position="end" />
        <add><![CDATA[
// Topic Start Date on Message Index mod
$txt['topic_start_date_mod'] = '<dt><b>Data de Início de Tópico no Índice de Mensagens</b></dt>';
$txt['topic_start_date_time_format'] = 'Formato da data/hora de início para tópicos no Índice de Mensagens';
$txt['topic_start_date_time_format_info'] = 'Introduza o formato de data/hora, a palavra <b>\'None\'</b> para esconder a data/hora de início do tópico, ou deixe em branco para usar o formato de data/hora especificado pelo sistema/utilizador.';
]]></add>
    </operation>
</file>
Are you also able to provide me with the non-UTF8 language 'portuguese_pt' strings?

Quote- Would it be possible to add a new string in order to change the "Date" word, on the top of the board index?
Hmm - I can but I'll make this an optional string (ie, it can just be added to your language files) so that I don't have to update language files for those who are happy to use the default word.

I've decided that the new string will be called 'tsdomi_date' so if you let me know what text you want displayed I'll update the next version of the mod to include it for you.

Quote- As it is now, when a topic was created yesterday, the mod shows the time after the word "yesterday" in english format.
The mod uses the system default language strings so the word 'yesterday' (and 'today') should be displayed in your local language - is this not happening?

QuoteWould be possible to change the format ...
The mod provides you with the option to specify the start date/time format for topics on Message Index - have you tried changing the format via this option/setting?

Quote... or remove the hour entirely?
Sure - I can update the mod to remove the time when either 'today' or 'yesterday' are shown.

For this I need the following mod setting language string translated:
$txt['topic_start_date_time_shorthand'] = 'Remove timestamp for ' . strtok($txt['today'], " ") . ' and/or ' . strtok($txt['yesterday'], " ") . ' if <i>\'Enable shorthand date display\'</i> setting is <b>not</b> disabled.';
Life doesn't have to be perfect to be wonderful ...

Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

GL700Wing

Quote from: FragaCampos on October 26, 2023, 12:56:04 PMI found a bug.
Don't know if it's exclusive to my forum, but when I change from page 1 (where everything is ok) to page 2 (or any other) I get an error message.
I can't reproduce this error ...
Life doesn't have to be perfect to be wonderful ...

Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

Steve

Keep in mind @GL700Wing that @FragaCampos's forum is heavily modded. Possibly a conflict with one of his mods (standard/custom). As I said above, I have quite a few mods on my forum and I don't have that problem.
DO NOT pm me for support!

FragaCampos

Quote from: GL700Wing on October 30, 2023, 06:08:19 AMAre you also able to provide me with the non-UTF8 language 'portuguese_pt' strings?

Sure, here it goes:

<file name="$languagedir/Modifications.portuguese_pt-utf8.php" error="skip">
    <operation> <!-- End of File -->
        <search position="end" />
        <add><![CDATA[
// Topic Start Date on Message Index mod
$txt['topic_start_date_mod'] = '<dt><b>Data de In&iacute;cio de T&oacute;pico no &Iacute;ndice de Mensagens</b></dt>';
$txt['topic_start_date_time_format'] = 'Formato da data/hora de in&iacute;cio para t&oacutepicos no &Iacute;ndice de Mensagens';
$txt['topic_start_date_time_format_info'] = 'Introduza o formato de data/hora, a palavra <b>\'None\'</b> para esconder a data/hora de in&iacutecio do t&oacutepico, ou deixe em branco para usar o formato de data/hora especificado pelo sistema/utilizador.';
]]></add>
    </operation>
</file>




Quote from: GL700Wing on October 30, 2023, 06:08:19 AMHmm - I can but I'll make this an optional string (ie, it can just be added to your language files) so that I don't have to update language files for those who are happy to use the default word.

I've decided that the new string will be called 'tsdomi_date' so if you let me know what text you want displayed I'll update the next version of the mod to include it for you.

Great! Here's the text to be displayed "Data de criação"


Quote from: GL700Wing on October 30, 2023, 06:08:19 AMThe mod uses the system default language strings so the word 'yesterday' (and 'today') should be displayed in your local language - is this not happening?

Sorry, I must have made some mistake. It does use the system default language. All is good here.



Quote from: GL700Wing on October 30, 2023, 06:08:19 AMSure - I can update the mod to remove the time when either 'today' or 'yesterday' are shown.

Great.  8)
Here's the requested string translated.

$txt['topic_start_date_time_shorthand'] = 'Remover hora para ' . strtok($txt['today'], " ") . ' e/ou ' . strtok($txt['yesterday'], " ") . ' se a definição <i>\'Ativar versão curta da data\'</i> <b>não</b> estiver desativada.';



Quote from: GL700Wing on October 30, 2023, 06:42:13 AMI can't reproduce this error ...

Here's a short video to illustrate what happens. Maybe it helps.
https://mega.nz/file/bh8ABJZB#3Wpgmgdxf3Zwia4FXoooIIcv1QpttkL25mQvcjIt5Tk
If you think it's useful, I can share my MessageIndex.php file.

GL700Wing

Thanks for the language strings.

QuoteIf you think it's useful, I can share my MessageIndex.php file.
The video shows what is happening but not why - if you can share your MessageIndex.php file I will try and work out why this is happening.
Life doesn't have to be perfect to be wonderful ...

Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

FragaCampos

Of course. Here it is attached.


Thank you once more.

GL700Wing

Quote from: FragaCampos on October 30, 2023, 10:18:36 PMOf course. Here it is attached.
OK - from what I can see the two edits that should have been applied to MessageIndex.php when the mod was installed are missing - did you add this feature to your forum using the Tip/Trick or by using the mod installer?

I have confirmed that the mod installer should have been able to make the required changes to your MessageIndex.php file without any issues (ie, the changes made by the mod installer would not have conflicted with other mods that are already installed and/or custom code changes that have been made).

Attached is a copy of what your MessageIndex.php file should have looked like when it was updated using either the Tip/Trick information or the mod installer (Line 88 has been updated and Line 293 has been inserted).

QuoteThank you once more.
You're welcome.
Life doesn't have to be perfect to be wonderful ...

Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

FragaCampos

I'm sorry, I sent you the file after uninstalling the mod, but I can confirm that all edits were made via installation in the SMF admin panel without errors.
I've tried the file you edited, which is equal to the file with the mod installed, and the error persists...  :P

GL700Wing

Quote from: FragaCampos on October 31, 2023, 08:58:52 AMI'm sorry, I sent you the file after uninstalling the mod, but I can confirm that all edits were made via installation in the SMF admin panel without errors.
I've tried the file you edited, which is equal to the file with the mod installed, and the error persists...  :P
OK - looks like there is a conflict with the version of the Topic Rating Bar mod you have installed. 

Happy to try and get this mod to work with the version of the Topic Rating Bar mod you have installed but to do so I will need a copy of the Topic Rating Bar mod package file from your forum (the only SMF 2.0 version I can find is 'hooks only' and does not modify MessageIndex.php).
Life doesn't have to be perfect to be wonderful ...

Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

FragaCampos

I don't know if I can share a customized mod here, so, if you don't mind, I can send it to you via PM.

GL700Wing

Quote from: FragaCampos on November 01, 2023, 04:35:37 PMI don't know if I can share a customized mod here, so, if you don't mind, I can send it to you via PM.
AFAIK you can't attach files to PMs and I believe that in a situation like this it wouldn't be a problem if you attach it to a message and then delete it as soon as I've downloaded it.
Life doesn't have to be perfect to be wonderful ...

Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

Advertisement: