Simple Machines Community Forum

Customizing SMF => Modifications and Packages => Mod Requests => Topic started by: GL700Wing on March 14, 2018, 08:42:31 PM

Title: Toggle replies to show OP replies only
Post by: GL700Wing on March 14, 2018, 08:42:31 PM
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.
Title: Re: Toggle replies to show OP replies only
Post by: 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....
Title: Re: Toggle replies to show OP replies only
Post by: GL700Wing on March 15, 2018, 06:17:32 PM
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!
Title: Re: Toggle replies to show OP replies only
Post by: dougiefresh on March 15, 2018, 07:10:57 PM
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....
Title: Re: Toggle replies to show OP replies only
Post by: GL700Wing on March 15, 2018, 07:46:04 PM
Wow - you don't waste any time!
Title: Re: Toggle replies to show OP replies only
Post by: dougiefresh on March 15, 2018, 07:52:49 PM
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 (http://www.xptsp.com/board/index.php?topic=1637.0)....  I've also submitted it to the Customization Site....
Title: Re: Toggle replies to show OP replies only
Post by: GL700Wing on March 15, 2018, 08:10:25 PM
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 (http://www.xptsp.com/board/index.php?topic=1637.0)....  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
Title: Re: Toggle replies to show OP replies only
Post by: landyvlad on March 15, 2018, 09:16:21 PM

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 !

Title: Re: Toggle replies to show OP replies only
Post by: 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).

Just thinking aloud.
Title: Re: Toggle replies to show OP replies only
Post by: dougiefresh on March 15, 2018, 09:54:16 PM
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....
Title: Re: Toggle replies to show OP replies only
Post by: dougiefresh on March 15, 2018, 10:50:45 PM
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 (http://www.xptsp.com/board/index.php?topic=1637.msg2382#msg2382).  Anything else that should be added?

@skd:  Request fulfilled, kinda.....  ::) O:)
Title: Re: Toggle replies to show OP replies only
Post by: 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).
Title: Re: Toggle replies to show OP replies only
Post by: GL700Wing on March 16, 2018, 01:49:21 AM
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);
Title: Re: Toggle replies to show OP replies only
Post by: skb on March 16, 2018, 08:01:06 AM
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.
Title: Re: Toggle replies to show OP replies only
Post by: dougiefresh on March 16, 2018, 11:15:26 AM
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.
Title: Re: Toggle replies to show OP replies only
Post by: dougiefresh on March 16, 2018, 11:55:54 AM
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 (http://www.xptsp.com/board/index.php?topic=1637.msg2382#msg2382).  Anything else that should be added?

GL700Wing:  This update should fix the bug you reported.
Title: Re: Toggle replies to show OP replies only
Post by: GL700Wing on March 16, 2018, 06:33:56 PM
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
Title: Re: Toggle replies to show OP replies only
Post by: 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!
Title: Re: Toggle replies to show OP replies only
Post by: GL700Wing on March 17, 2018, 08:16:04 PM
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.
Title: Re: Toggle replies to show OP replies only
Post by: GL700Wing on March 17, 2018, 10:53:14 PM
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?
Title: Re: Toggle replies to show OP replies only
Post by: dougiefresh on March 18, 2018, 11:00:27 AM
Uploaded v1.0.4 - March 18th, 2018
o Removed the button that filter OP's messages and show all replies.
o Added "unfilter" icon that shows when messages are being filtered.



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.
Done.

Quote from: GL700Wing on March 17, 2018, 10:53:14 PM
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?
Also done.
Title: Re: Toggle replies to show OP replies only
Post by: GL700Wing on March 18, 2018, 11:32:55 AM
Quote from: dougiefresh on March 18, 2018, 11:00:27 AM
Uploaded v1.0.4 - March 18th, 2018
o Removed the button that filter OP's messages and show all replies.
o Added "unfilter" icon that shows when messages are being filtered.
Many thanks once again.

(I won't get a chance to test the latest version for a week or so as I'll be away on holidays.)
Title: Re: Toggle replies to show OP replies only
Post by: skb on March 19, 2018, 09:39:02 AM
Downloaded & installed the latest build.
The reverse toggle switch with the 'unfilter.png' doesn't work. All replies are not shown, the page with the replies of selected member remains as is.
Title: Re: Toggle replies to show OP replies only
Post by: dougiefresh on March 20, 2018, 10:14:18 AM
Uploaded v1.0.5 - March 20th, 2018
o Fixed "unfilter" icon link so that it now works.




@skb:  Yeah, I guess fixing the URL code would be helpful as well....  Thanks for the bug report!
Title: Re: Toggle replies to show OP replies only
Post by: skb on March 21, 2018, 01:56:09 AM
Thanks Doug,

It's working fine now.
Title: Re: Toggle replies to show OP replies only
Post by: GL700Wing on March 25, 2018, 01:32:09 AM
Quote from: dougiefresh on March 20, 2018, 10:14:18 AM
Uploaded v1.0.5 - March 20th, 2018
o Fixed "unfilter" icon link so that it now works.
Many thanks - working perfectly!
Title: Re: Toggle replies to show OP replies only
Post by: dougiefresh on May 21, 2018, 11:41:58 PM
Filter Messages By Poster (https://custom.simplemachines.org/mods/index.php?mod=4174) mod has been approved!  Please direct all mod support questions and related stuff about the mod to that thread!  Thank you!