Support Forum

Topics order in forum, seems not to work

28 Answers

New Answer

YS Yellow Swordfish
Yellow Swordfish
Member

Let’s just step back. IF after a code change or addition, something stops displaying completely then that is indicative of a coding error. So it is always vital to ensure that everything is totally correct.

Pasting code into a forum post may look like it is correct but actually the display engine has stripped all coding specific components and replaced them with html entities. If you do not know hat they are then it doesn’t matter. It just means that what might look like good code probably is not if simply copied and pasted.

Ans this is why we use our syntax highlighter plugin to pass code to users as this does ensure that the code is not converted by the display engine. 

If you go back to the code I gave you – post 7 I believe – then you will see above it a ‘war code’ button. Click on that and you will get a popup window with the actual, unconverted code, That is what you need to copy into your clipboard before placing it into the new php file. And also you MUST ensure that the editor you use is in plain text mode.

And finally – Ike was wrong I am afraid. You DO need to enclose the code in php tags. Make sure that there are no empty lines either side of the tags. The opening tag must be on l;ine 1 and the closing tag must be on the last line with no empty space below it.

And finally, finally ! – yes – the file just goes into the wp-content folder. It is a special file that we check for that allows people to have a little bit of custom code without having to make a child theme – although child themes are the better and recommended route.

GI Giovanna
Giovanna
Member

ok got it, I did not know about this “war code”, I like it laugh Going to try right now…

GI Giovanna
Giovanna
Member

it does not work, I made the file back from scratch, no comment lines, only the raw code and the php tags beggining and end cry

YS Yellow Swordfish
Yellow Swordfish
Member

In what way does it ‘not work’?
And if you mean the whole thing bombs then email me your file (support at simple-press dot com)

GI Giovanna
Giovanna
Member

I mean that the list with all the topic disappears (but the pages numbers at the bottom are still displayed): I will send you the file in 5 minutes!

YS Yellow Swordfish
Yellow Swordfish
Member

The code is fine and it is working fine on my dev system.
So… what Simple:Press plugins – if any – are you using please?

GI Giovanna
Giovanna
Member

Quite a lot:

Here’s the list:

Admin Bar

Announce

Answers Topic

Birthdays

Editor Tiny…

File Uploader…

Font Resizer

Language and Theme Selection (not active)

Mentions

Post Preview

Profnity Filter

Ranks Information

Share This (not active)

Subscriptions

Template Tags and Widgets

Unaswered Topics

Watches

 

…maybe it was easier to list the ones I do not uselaughlaughlaugh

YS Yellow Swordfish
Yellow Swordfish
Member

No… nothing there should be interfering. I asked because some plugins will also modify the base query but that all still looks fine.

I am puzzled bit intrigued.

Can you try one more thing? Put the new code file in place. Go to the forum admin > toolbox > error log and clear it out (button at bottom). Run one of your forums in form view (list of topics). I assume it will be ‘damaged’. Revisit the error log (reload the panel) to  see if any fatal errors occurred.

GI Giovanna
Giovanna
Member

Andy, this is what I see in the error log after having done what you said:

file: /membri/mspforum/mspforum/wp-content/plugins/simple-press/forum/content/classes/sp-forum-view-class.php
line: 319
function: select
error: Unknown column ‘spf_sftopics.topic_id’ in ‘order clause’

SELECT avwp_sftopics.forum_id, forum_slug, forum_name, forum_status, group_id, topic_count, forum_icon, topic_icon, topic_icon_new, topic_icon_locked, topic_icon_pinned, forum_desc, forum_rss, forum_rss_private, parent, children, forum_message, forum_disabled, keywords, avwp_sftopics.topic_id, topic_slug, topic_name, topic_status, topic_pinned, topic_opened, avwp_sftopics.post_id, avwp_sftopics.post_count FROM avwp_sftopics JOIN avwp_sfforums ON avwp_sftopics.forum_id = avwp_sfforums.forum_id WHERE avwp_sfforums.forum_id=6 ORDER BY topic_pinned DESC, spf_sftopics.topic_id DESC LIMIT 0, 12

YS Yellow Swordfish
Yellow Swordfish
Member

Sono un idiota!

I am so sorry. I forgot all about the WP table prefix, The line if code that I gave you:

    $db->orderby = 'topic_pinned DESC, spf_sftopics.topic_id DESC';

should be:

    $db->orderby = 'topic_pinned DESC, '.SFTOPICS.'.topic_id DESC';

!

GI Giovanna
Giovanna
Member

Funzionaaaaaaaaaaaaaaalaughlaughlaughlaughlaughlaughlaugh

And your spelling was absolutely perfect laughlaugh

Thanks a lot!!!kiss

YS Yellow Swordfish
Yellow Swordfish
Member

Excellent. And again – sorry for my stupidity!

GI Giovanna
Giovanna
Member

Don’t worry Andy, I have done much worse, trust me!