News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Topics are not showing up.. but they're there.

Started by DarkTexas, June 19, 2016, 02:07:13 PM

Previous topic - Next topic

DarkTexas

Hi Folks, having another Problem.

The Topics on our Forums are actually not showing up on the "index" but they are "there", as you have the topic URL you can view the topic. That problem is appearing for more than one Board.. but you can also see the "Path" and it's at the correct location..



here the topic .. opened via Link



...??

Sir Osis of Liver

Sounds like a database problem.  Did you change anything. install a mod, edit code?

Have you tried Admin -> Forum Maintenance -> Find and repair any errors?
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

DarkTexas


DarkTexas

UPDATE: It seems like some users are actually able to see the topics, some not!!
Also I noticed the Page-Numbers are still there, topics missing.


Here you see the Page Numbers are still there... but no topics!

I HOPE there are sulutions!

Sir Osis of Liver

Does it happen in Curve?  Anything in your error log?
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

DarkTexas

Appearing in all Themes; no Errors in the Error log.

Sir Osis of Liver

Admin -> Forum Maintenance -> Empty the file cache
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

DarkTexas


Sir Osis of Liver

I would do a clean test install in another directory, link it to your production database, see if the problem persists.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Illori

Quote from: Sir Osis of Liver on June 23, 2016, 03:51:38 PM
I would do a clean test install in another directory, link it to your production database, see if the problem persists.


if you do that, you need to remember to fix your paths and then your production forum will no longer function correctly. it is better to copy the database to a new one and fix the paths there.

Sir Osis of Liver

Just for a quick check, in and out.  Simpler than getting involved in the export/import hassle, which is problematic on many hosts.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

DarkTexas


Sir Osis of Liver

Looks like you've installed a mod that's screwed up everything.  Which mods are you running?
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Siirist

#13
Quote from: DarkTexas on June 25, 2016, 11:16:30 AM
looks even worse. >-<

http://gljclan.com/forums

Hello,

I am using the latest version of Mozilla FireFox with an Ad Blocker.

EDIT: oops, thank you "Sir"
Your forum appears to be functioning normally. Various Topics and replies appear.

I took a FULL screenshot of the page and am attaching it (I believe that all members are requested to NOT place images and photos in the post, but instead should attach them).

Be Well,
Siriist
Needed information:
- What's your SMF version?, What MODs are installed? What Theme(s) are you using? Have you backed up your database?

--> At least 50% of the questions asked are answered in the Online Manual <--
Mods for ver 1.x will NOT run on ver 2.x

Sir Osis of Liver

No, they do not.  If you look at your screenshot, you'll see that last post topics are all 'N/A', and there are no links to the topic.  If you go to message index, it's a mess.  Same in the theme he's running, and default Curve.  Most likely cause is a borked mod.

Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

DarkTexas

Sorry folks, Ive "posted" the link from the Forums where I did a clean install and impleneted the database.

The main Forum where the problem appears is https://gljclan.com


DarkTexas

I just imported a Backup into the test forums (https://gljclan.com/forums) and used the "Convert to UTF.." function.. on the Testforums (clean) the topics are back after that step.
I tried the same on the "final forums", no success.

DarkTexas

Quote from: Sir Osis of Liver on June 25, 2016, 11:41:31 PM
Looks like you've installed a mod that's screwed up everything.  Which mods are you running?

I uninstalled all recent new mods.. no sucess =(

This bs appeared when I was deleting members which were not logged in for 60 days or longer.

margarett

I think I've seen this happening after a conversion.

Did you try the "Recount totals" Maintenance option?
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

DarkTexas

Recount all forum totals and statistics.. did not help. D:

margarett

That's really odd.

The total number of topics and boards in BoardIndex is fetched from a field in the "boards" table, while the topic itself is only fetched if the topic (in smf_topics) has a relation to the board through the column id_board.
Because the same database linked to clean files does show the topics, something went sour with your files, I think. Please attach Sources/MessageIndex.php
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

DarkTexas


margarett

It seems that the topics are not fetched anymore after a topic whose first or last poster is a guest.

Try a "clean" MessageIndex.php
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Sir Osis of Liver

Uninstall Avatars on Board and/or MessageIndex mod.

@Bruno - cannot reproduce the problem on a production forum using that file, but code that displays topics has been edited by this mod.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

margarett

Try to have a topic with first or last poster being a guest ;)
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Sir Osis of Liver

Guests can't post on my production forums, and not enough topics on my test installs to duplicate the glitch.  Is it dumping topics with guest posts?

Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

margarett

It seems that it only fetches topics until it finds one whose first or last poster is a guest. At least it seems a pattern in DarkTexas's forum:
https://gljclan.com/index.php?board=9.0
Last fetched topic's first (and last :P ) poster is a guest, no more topics are fetched

https://gljclan.com/index.php?board=38.0
Last fetched topic's last poster is a guest, no more topics are fetched

https://gljclan.com/index.php?board=28.0
Last fetched topic's first poster is a guest, no more topics are fetched
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Sir Osis of Liver

Code has been changed here -



/// For search engine effectiveness we'll link guests differently.
$context['pageindex_multiplier'] = empty($modSettings['disableCustomPerPage']) && !empty($options['messages_per_page']) && !WIRELESS ? $options['messages_per_page'] : $modSettings['defaultMaxMessages'];

$result = $smcFunc['db_query']('substring', '
SELECT
t.id_topic, t.num_replies, t.locked, t.num_views, t.is_sticky, t.id_poll, t.id_previous_board,
' . ($user_info['is_guest'] ? '0' : 'IFNULL(lt.id_msg, IFNULL(lmr.id_msg, -1)) + 1') . ' AS new_from,
IFNULL(avf.id_attach, 0) AS avf_id_attach, avf.filename AS avf_filename, avf.attachment_type AS avf_attachment_type, memf.avatar AS avatar_first_poster,
IFNULL(av.id_attach, 0) AS id_attach, av.filename, av.attachment_type, meml.avatar AS avatar_poster,
t.id_last_msg, t.approved, t.unapproved_posts, ml.poster_time AS last_poster_time,
ml.id_msg_modified, ml.subject AS last_subject, ml.icon AS last_icon,
ml.poster_name AS last_member_name, ml.id_member AS last_id_member,
IFNULL(meml.real_name, ml.poster_name) AS last_display_name, t.id_first_msg,
mf.poster_time AS first_poster_time, mf.subject AS first_subject, mf.icon AS first_icon,
mf.poster_name AS first_member_name, mf.id_member AS first_id_member,
IFNULL(memf.real_name, mf.poster_name) AS first_display_name, SUBSTRING(ml.body, 1, 385) AS last_body,
SUBSTRING(mf.body, 1, 385) AS first_body, ml.smileys_enabled AS last_smileys, mf.smileys_enabled AS first_smileys
FROM {db_prefix}topics AS t
INNER JOIN {db_prefix}messages AS ml ON (ml.id_msg = t.id_last_msg)
INNER JOIN {db_prefix}messages AS mf ON (mf.id_msg = t.id_first_msg)
LEFT JOIN {db_prefix}attachments AS av ON (av.id_member = ml.id_member)
LEFT JOIN {db_prefix}attachments AS avf ON (avf.id_member = mf.id_member)
LEFT JOIN {db_prefix}members AS meml ON (meml.id_member = ml.id_member)
LEFT JOIN {db_prefix}members AS memf ON (memf.id_member = mf.id_member)' . ($user_info['is_guest'] ? '' : '
LEFT JOIN {db_prefix}log_topics AS lt ON (lt.id_topic = t.id_topic AND lt.id_member = {int:current_member})
LEFT JOIN {db_prefix}log_mark_read AS lmr ON (lmr.id_board = {int:current_board} AND lmr.id_member = {int:current_member})'). '
WHERE ' . ($pre_query ? 't.id_topic IN ({array_int:topic_list})' : 't.id_board = {int:current_board}') . (!$modSettings['postmod_active'] || $context['can_approve_posts'] ? '' : '
AND (t.approved = {int:is_approved}' . ($user_info['is_guest'] ? '' : ' OR t.id_member_started = {int:current_member}') . ')') . '
ORDER BY ' . ($pre_query ? 'FIND_IN_SET(t.id_topic, {string:find_set_topics})' : (!empty($modSettings['enableStickyTopics']) ? 'is_sticky' . ($fake_ascending ? '' : ' DESC') . ', ' : '') . $_REQUEST['sort'] . ($ascending ? '' : ' DESC')) . '
LIMIT ' . ($pre_query ? '' : '{int:start}, ') . '{int:maxindex}',
array(
'current_board' => $board,
'current_member' => $user_info['id'],
'topic_list' => $topic_ids,
'is_approved' => 1,
'find_set_topics' => implode(',', $topic_ids),
'start' => $start,
'maxindex' => $maxindex,
)
);



and here -



/// 'Print' the topic info.
$context['topics'][$row['id_topic']] = array(
'id' => $row['id_topic'],
'first_post' => array(
'id' => $row['id_first_msg'],
'member' => array(
'username' => $row['first_member_name'],
'name' => $row['first_display_name'],
'avatar' => $row['avatar_first_poster'] == '' ? ($row['avf_id_attach'] > 0 ? (empty($row['avf_attachment_type']) ? $scripturl . '?action=dlattach;attach=' . $row['avf_id_attach'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['avf_filename']) : '') : (stristr($row['avatar_first_poster'], 'http://') ? $row['avatar_first_poster'] : $modSettings['avatar_url'] . '/' . $row['avatar_first_poster']),
'id' => $row['first_id_member'],
'href' => !empty($row['first_id_member']) ? $scripturl . '?action=profile;u=' . $row['first_id_member'] : '',
'link' => !empty($row['first_id_member']) ? '<a href="' . $scripturl . '?action=profile;u=' . $row['first_id_member'] . '" title="' . $txt['profile_of'] . ' ' . $row['first_display_name'] . '">' . $row['first_display_name'] . '</a>' : $row['first_display_name']
),
'time' => timeformat($row['first_poster_time']),
'timestamp' => forum_time(true, $row['first_poster_time']),
'subject' => $row['first_subject'],
'preview' => $row['first_body'],
'icon' => $row['first_icon'],
'icon_url' => $settings[$context['icon_sources'][$row['first_icon']]] . '/post/' . $row['first_icon'] . '.gif',
'href' => $scripturl . '?topic=' . $row['id_topic'] . '.0',
'link' => '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.0">' . $row['first_subject'] . '</a>'
),



But I'm not seeing what's causing the problem.

Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Sir Osis of Liver

Also here -



'last_post' => array(
'id' => $row['id_last_msg'],
'member' => array(
'username' => $row['last_member_name'],
'name' => $row['last_display_name'],
'avatar' => $row['avatar_poster'] == '' ? ($row['id_attach'] > 0 ? (empty($row['attachment_type']) ? $scripturl . '?action=dlattach;attach=' . $row['id_attach'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) : '') : (stristr($row['avatar_poster'], 'http://') ? $row['avatar_poster'] : $modSettings['avatar_url'] . '/' . $row['avatar_poster']),
'id' => $row['last_id_member'],
'href' => !empty($row['last_id_member']) ? $scripturl . '?action=profile;u=' . $row['last_id_member'] : '',
'link' => !empty($row['last_id_member']) ? '<a href="' . $scripturl . '?action=profile;u=' . $row['last_id_member'] . '">' . $row['last_display_name'] . '</a>' : $row['last_display_name']
),
'time' => timeformat($row['last_poster_time']),
'timestamp' => forum_time(true, $row['last_poster_time']),
'subject' => $row['last_subject'],
'preview' => $row['last_body'],
'icon' => $row['last_icon'],
'icon_url' => $settings[$context['icon_sources'][$row['last_icon']]] . '/post/' . $row['last_icon'] . '.gif',
'href' => $scripturl . '?topic=' . $row['id_topic'] . ($user_info['is_guest'] ? ('.' . (!empty($options['view_newest_first']) ? 0 : ((int) (($row['num_replies']) / $context['pageindex_multiplier'])) * $context['pageindex_multiplier']) . '#msg' . $row['id_last_msg']) : (($row['num_replies'] == 0 ? '.0' : '.msg' . $row['id_last_msg']) . '#new')),
'link' => '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . ($user_info['is_guest'] ? ('.' . (!empty($options['view_newest_first']) ? 0 : ((int) (($row['num_replies']) / $context['pageindex_multiplier'])) * $context['pageindex_multiplier']) . '#msg' . $row['id_last_msg']) : (($row['num_replies'] == 0 ? '.0' : '.msg' . $row['id_last_msg']) . '#new')) . '" ' . ($row['num_replies'] == 0 ? '' : 'rel="nofollow"') . '>' . $row['last_subject'] . '</a>'
),


Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

DarkTexas

Quote from: Sir Osis of Liver on June 28, 2016, 04:22:04 PM
Uninstall Avatars on Board and/or MessageIndex mod.

@Bruno - cannot reproduce the problem on a production forum using that file, but code that displays topics has been edited by this mod.

That fixed it! OMG!

I love you guys <3

Sir Osis of Liver



I'm guessing it's this -



'first_post' => array(

'avatar' => $row['avatar_first_poster'] == '' ? ($row['avf_id_attach'] > 0 ? (empty($row['avf_attachment_type']) ? $scripturl . '?action=dlattach;attach=' . $row['avf_id_attach'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['avf_filename']) : '') : (stristr($row['avatar_first_poster'], 'http://') ? $row['avatar_first_poster'] : $modSettings['avatar_url'] . '/' . $row['avatar_first_poster']),


'last_post' => array(

'avatar' => $row['avatar_poster'] == '' ? ($row['id_attach'] > 0 ? (empty($row['attachment_type']) ? $scripturl . '?action=dlattach;attach=' . $row['id_attach'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) : '') : (stristr($row['avatar_poster'], 'http://') ? $row['avatar_poster'] : $modSettings['avatar_url'] . '/' . $row['avatar_poster']),



Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

DarkTexas


Pipke

The problem here is when fetching the avatars from the topics the mod looks for the user id's of first and last in these topics, when the user id=0 wich is in this example, the mod is first looking for the user id in the members table if not found (ofcourse it will not found , cos there arent any members with id 0) the query is looking for the id in the attachment table in database where the avatars are stored and finds multiple user rows wich contain the id 0 (guest or banned user) , that is where the query get stuck. Hope this explains better the problem.
"If something is wrong, fix it if you can. But train yourself not to worry: Worry never fixes anything."

Click here to view my mods for SMF

Hey 👋 Did i helped... you like what i do. You can now buy me a coffee! ☕

Advertisement: