Advertisement:

Author Topic: Toggle replies to show OP replies only  (Read 2890 times)

Offline GL700Wing

  • Full Member
  • ***
  • Posts: 441
  • Gender: Female
Toggle replies to show OP replies only
« 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.

Offline dougiefresh

  • SMF Hero
  • ******
  • Posts: 2,815
  • Mod King
    • XPtsp.com Community
Re: Toggle replies to show OP replies only
« Reply #1 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....

Offline GL700Wing

  • Full Member
  • ***
  • Posts: 441
  • Gender: Female
Re: Toggle replies to show OP replies only
« Reply #2 on: March 15, 2018, 06:17:32 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!

Offline dougiefresh

  • SMF Hero
  • ******
  • Posts: 2,815
  • Mod King
    • XPtsp.com Community
Re: Toggle replies to show OP replies only
« Reply #3 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....

Offline GL700Wing

  • Full Member
  • ***
  • Posts: 441
  • Gender: Female
Re: Toggle replies to show OP replies only
« Reply #4 on: March 15, 2018, 07:46:04 PM »
Wow - you don’t waste any time!

Offline dougiefresh

  • SMF Hero
  • ******
  • Posts: 2,815
  • Mod King
    • XPtsp.com Community
Re: Toggle replies to show OP replies only
« Reply #5 on: March 15, 2018, 07:52:49 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....

Offline GL700Wing

  • Full Member
  • ***
  • Posts: 441
  • Gender: Female
Re: Toggle replies to show OP replies only
« Reply #6 on: March 15, 2018, 08:10:25 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
« Last Edit: March 16, 2018, 08:31:41 AM by Steve »

Offline landyvlad

  • Full Member
  • ***
  • Posts: 640
  • Gender: Male
    • Michael Reed on Facebook
    • GSX1400 Owners ORG
Re: Toggle replies to show OP replies only
« Reply #7 on: March 15, 2018, 09:16:21 PM »

Quote
Also, 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 !

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.

To paraphrase Kindred: "There are no technical solutions to social problems."

Offline skb

  • Jr. Member
  • **
  • Posts: 280
    • Metabolically Challenged
Re: Toggle replies to show OP replies only
« Reply #8 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.
Learning, every day.
Forum - The Diabetic Pub
Because every diabetic needs help
SMF 2.0.15 (default theme) / TP 1.42

Offline dougiefresh

  • SMF Hero
  • ******
  • Posts: 2,815
  • Mod King
    • XPtsp.com Community
Re: Toggle replies to show OP replies only
« Reply #9 on: March 15, 2018, 09:54:16 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....

Offline dougiefresh

  • SMF Hero
  • ******
  • Posts: 2,815
  • Mod King
    • XPtsp.com Community
Re: Toggle replies to show OP replies only
« Reply #10 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.  Anything else that should be added?

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

Offline GL700Wing

  • Full Member
  • ***
  • Posts: 441
  • Gender: Female
Re: Toggle replies to show OP replies only
« Reply #11 on: March 15, 2018, 11:11:05 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).

Offline GL700Wing

  • Full Member
  • ***
  • Posts: 441
  • Gender: Female
Re: Toggle replies to show OP replies only
« Reply #12 on: March 16, 2018, 01:49:21 AM »
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);

Offline skb

  • Jr. Member
  • **
  • Posts: 280
    • Metabolically Challenged
Re: Toggle replies to show OP replies only
« Reply #13 on: March 16, 2018, 08:01:06 AM »
@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.
Learning, every day.
Forum - The Diabetic Pub
Because every diabetic needs help
SMF 2.0.15 (default theme) / TP 1.42

Offline dougiefresh

  • SMF Hero
  • ******
  • Posts: 2,815
  • Mod King
    • XPtsp.com Community
Re: Toggle replies to show OP replies only
« Reply #14 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.

Offline dougiefresh

  • SMF Hero
  • ******
  • Posts: 2,815
  • Mod King
    • XPtsp.com Community
Re: Toggle replies to show OP replies only
« Reply #15 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.  Anything else that should be added?

GL700Wing:  This update should fix the bug you reported.

Offline GL700Wing

  • Full Member
  • ***
  • Posts: 441
  • Gender: Female
Re: Toggle replies to show OP replies only
« Reply #16 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:
Code: [Select]
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:
Code: [Select]
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
« Last Edit: March 16, 2018, 06:45:34 PM by GL700Wing »

Offline dougiefresh

  • SMF Hero
  • ******
  • Posts: 2,815
  • Mod King
    • XPtsp.com Community
Re: Toggle replies to show OP replies only
« Reply #17 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!

Offline GL700Wing

  • Full Member
  • ***
  • Posts: 441
  • Gender: Female
Re: Toggle replies to show OP replies only
« Reply #18 on: March 17, 2018, 08:16:04 PM »
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.

Offline GL700Wing

  • Full Member
  • ***
  • Posts: 441
  • Gender: Female
Re: Toggle replies to show OP replies only
« Reply #19 on: March 17, 2018, 10:53:14 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?
« Last Edit: March 17, 2018, 11:18:57 PM by GL700Wing »