Jump to content

Open Coterie  ·  19 members

SMF Staff People

Error with Unread Posts


Snickerdoodle
 Share

Recommended Posts

When I click on the link to unread posts, I get this database error.

Unknown column 'ch1.name_first' in 'field list'
File: /home/ilvermor/public_html/Sources/Recent.php
Line: 952

With this snippet in the error log.


932:					INNER JOIN {db_prefix}topics AS t ON (t.id_topic = ms.id_topic AND t.id_first_msg = ms.id_msg)
933:					INNER JOIN {db_prefix}messages AS ml ON (ml.id_msg = t.id_last_msg)
934:					LEFT JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board)
935:					LEFT JOIN {db_prefix}members AS mems ON (mems.id_member = ms.id_member)
936:					LEFT JOIN {db_prefix}members AS meml ON (meml.id_member = ml.id_member)' . (!empty($have_temp_table) ? '
937:					LEFT JOIN {db_prefix}log_topics_unread AS lt ON (lt.id_topic = t.id_topic)' : '
938:					LEFT JOIN {db_prefix}log_topics AS lt ON (lt.id_topic = t.id_topic AND lt.id_member = {int:current_member})') . '
939:					LEFT JOIN {db_prefix}log_mark_read AS lmr ON (lmr.id_board = t.id_board AND lmr.id_member = {int:current_member})
940:				WHERE t.' . $query_this_board . '
941:					AND t.id_last_msg >= {int:min_message}
942:					AND IFNULL(lt.id_msg, IFNULL(lmr.id_msg, 0)) < ml.id_msg' . ($modSettings['postmod_active'] ? '
943:					AND ms.approved = {int:is_approved}' : '') . '
944:				ORDER BY {raw:order}
945:				LIMIT {int:offset}, {int:limit}',
946:				array_merge($query_parameters, array(
947:					'current_member' => $user_info['id'],
948:					'min_message' => $min_message,
949:					'is_approved' => 1,
950:					'order' => $_REQUEST['sort'] . ($ascending ? '' : ' DESC'),
951:					'offset' => $_REQUEST['start'],
==>952:					'limit' => $context['topics_per_page'],
953:				))
954:			);
955:		}
956:		else
957:		{
958:			if ($modSettings['totalMessages'] > 100000)
959:			{
960:				$smcFunc['db_query']('', '
961:					DROP TABLE IF EXISTS {db_prefix}topics_posted_in',
962:					array(
963:					)
964:				);
965:	
966:				$smcFunc['db_query']('', '
967:					DROP TABLE IF EXISTS {db_prefix}log_topics_posted_in',
968:					array(
969:					)
970:				);
971:	
972:				$sortKey_joins = array(

ch1.name_first isn't even in that snippet.. but here's where it is between 680 and 690 :

// This part is the same for each query.
	$select_clause = '
				ms.subject AS first_subject, ms.poster_time AS first_poster_time, ms.id_topic, t.id_board, b.name AS bname,
				t.num_replies, t.num_views, ms.id_member AS id_first_member, ml.id_member AS id_last_member,
				ml.poster_time AS last_poster_time, IFNULL(mems.real_name, ms.poster_name) AS first_poster_name,
				IFNULL(meml.real_name, ml.poster_name) AS last_poster_name, ml.subject AS last_subject,
				ml.icon AS last_icon, ms.icon AS first_icon, t.id_poll, t.is_sticky, t.locked, ml.modified_time AS last_modified_time,
				IFNULL(lt.id_msg, IFNULL(lmr.id_msg, -1)) + 1 AS new_from, SUBSTRING(ml.body, 1, 385) AS last_body,
				SUBSTRING(ms.body, 1, 385) AS first_body, ml.smileys_enabled AS last_smileys, ms.smileys_enabled AS first_smileys, t.id_first_msg, t.id_last_msg, IFNULL(t.description, "") AS description,
				ms.id_character AS first_char_id, ch1.name_first AS first_char_namef, ch1.name_last AS first_char_namel,
				ml.id_character AS last_char_id, ch2.name_first AS last_char_namef, ch2.name_last AS last_char_namel';

and here between 792 and 808:

$request = $smcFunc['db_query']('', '
			SELECT COUNT(*), MIN(t.id_last_msg)
			FROM {db_prefix}topics AS t
				LEFT JOIN {db_prefix}log_topics_unread AS lt ON (lt.id_topic = t.id_topic)
				LEFT JOIN {db_prefix}log_mark_read AS lmr ON (lmr.id_board = t.id_board AND lmr.id_member = {int:current_member}),
				LEFT JOIN {db_prefix}acm_characters AS ch1 ON (ms.id_character = ch1.id_character)
				LEFT JOIN {db_prefix}acm_characters AS ch2 ON (ml.id_character = ch2.id_character)
			WHERE t.' . $query_this_board . (!empty($earliest_msg) ? '
				AND t.id_last_msg > {int:earliest_msg}' : '') . '
				AND IFNULL(lt.id_msg, IFNULL(lmr.id_msg, 0)) < t.id_last_msg' . ($modSettings['postmod_active'] ? '
				AND t.approved = {int:is_approved}' : ''),
			array_merge($query_parameters, array(
				'current_member' => $user_info['id'],
				'earliest_msg' => !empty($earliest_msg) ? $earliest_msg : 0,
				'is_approved' => 1,
			))
		);

Also, the ACM topic descriptions don't work and I don't know why, so I got a topic descriptions mod instead... but this error happens without it. Does this have to do with the install error I couldn't find?

 

Edit: This also occurs when I have unread replies and click on the new replies link. It doesn't happen when I don't have unread replies or unread topics.

Edited by Snickerdoodle
Link to comment
Share on other sites

... Should have asked me about the topic descriptions, because it's likely a matter of putting a variable somewhere to make them show.

 

If you could just attach your Recent.php file for me, that'd be great. I need the whole thing, not just part of it. 

nusignature.png nusignature.png

I am the darkness, always watching, always listening, ALWAYS THERE.
(If you're interested in Plain of Ice, message me, it's private. Bleach site, non-canon.)

Link to comment
Share on other sites

Well, it should be $context['topic_description'], just stick it in the display template somewhere, for future reference.

Dates are $context['topic_date'], this is an array: $context['topic_date']['month'], $context['topic_date']['day'], $context['topic_date']['year'].

think these load on message index, but they may not. According to Plain of Ice's installation, they don't, so they'd have to be manually pulled. Ugh a quarter of this mod's actually missing somehow.

 

Now, the thing with this bit is that it is supposed to add the LEFT JOINs to all this, because for some stupid focking reason this source file will construct the select bit and then the rest of the SQL query elsewhere because who the fuck needs linear logic I guess. (I hate this file.) So you'll need to manually put in all the LEFT JOIN codes; the installer should have, but it's one of those instances where there are multiple matching lines and the installer does none of them instead of all of them, and I honestly don't know how to do it so that it will do it automatically (so @Jones yours is probably busted here, too).

 

So, I will do this one for you and send back your Recent.php with it fixed, but I'll also go over how to do it manually, because it's actually very easy and yanno, future reference and that.

 

First, you'll find several matches of it, so everywhere there is:

		$request = $smcFunc['db_query']('substring', '
			SELECT ' . $select_clause . '

You'll need to add:

				LEFT JOIN {db_prefix}acm_characters AS ch1 ON (ms.id_character = ch1.id_character)
				LEFT JOIN {db_prefix}acm_characters AS ch2 ON (ml.id_character = ch2.id_character)

Between the last LEFT JOIN and the WHERE. I counted about three. And that should fix that and make your action=unread page work again.

Recent.php

nusignature.png nusignature.png

I am the darkness, always watching, always listening, ALWAYS THERE.
(If you're interested in Plain of Ice, message me, it's private. Bleach site, non-canon.)

Link to comment
Share on other sites

Mk, so... what'd you do? What happened? lol

nusignature.png nusignature.png

I am the darkness, always watching, always listening, ALWAYS THERE.
(If you're interested in Plain of Ice, message me, it's private. Bleach site, non-canon.)

Link to comment
Share on other sites

I went through and replaced everything I thought I was supposed to with the information you gave me.... I'm guessing I replaced something somewhere that I wasn't supposed to. I have no idea where to even begin 😭

Link to comment
Share on other sites

For topic descriptions? You shouldn't be replacing anything for that.

nusignature.png nusignature.png

I am the darkness, always watching, always listening, ALWAYS THERE.
(If you're interested in Plain of Ice, message me, it's private. Bleach site, non-canon.)

Link to comment
Share on other sites

Well, let's start with, what file were you in? Secondly, what did you think you needed to do? Were you following the step-by-step for Recent.php? Check the admin CP error logs, too, and see if it gives you any error output (would be in Maintenance => Logs => Error Log). You may have to clear the current error logs and then reaccess the messed up page to see if it'll generate an error.

nusignature.png nusignature.png

I am the darkness, always watching, always listening, ALWAYS THERE.
(If you're interested in Plain of Ice, message me, it's private. Bleach site, non-canon.)

Link to comment
Share on other sites

There's an error in the messageindex.php file, unexpected } ... It isn't being logged in the error log

I uninstalled the other description mod and had to manually fix some things. I may have missed removing a } somewhere but I can't find it

Edited by Snickerdoodle
Link to comment
Share on other sites

If you can't find it, just upload that file for me, and I'll see if I can.

nusignature.png nusignature.png

I am the darkness, always watching, always listening, ALWAYS THERE.
(If you're interested in Plain of Ice, message me, it's private. Bleach site, non-canon.)

Link to comment
Share on other sites

I used a backup of it to get it back in working order.  Phew. I keep forgetting I have those at my disposal. I'll have to go through and make sure there aren't any lingering deleted mod bits, but posting is back up.

 

Now... I'm supposed to put $context['topic_description'] and all that into display.template.php, correct? I'm mostly unsure of the syntax.

Link to comment
Share on other sites

Yep. Wherever you want the topic description to show in threads, that's where that $context['topic_description'] bit should go in the Display.template.php file. You'll probably want it in an if empty conditional so it doesn't generate wads of undefined index errors. I don't think it will but you know better safe than sorry:

',(!empty($context['topic_description']) ? $context['topic_description'] : ''),'

Something like that.

nusignature.png nusignature.png

I am the darkness, always watching, always listening, ALWAYS THERE.
(If you're interested in Plain of Ice, message me, it's private. Bleach site, non-canon.)

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use, Guidelines and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.