Support Forum

Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
general-topic
Topics order in forum, seems not to work
Avatar
Giovanna
Nijmegen - NL
Member
sp_UserOfflineSmall Offline
Mar 14, 2016 - 4:09 am

Hello,
this is the first time I notice this happening: the last 3 topics in a forum are not ordered correctly from the most recently created onwards. I cannot work out why, so I attach you 2 screenshots: the display settings and the forum view. It is in Italian but I think you can understand (giorni = days, ore = hours, settimana = week. The dates in the topic titles are the real creation dates of the topic itself and I checked they are the same as the real topic dates (can make more screenshots if you like, please let me know).
How can I solve this please? Thanks and have a good day!

 

forum-view-order-options.jpgImage Enlarger 

wrong-date-order.jpgImage Enlarger

My forum (in Italian) is: MsPforum

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Mar 14, 2016 - 4:23 am

I am not totally sure what you are meaning so perhaps if I describe how things are naturally sorted then you can tell me if this is what you were expecting!

Simple:Press follows the common practice in forums of sorting topics by their most recent reply. So if an old topic receives a new post, that topic will bubble back to the top of the topic listing etc..

So - is that not what is happening here? Or is that not what you want to happen?

andy-signature.png
YELLOW
SWORDFISH
Avatar
Giovanna
Nijmegen - NL
Member
sp_UserOfflineSmall Offline
Mar 14, 2016 - 6:32 am

oh... so far it seemed it ordered by latest creation date. In fact if I add a reply to an earlier post it did not use to appear at the top of the topic. I remember setting it like this at the beginning and then I never paid too much attention but I think I would have noticed and today is the first time I see this happening...

In any case what I would like is to be able to have the topics in some forums ordered always for creation date ascending, is that possible?

My forum (in Italian) is: MsPforum

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Mar 14, 2016 - 7:19 am

This is the way it has always been. The sort options you can change (as far as the forum view is concerned) is to reverse the default so that the oldest topic remains at the top of the list working down to the newest one. An odd thing but apparently some people like this.

What - I believe - you are asking for, is newest topics to be added to the top of the listing (as happens) but sorted by their FIRST post instead of their LAST post (which is the standard). Is that correct.

We should be able to do this with a simple filter. I will take a look this morning. I do wonder if such an option would be popular... I believe we have had one other user in the past request this...

andy-signature.png
YELLOW
SWORDFISH
Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Mar 14, 2016 - 7:28 am

By the way - do you use an SP child theme? AND - you say in 'some forums'. I will need to know the forum IDs of those you want to change.

andy-signature.png
YELLOW
SWORDFISH
Avatar
Giovanna
Nijmegen - NL
Member
sp_UserOfflineSmall Offline
Mar 14, 2016 - 8:07 am

ehm... I am not sure that we understand each other, maybe a problem with the jargon which surely I tend to misuse. I repeat again what I need  trying to be more precise...

In 4 of my forums every day or week I or any other user start the post of the day, which I believe in jargon would be the "topic". I need, when the forum is accessed, to be viewed in ascending order of the creation date of these posts. So today I would see in order (apart from the pinned on top topics) the post of today followed by the one of yesterday and so on going back on time day by day.

Within the topic instead I need to see each users' post from the earlier to the latter in time, which is fine as it is.

Are we saying the same thing?

As for the other questions:
- I don't use a theme child although I have added a few lines to show the advertisments in some files.
- The ids of the 4 forums I need to view in this way are shown in this screenshot in the leftmost column I think: 

forums-ids-to-be-ordered-correctly.jpgImage Enlarger

 

the 4 forums are in the red box. Otherwise please tell me where to find the ids. Thanks a lot for helping!

My forum (in Italian) is: MsPforum

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Mar 14, 2016 - 9:33 am

Yes - we are saying the same thing. nd you really should use a child theme to preserve changes. But - we can work around that.

Create a new and empty file in the 'wp-content' folder of your WP site named 'sp-user-functions.php'.

Add open and close php tags to the very top and very bottom of the ne file and add the following code:

add_filter('sph_forumview_query', 'my_topic_sort', 1, 2);
function my_topic_sort($db, $data) {
    $fids = '&5&6&17&18&';
    if ( strpos( $fids, '&'.$data->forumId.'&' )) {
        $db->orderby = 'topic_pinned DESC, spf_sftopics.topic_id DESC';
    }
    return $db;
}

Of course - you can change the function name if you wish to. That should do the trick I think. Careful with the case of variable names....

andy-signature.png
YELLOW
SWORDFISH
Avatar
Giovanna
Nijmegen - NL
Member
sp_UserOfflineSmall Offline
Mar 14, 2016 - 10:54 am

Thanks! I will try a bit later and will lwt you know smile

My forum (in Italian) is: MsPforum

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Mar 14, 2016 - 11:06 am

I will eagerly await the outcome!

andy-signature.png
YELLOW
SWORDFISH
Avatar
Giovanna
Nijmegen - NL
Member
sp_UserOfflineSmall Offline
Mar 14, 2016 - 4:37 pm

Bad news Andy... after putting the file there the forum did not display topic anymoreeek

Shall I send you the file in an MP so you see if I made any mistakes? Thanks

My forum (in Italian) is: MsPforum

Forum Timezone: Europe/Stockholm
Most Users Ever Online: 1170
Currently Online:
Guest(s) 1
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Mr Papa: 19448
Ike: 2086
Brandon: 864
kvr28: 804
jim: 650
FidoSysop: 577
Conrad_Farlow: 531
fiddlerman: 358
Stefano Prete: 325
Member Stats:
Guest Posters: 620
Members: 17365
Moderators: 0
Admins: 4
Forum Stats:
Groups: 7
Forums: 17
Topics: 10128
Posts: 79626