Ignore Topics

Started by vbgamer45, May 19, 2008, 02:35:52 AM

Previous topic - Next topic

vbgamer45

Quote from: Kat on April 04, 2010, 04:03:24 PM
* Kat gives vbgamer admin access... ;)
I wish I would fix a couple things on this site mainly for performance.
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Arantor

Yay, I can stop work on the almost finished first paid mod I was going to do.

Though mine's actually smaller and faster than this, all I needed to add to it was quick moderation access and an interface to view them; I already fixed the whole process of ignoring topics without any kind of speed penalty whatsoever... and with far fewer edits too...
Holder of controversial views, all of which my own.


TurtleKicker

Bummer that there's a known way out there to do this faster/better...

Arantor

Wouldn't say 'better', though I can't deny it is faster because it makes no DB changes, and does nothing to the query that SMF runs out of the box. All it does is fudge the 'last message I read in that topic' to be the highest possible ID that SMF can have safely.
Holder of controversial views, all of which my own.


Arantor

#24
If anyone's interested, here's the hack I did for my forum. It's not complete, though, since there's no way to view what topics are ignored, and there are fringe cases that aren't very pretty (marking unread unignores it, but I kinda figured that was the case)

Just as food for thought, anyway.


EDIT: I figured out why this worked for me; I forgot to add english.xml. Since I'm not at home I just remade the file.
Holder of controversial views, all of which my own.


~DS~

Quote from: Arantor on April 10, 2010, 05:11:04 AM
If anyone's interested, here's the hack I did for my forum. It's not complete, though, since there's no way to view what topics are ignored, and there are fringe cases that aren't very pretty (marking unread unignores it, but I kinda figured that was the case)

Just as food for thought, anyway.
:P
"There is no god, and that's the simple truth. If every trace of any single religion were wiped out and nothing were passed on, it would never be created exactly that way again. There might be some other nonsense in its place, but not that exact nonsense. If all of science were wiped out, it would still be true and someone would find a way to figure it all out again."
~Penn Jillette – God, NO! – 2011

Arantor

Huh. Worked for me just fine.
Holder of controversial views, all of which my own.


Chas Large

Quote from: vbgamer45 on May 19, 2008, 02:35:52 AM
...
You will also need to copy the images into each Theme
Themes/{themename}/images/icons/ignore_topic.gif
...
Can't find this graphic even though the mod installed OK. Can't find it in the install instructions either. Is it a typo?
My Modifications :)  My Forum

Please DO NOT PM me with support requests. Post the problem in the appropriate Support Board so everyone can benefit from the advice given.

Chas Large

#28
I have installed this now on two 2.0 RC3 forums and it works OK on both except that on one, when I click show new replies to your posts I get the following error:

Unknown column 'pi.id_topic' in 'on clause'
File: /home/nas05l/f/fiftyplusforum.co.uk/user/htdocs/forum/Sources/Recent.php
Line: 1093


I have compared the Recent.php file between the two forums (which are basically identical, one live, one test) and the two files are the same.

If I disable Ignore Topics in the Admin > Boards > Settings then the show new replies works OK. Tried several times and each time IT is enabled the error appears.

Any ideas ?

[EDIT]
Here's the error log entry too.


http://www.fiftyplusforum.co.uk/forum/index.php?action=unreadreplies
Database Error: Unknown column 'pi.id_topic' in 'on clause'
File: /home/nas05l/f/fiftyplusforum.co.uk/user/htdocs/forum/Sources/Recent.php
Line: 1093
My Modifications :)  My Forum

Please DO NOT PM me with support requests. Post the problem in the appropriate Support Board so everyone can benefit from the advice given.

Chas Large

*Bump*

Anyone any ideas about this error please  ???
My Modifications :)  My Forum

Please DO NOT PM me with support requests. Post the problem in the appropriate Support Board so everyone can benefit from the advice given.

Chas Large

** Second Bump Up **

Come on vbGamer, give us a clue, please?  :(
My Modifications :)  My Forum

Please DO NOT PM me with support requests. Post the problem in the appropriate Support Board so everyone can benefit from the advice given.

Arantor

Care to attach the file it's complaining about?
Holder of controversial views, all of which my own.


Chas Large

Quote from: Arantor on May 18, 2010, 04:39:45 AM
Care to attach the file it's complaining about?
Here is the recent.php file. I couldn't see any problem with it compared to the forum that is working but thanks for taking a look.
My Modifications :)  My Forum

Please DO NOT PM me with support requests. Post the problem in the appropriate Support Board so everyone can benefit from the advice given.

Arantor

Any other mods on the site it doesn't work properly on?

Also, for the purposes of debugging, please turn on Admin > Security > Include database query in the error log and reproduce the error so I can see the whole query in question.

Thing is, I can't see any relevance whatsoever on line 1093, almost as if it's the wrong file :(
Holder of controversial views, all of which my own.


Chas Large

My Apologies, I must have uninstalled it but it failed in some way. When I compared the file (just downloaded from the site) against my test site, I can see there is no relevance. So I checked and it appeared to be installed. So I uninstalled and then reinstalled and enabled it. It's working but gives the error as above still.

Attached now is the very latest version of Recent.php. I have quickly compared this to the manual install instructions and all the mod seems to have been installed correctly.

All other mods in the site are working fine.
My Modifications :)  My Forum

Please DO NOT PM me with support requests. Post the problem in the appropriate Support Board so everyone can benefit from the advice given.

Arantor

Bingo, now I can see the problem. The query that finishes on line 1093 is broken.

Here's the product query:
$request = $smcFunc['db_query']('', '
SELECT t.id_topic
FROM {db_prefix}topics_posted_in AS t
LEFT JOIN {db_prefix}log_topics_posted_in AS lt ON (lt.id_topic = t.id_topic)
'. ($can_ignore ? 'LEFT JOIN {db_prefix}ignore_topics AS it ON (it.id_topic = pi.id_topic AND it.id_member = {int:current_member})' : '') .'
WHERE t.' . $query_this_board . '
AND IFNULL(lt.id_msg, t.id_msg) < t.id_last_msg
'. ($can_ignore ? 'AND IFNULL(it.id_topic, 0) = 0' : '') .'
ORDER BY {raw:order}
LIMIT {int:offset}, {int:limit}',
array_merge($query_parameters, array(
'current_member' => $user_info['id'],
'order' => (in_array($_REQUEST['sort'], array('t.id_last_msg', 't.id_topic')) ? $_REQUEST['sort'] : 't.sort_key') . ($ascending ? '' : ' DESC'),
'offset' => $_REQUEST['start'],
'limit' => $context['topics_per_page'],
))
);


And it's saying that it doesn't know pi.id_topic - well, here it doesn't because we never defined pi as a table alias. Should be:

$request = $smcFunc['db_query']('', '
SELECT t.id_topic
FROM {db_prefix}topics_posted_in AS t
LEFT JOIN {db_prefix}log_topics_posted_in AS lt ON (lt.id_topic = t.id_topic)
'. ($can_ignore ? 'LEFT JOIN {db_prefix}ignore_topics AS it ON (it.id_topic = t.id_topic AND it.id_member = {int:current_member})' : '') .'
WHERE t.' . $query_this_board . '
AND IFNULL(lt.id_msg, t.id_msg) < t.id_last_msg
'. ($can_ignore ? 'AND IFNULL(it.id_topic, 0) = 0' : '') .'
ORDER BY {raw:order}
LIMIT {int:offset}, {int:limit}',
array_merge($query_parameters, array(
'current_member' => $user_info['id'],
'order' => (in_array($_REQUEST['sort'], array('t.id_last_msg', 't.id_topic')) ? $_REQUEST['sort'] : 't.sort_key') . ($ascending ? '' : ' DESC'),
'offset' => $_REQUEST['start'],
'limit' => $context['topics_per_page'],
))
);
Holder of controversial views, all of which my own.


Chas Large

Thanks Arantor, Now for the oddity.

I uploaded the file that I gave you here to my test site and it's working fine, it only appears to be a problem with the main forum site.

I changed the code and uploaded it to the main forum and it's fixed in the main forum now too. Thank you.

My question is, how come it worked in one site but not another? Could it have been some mod clash? I have the same mods in both forums. The test site is used to test the mods before I make them live for the users.
My Modifications :)  My Forum

Please DO NOT PM me with support requests. Post the problem in the appropriate Support Board so everyone can benefit from the advice given.

Arantor

Is likely a mod clash. Not quite sure what went on though.
Holder of controversial views, all of which my own.


Chas Large

Arantor Help!

Just discovered another bug. If I click the NEW Indicator on the forum index I get the following error:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IFNULL(it.id_topic, 0) = 0
AND t.id_last_msg > 143234
AND IFNULL(lt.id_m' at line 6
File: /home/nas05l/f/fiftyplusforum.co.uk/user/htdocs/forum/Sources/Recent.php
Line: 878


Clicking the NEW indicator on the unread and show new... lists works fine.
My Modifications :)  My Forum

Please DO NOT PM me with support requests. Post the problem in the appropriate Support Board so everyone can benefit from the advice given.

Arantor

Recent.php
Code (find) Select
$request = $smcFunc['db_query']('', '
SELECT COUNT(*), MIN(t.id_last_msg)
FROM {db_prefix}topics AS t' . (!empty($have_temp_table) ? '
LEFT JOIN {db_prefix}log_topics_unread AS lt ON (lt.id_topic = t.id_topic)' : '
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 = t.id_board AND lmr.id_member = {int:current_member})
'. ($can_ignore ? 'LEFT JOIN {db_prefix}ignore_topics AS it ON (it.id_topic = t.id_topic AND it.id_member = {int:current_member})' : '') .'
WHERE t.' . $query_this_board .
($can_ignore ? 'AND IFNULL(it.id_topic, 0) = 0' : '') .
($context['showing_all_topics'] && !empty($earliest_msg) ? '
AND t.id_last_msg > {int:earliest_msg}' : (!$context['showing_all_topics'] && empty($_SESSION['first_login']) ? '
AND t.id_last_msg > {int:id_msg_last_visit}' : '')) . '
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,
'id_msg_last_visit' => $_SESSION['id_msg_last_visit'],
'is_approved' => 1,
))
);


Code (replace) Select
$request = $smcFunc['db_query']('', '
SELECT COUNT(*), MIN(t.id_last_msg)
FROM {db_prefix}topics AS t' . (!empty($have_temp_table) ? '
LEFT JOIN {db_prefix}log_topics_unread AS lt ON (lt.id_topic = t.id_topic)' : '
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 = t.id_board AND lmr.id_member = {int:current_member})
'. ($can_ignore ? 'LEFT JOIN {db_prefix}ignore_topics AS it ON (it.id_topic = t.id_topic AND it.id_member = {int:current_member})' : '') .'
WHERE t.' . $query_this_board .
($can_ignore ? '
AND IFNULL(it.id_topic, 0) = 0' : '') .
($context['showing_all_topics'] && !empty($earliest_msg) ? '
AND t.id_last_msg > {int:earliest_msg}' : (!$context['showing_all_topics'] && empty($_SESSION['first_login']) ? '
AND t.id_last_msg > {int:id_msg_last_visit}' : '')) . '
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,
'id_msg_last_visit' => $_SESSION['id_msg_last_visit'],
'is_approved' => 1,
))
);


vbgamer: Without being funny, was this mod actually tested when it was refitted for 2.0 RC3?
Holder of controversial views, all of which my own.


Advertisement: