News:

Wondering if this will always be free?  See why free is better.

Main Menu

Remember Message Index Selection

Started by GL700Wing, August 05, 2024, 12:18:55 AM

Previous topic - Next topic

GL700Wing

Link to the mod

Remember Message Index Selection
v1.1

By default when clicking on the message index linktree after viewing a topic the list of messages displayed always starts on the the first page of the message index and is sorted by the date/time of the last post in descending order even if:
* previously a different page of the message index was displayed;
* the message index was sorted by a different method; and/or
* the message index was sorted in ascending order.

This behaviour can be frustrating when a user has selected a page other than the first page in a multi-page message index, and/or sorted a multi-page message index using a specific method and/or order, only to find after viewing a topic and returning to the message index that they have to select the page, sort method, and/or sort order again to continue on from where they were previously.

This modification will remember the most recent message index sort options (ie, index page, sort method, and sort order) for between 1 and 60 minutes (configurable) and list the messages using those options when clicking on the message index linktree after viewing a topic.

Release History:
1.0 - 04-Aug-24
o Initial Release

1.1 - 30-Aug-24
o Configurable timeout (between 1 and 60 minutes or 0 to disable mod) as per Steve's request.



License
Copyright 2024 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

Basically this mod is designed so that after you view a topic in a board via the message index you are returned to exactly the same location in the message index for that board that you were in before you viewed the topic.

The mod only keeps track of the sort method/order and the page you are viewing for the current board and those values expire after five minutes of inactivity so that the default sort method/order and message index page once again apply for the current board.  Also, each time the inactivity timer expires, or you change boards, the sort method/order, and/or the message index page you are viewing those values are reset/updated.

The inactivity timeout could be any value - I just picked five minutes so that if you've been viewing a topic and then go and do something else for a bit (eg, take a rest break, have a phone call, do something else on your device/computer, etc) when you return to message index on the same board the view (ie, the sort method/order and message index page) will exactly the same as it was before you viewed the topic.


Scenario:
A forum board has +2,000 topics and is configured to display 50 topics per page in the message index.  Initially the message index shows the first page of messages sorted by 'Last Post' in descending order (ie, the default message index view) and I sort the message index by 'Subject' in descending order and navigate to the 12th page where I view a topic and then return to the message index.

What happens without the mod:
When I return to the message index it shows the default message index view again - quite annoying that I have to re-sort the message index by 'Subject' in descending order and navigate to the 12th page again to continue on from where I was previously ... 

What happens with the mod:
When I return to the message index it is still sorted by 'Subject' in descending order and it is still displaying the 12th page - happy days!
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

Wish list: selectable time limit

Nice job GL!
DO NOT pm me for support!

GL700Wing

Quote from: Steve on August 05, 2024, 06:51:40 AMWish list: selectable time limit
Maybe in a month or so - heading away again tomorrow ...

QuoteNice job GL!
Thanks!
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

Antechinus


GL700Wing

Version 1.1 - 30-Aug-24
o Configurable timeout (between 1 and 60 minutes or 0 to disable mod) as per @Steve's request.


Note: If you want this feature you'll need to uninstall the previous version before installing this version.
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

DO NOT pm me for support!

Steve

I've run into a problem, if I select anything other than 0 default I get this error:

Database error, given array of integer values is empty. (boards)
DO NOT pm me for support!

GL700Wing

#8
Quote from: Steve on August 31, 2024, 10:39:18 AMI've run into a problem, if I select anything other than 0 default I get this error:

Database error, given array of integer values is empty. (boards)

I know it may be a bit difficult for you to do at present but it would be helpful if you could post the whole error message.  Also, SMF 2.0 or SMF 2.1?

Hmm - I'm assuming the problem occurs when you're browsing a board's message index (ie, not when you're saving the mod setting).

If so that's strange because all the mod update does is multiply the value of the mod setting by 60 to get the number of seconds for the timeout value (previously if the mod was enabled it used a fixed value of 300 seconds).

I didn't encounter any problems while I was testing the initial release or the update on either SMF 2.0 or SMF 2.1 so I'll investigate and let you know what I find.

Finally, and out of interest, are you able to test the initial version and confirm whether or not this issue occurs with the same board? (I'll re-add the initial release package file to the mod shortly just in case you no longer have a copy of it).


Update: Okay - I spent a while today trying to reproduce this error on both SMF 2.0 and SMF 2.1 without any success.  Please PM me if you would like me to investigate this issue on your forum.
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

That is the whole error message and I'm using 2.1. The message shows up when I try to save the mod setting with something other than 0 in the default time box.

Sending PM.
DO NOT pm me for support!

GL700Wing

Quote from: Steve on September 01, 2024, 09:59:48 AMThat is the whole error message and I'm using 2.1. The message shows up when I try to save the mod setting with something other than 0 in the default time box.
Issue is actually caused by a bug with the 'Topic Solved' mod - see https://www.simplemachines.org/community/index.php?msg=4179440
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 for all the help in resolving this.  :)
DO NOT pm me for support!

Advertisement: