Toggle replies to show OP replies only

Started by GL700Wing, March 14, 2018, 08:42:31 PM

Previous topic - Next topic

GL700Wing

I've been asked if it is possible to implement a toggle for topic replies so that only the original poster's replies are shown (and toggle again to see all replies) - I've searched the SMF mods without any luck.
Life doesn't have to be perfect to be wonderful ...

dougiefresh

Anything's possible, especially if you know how to code it.  I'm looking to see how difficult it would be....  And I'm almost 101% sure that there are no mods on the Customization Site to do this already....

GL700Wing

Quote from: dougiefresh on March 15, 2018, 06:10:00 PM
Anything's possible, especially if you know how to code it.  I'm looking to see how difficult it would be....  And I'm almost 101% sure that there are no mods on the Customization Site to do this already....
Thanks - much appreciated!
Life doesn't have to be perfect to be wonderful ...

dougiefresh

I've got a mod with the button installed as a hook, the code to filter messages only by OP's id_member, and the page index code patched.  I still need to "fix" the links when the OP replies are toggled....  But I'm almost there....

GL700Wing

Life doesn't have to be perfect to be wonderful ...

dougiefresh

Quote from: GL700Wing on March 15, 2018, 07:46:04 PM
Wow - you don't waste any time!
This looked like an easy mod to write.  Glad it was....

Try this: Show Only OP Replies....  I've also submitted it to the Customization Site....

GL700Wing

#6
Quote from: dougiefresh on March 15, 2018, 07:52:49 PM
This looked like an easy mod to write.  Glad it was....

Try this: Show Only OP Replies....  I've also submitted it to the Customization Site....
Thanks so much - looks to be working perfectly on my test forum so will now install in my production forum.

Also, and just in case others are curious as to why I requested this feature, I manage a couple of motoring forums where members can create a topic detailing the build/modifications they've done and at present only the OP can post replies to their topic.  A request has been received to allow other members to also reply but to also have the option to only see the OP's messages.



Edited to fix quote tags ~ Steve
Life doesn't have to be perfect to be wonderful ...

landyvlad


QuoteAlso, and just in case others are curious as to why I requested this feature,

That would be me. I couldn't imagine any point to that.

Quote
I manage a couple of motoring forums where members can create a topic detailing the build/modifications they've done and at present only the OP can post replies to their topic.  A request has been received to allow other members to also reply but to also have the option to only see the OP's messages.

Freaking genius. I absolutely will get it rocking and rolling on mine too ! :)

Thanks 'wing and especially dougie !

"Put as much effort into your question as you'd expect someone to give in an answer"

Please do not PM, IM or Email me with questions on astrophysics or theology.  You will get better and faster responses by asking homeless people in the street. Thank you.

Be the person your dog thinks you are.

skb

The logical next step would be to introduce an input field for "a specific" member name & see all posts by that member (not just the OP).

Just thinking aloud.

SMF 2.1.4 / TP 2.2.2

dougiefresh

Quote from: skb on March 15, 2018, 09:27:37 PM
The logical next step would be to introduce an input field for "a specific" member name & see all posts by that member (not just the OP).
I pulled this mod off with no theme edits simply because everything required was "just" source edits.  Doing this suggestion would likely require some theme edits, as well...  Lemme see what I can do about it....

dougiefresh

Uploaded v1.0.1 - March 15th, 2018
o Added icon in poster area in order to allow filtering messages by poster.




@Everybody:  Updated mod can be found here at XPtsp.com.  Anything else that should be added?

@skd:  Request fulfilled, kinda.....  ::) O:)

GL700Wing

Quote from: dougiefresh on March 15, 2018, 10:50:45 PM
Anything else that should be added?
Not sure if it's easy to do but for long topics (eg, more than 10 pages) if the number of OP replies is more than one page (eg, 3 pages) the topic page count link number shown is the number of pages for all replies (eg, 10) instead of the number of pages for the OP's replies (eg, 3).
Life doesn't have to be perfect to be wonderful ...

GL700Wing

Quote from: GL700Wing on March 15, 2018, 11:11:05 PM
Quote from: dougiefresh on March 15, 2018, 10:50:45 PM
Anything else that should be added?
Not sure if it's easy to do but for long topics (eg, more than 10 pages) if the number of OP replies is more than one page (eg, 3 pages) the topic page count link number shown is the number of pages for all replies (eg, 10) instead of the number of pages for the OP's replies (eg, 3).
Actually the situation I described generates the following error message if you click on a page count link number for a page that doesn't have any messages to display (eg, 4 or higher as per the example given above):

https://website.com.au/forum/index.php?topic=7244.25;ShowOP
2: min(): Array must contain at least one element
File: /home/website/public_html/forum/Sources/Display.php
Line: 1264


Line 1264 is as follows:
$context['op_restrict_start'] = 'msg' . min($messages);
Life doesn't have to be perfect to be wonderful ...

skb

Quote from: dougiefresh on March 15, 2018, 10:50:45 PM
@skd:  Request fulfilled, kinda.....  ::) O:)

Thanks. You are really very quick.

With the 'filter' icon in the poster area, don't you think the 'OP Replies' button is redundant ? Just a suggestion. It's your call.

SMF 2.1.4 / TP 2.2.2

dougiefresh

GL700Wing:  Okay, I'll fix that.

skb:  It may seem redundant to you, but that is what the original request for was for: a button to toggle replies by OP only.

dougiefresh

Uploaded v1.0.2 - March 16th, 2018
o Removed ShowOP URL tag in favor of member URL tag.
o Fixed page count when member tag is used.
o Fixed issue where "Show OP replies" was improperly unavailable.




@Everybody:  Updated mod can be found here at XPtsp.com.  Anything else that should be added?

GL700Wing:  This update should fix the bug you reported.

GL700Wing

#16
Getting the following error in ./Sources/Display.php with latest version:
Unknown column 'msg.id_topic' in 'on clause'
File: /home/website/public_html/forum/Sources/Display.php
Line: 197


Find:
INNER JOIN {db_prefix}messages AS msgs ON (msg.id_topic = t.id_topic' . (isset($_GET['member']) ? ' AND msg.id_member = {int:filter_by}' : '') . ')

Replace with:
INNER JOIN {db_prefix}messages AS msgs ON (msgs.id_topic = t.id_topic' . (isset($_GET['member']) ? ' AND msgs.id_member = {int:filter_by}' : '') . ')

Even after fixing that issue I get the following error message when I try to filter messages:
The database value you're trying to insert does not exist: filter_by
Life doesn't have to be perfect to be wonderful ...

dougiefresh

Uploaded v1.0.3 - March 17th, 2018
o Fixed missing database value filter_by.
o Fixed unknown column in database query.




@GL700Wing:  This update fixes those very stupid errors on my part....  I apologize about missing those!

GL700Wing

Quote from: dougiefresh on March 17, 2018, 10:45:54 AM
Uploaded v1.0.3 - March 17th, 2018
o Fixed missing database value filter_by.
o Fixed unknown column in database query.




@GL700Wing:  This update fixes those very stupid errors on my part....  I apologize about missing those!
Excellent and many thanks once again - it's working perfectly.

Also, happy for you to remove the 'Show OP Replies'/Show All Replies' button as members can use the 'Filter' icon for both OP and other member replies which I think is a really neat feature.
Life doesn't have to be perfect to be wonderful ...

GL700Wing

#19
Quote from: GL700Wing on March 17, 2018, 08:16:04 PM
Also, happy for you to remove the 'Show OP Replies'/'Show All Replies' button as members can use the 'Filter' icon for both OP and other member replies which I think is a really neat feature.
Actually - I've just realised the  'Show All Replies' button at the top is currently the 'only' was to show all replies again after having filtered them using either the 'Show OP Replies' button or the 'Filter' icon.  Would it be possible to also have an 'Unfilter' icon (maybe rotate the 'Filter' icon 180°) to toggle the view to show all replies after the 'Filter' icon has been used?
Life doesn't have to be perfect to be wonderful ...

Advertisement: