In-Reply-To and Infinite Replies

Over at OT, I have added a variation on automatic “In Reply To” commenting links, which I believe may once have been more common, and which some users find helpful in sorting out long discussions, especially in nested comment threads at “max depth,” and even more when an “Infinite Replies” capacity has been enabled.

Infinite Replies (IR)

I summarized “Infinite Replies” in my introductory post on them at OT as follows:

When comment thread “nesting” reaches maximum “depth” reply links will continue to appear underneath new comments, and the actual replies will appear at the bottom of the given sub-thread.1 This solution as implemented will not be the ideal implementation – which would involve more complex dynamics and formatting – but will be a good start, at least relieving us on busy threads from having to scroll all the way to the top in order to reply to a comment far below.

Over the course of months in 2014-5, I kicked around various ways of achieving this effect with WordPress developer Bhagwad Jal Park, who had authored a simple hack for it, and also is the one who named the result “Infinite Replies”2, as described in his post in late 2013: “Allow Infinite Replies with WordPress Threaded Comments.”

Executing Bhagwad’s hack required committing a WordPress developer’s sin, hacking a WordPress core file, whose main practical drawback is the requirement that a site manager re-do the hack every time WordPress does a major update or update affecting the core file in question. The recommended – and better – practice is to add or modify whatever function or process in question via theme or plug-in, and there are almost always a range of choices available.

Bhagwad finally achieved his own non- or less-hacky solution via a method he described in detail in a later post, “Adding Infinite Replies in WordPress.” The solution that he details there requires 1) creating a substitute “Comment-Reply-Link” function and 2) adjusting it if necessary so that it works with the Javascript that locates comment reply boxes on a comment thread.

You can examine Bhagwad’s solution at the linked post. The solution I applied at OT was much simpler, since all it required was making an edit to a WordPress child theme, a non-sinful method for making such modifications. Doing so bypasses the lost-to-upgrade problem, which can affect themes in the same way it affects WP core files. Another alternative would be to develop a theme-independent plug-in, and the best solution would likely involve developing a full-fledged independent commenting system (comment “Walker” function or even more elaborate), but those are projects for a different day/month/season/year.3

At OT, all I had to do was locate the “comment_reply_link()” function, which on the Expound theme used at OT happens to be located in a special template-tags.php file. The key portion looked like this:

Adding infinite replies turned out to consist of adding a space and two little characters to the max_depth line (a recursive solution of the sort beloved by programmers, which originated, in passing, in a StackExchange “answer” on a different question):

Depending on how a given theme is constructed and written, this solution may have to be amended in different ways. In order, for instance, to apply it at this blog, whose theme does not deploy significant customizations of built-in WP commenting, I would need to write a new filter function or possibly a comment “Walker” function, a project for another day.4

Though Bhagwan wanted to avoid writing his own Walker, the eventual best solution will involve doing so, I expect. If done in a standards-compliant way, it would not interfere with typical theme commenting customizations accomplished on the level of styling/formatting, or by use of plug-ins, or by minimal additions to normal WP commenting functionality.

In Reply To Links (IR2L)

After adding Infinite Replies to OT, several users noticed what they experienced as a time-displacement confusion, since, in a give mono-columnar sub-thread of the sort that results at maximum depth, it is possible for particular comments to appear above other comments made earlier. In other words, contrary to my initial description, new comments do not always appear at the bottom of the new thread. Actually, what we’re seeing in such a long thread will be comments that in one sense are at different depths, but for display purposes are at the same depth.

For independent but overlapping reasons, some commenters also like being able to tell immediately what a given commenter is specifically replying to, and, especially in a long, complicated discussion, may also like to be able to find an original comment. Luckily enough for both purposes – if not necessarily a complete solution, especially with reference to an ideal “IR” display and functionality – the code snippet for “in reply to” links has been floating around in the WordPress ocean of snippets for years.

The example I happened to run across is written a little differently than in my normal PHP style, but it works, so why complain? Usually, the link is written out “in reply to,” but I wanted something more compact for OT. I also wrapped the addition in its own div + CSS class so I could style it:

It was easier to add directly to the Expound Child template-tag.php file than it would or will be to add on this blog – probably by adding a filter function or in the context, as above, of writing a new comment Walker. Just to complete these notes for now, I styled the “comment-irt” div as follows:

…producing this:

reply_to_link

You can view or try it on any thread at OT. (The above image happens to come from the “Why Nine Innings” comment thread.)

Notes:

  1. Not precisely true: see discussion under IR2L. []
  2. Obviously the replies aren’t infinite, but rather more open-ended or pervasive or something, but it’s kind of fun to think of them as infinite and of replies at max depth as entering the Infinite Zone. []
  3. Also, just in case it doesn’t go without saying, neither Bhagwad’s nor my solution will likely be useful to someone using a third-party commenting system like Disqus or Livefyre. []
  4. The WP Codex outlines the process in relation to comments in its page on the wp_list_comments() function. Starting with the page on the so-called “Walker Class” may induce blackouts in beginners… []

WordPresser
Home Page  Public Email  Twitter  Facebook  YouTube  Github   

Writing since ancient times, blogging, e-commercing, and site installing-designing-maintaining since 2001; WordPress theme and plugin configuring and developing since 2004 or so; a lifelong freelancer, not associated nor to be associated with any company, publication, party, university, church, or other institution.

4 comments on “In-Reply-To and Infinite Replies

Commenting at CK MacLeod's

We are determined to encourage thoughtful discussion, so please be respectful to others. We also provide a set of Commenting Options - comment/commenter highlighting and ignoring, and commenter archives that you can access by clicking the commenter options button (). Go to our Commenting Guidelines page for more details, including how to report offensive and spam commenting.

  1. Hey, glad you managed to get this to work for your theme!

    I used the same “hack” to add a “parent comment” link – by just pre-pending it to the comment text as I wrote here:

    https://www.webhostinghero.com/wordpress-parent-comment-links/

    I’m also thinking that maybe the comment styles of Google+ and Facebook are pretty elegant. They have a effective “comment depth” of just 2 and seem to not have real problems with long discussions.

    Haven’t yet worked up the courage to implement that though!

    • Hey, Bhagwad.

      The code I used in the above is kind of “IRT Classic” – if you search for its constituent parts you’ll find them used in a lot of places. It may appear in the WordPress Codex somewhere, and I wonder if comment_parent wasn’t added to WP core for precisely this purpose.

      I like your version of IRT via function. In fact, I think I will very soon try a version of it to add IRT links to this blog. Once that’s accomplished, it ought to make for a cute little plug-in, assuming there isn’t one already in the repo I never noticed. (If you or someone else beats me to the punch, I’ll try it out here.)

      I’m not sure about Google+ and Facebook for long discussions – either at the sites themselves or in comment threads styled to emulate them – in part because I’ve never been in or attempted to follow one in such a situation, though I have been in long, un-threaded discussions that eventually became very burdensome to try to develop, since by comment 100 or 200 there may be several discussions going on at once, or threads that have been abandoned because they’ve just become to difficult to find and follow.

      Because the Ordinary Times site has a unique commenter community, featuring a number of intelligent, voluble, and polite yet argumentative souls, many of whom have been discussing political and cultural topics with each other for years now, the comments and sidebar and sidebar-to-the-sidebar discussions sometimes get long and involved, putting more or a premium on whatever enhancements you can think of: My first goal since I started working at OT was doing things that would make my own participation easier.

    • Thanks, Marc – I’ll take a look at it, though I’m a little confused by the description, specifically by what you mean by “2nd level thread,” since it sounds like you’re saying “not every comment on threads at depth 3, 4, etc.”

      Anyway, adding the reply links is good, and it’s cool if you’ve come up with a way to do it that doesn’t require editing or replacing template files, but I was as interested in, and eventually got to, extending threads “infinitely” (or unboundedly), so that really long ones don’t jam up confusingly wherever they end – was more of a concern at a busy blog where threaded conversations semi-regularly go into the hundreds of comments.

      https://ckmacleod.com/2015/08/25/the-snake-is-implemented-2/

1 Pings/Trackbacks for "In-Reply-To and Infinite Replies"
  1. […] snippets and explanations on IRTL and also on Infinite Replies available at my personal blog. […]

Commenter Ignore Button by CK's Plug-Ins

Leave a Reply

Your email address will not be published. Required fields are marked *

*

Related

Noted & Quoted

TV pundits and op-ed writers of every major newspaper epitomize how the Democratic establishment has already reached a consensus: the 2020 nominee must be a centrist, a Joe Biden, Cory Booker or Kamala Harris–type, preferably. They say that Joe Biden should "run because [his] populist image fits the Democrats’ most successful political strategy of the past generation" (David Leonhardt, New York Times), and though Biden "would be far from an ideal president," he "looks most like the person who could beat Trump" (David Ignatius, Washington Post). Likewise, the same elite pundit class is working overtime to torpedo left-Democratic candidates like Sanders.

For someone who was not acquainted with Piketty's paper, the argument for a centrist Democrat might sound compelling. If the country has tilted to the right, should we elect a candidate closer to the middle than the fringe? If the electorate resembles a left-to-right line, and each voter has a bracketed range of acceptability in which they vote, this would make perfect sense. The only problem is that it doesn't work like that, as Piketty shows.

The reason is that nominating centrist Democrats who don't speak to class issues will result in a great swathe of voters simply not voting. Conversely, right-wing candidates who speak to class issues, but who do so by harnessing a false consciousness — i.e. blaming immigrants and minorities for capitalism's ills, rather than capitalists — will win those same voters who would have voted for a more class-conscious left candidate. Piketty calls this a "bifurcated" voting situation, meaning many voters will connect either with far-right xenophobic nationalists or left-egalitarian internationalists, but perhaps nothing in-between.

Comment →

Understanding Trump’s charisma offers important clues to understanding the problems that the Democrats need to address. Most important, the Democratic candidate must convey a sense that he or she will fulfil the promise of 2008: not piecemeal reform but a genuine, full-scale change in America’s way of thinking. It’s also crucial to recognise that, like Britain, America is at a turning point and must go in one direction or another. Finally, the candidate must speak to Americans’ sense of self-respect linked to social justice and inclusion. While Weber’s analysis of charisma arose from the German situation, it has special relevance to the United States of America, the first mass democracy, whose Constitution invented the institution of the presidency as a recognition of the indispensable role that unique individuals play in history.

Comment →

[E]ven Fox didn’t tout Bartiromo’s big scoops on Trump’s legislative agenda, because 10 months into the Trump presidency, nobody is so foolish as to believe that him saying, “We’re doing a big infrastructure bill,” means that the Trump administration is, in fact, doing a big infrastructure bill. The president just mouths off at turns ignorantly and dishonestly, and nobody pays much attention to it unless he says something unusually inflammatory.On some level, it’s a little bit funny. On another level, Puerto Rico is still languishing in the dark without power (and in many cases without safe drinking water) with no end in sight. Trump is less popular at this point in his administration than any previous president despite a generally benign economic climate, and shows no sign of changing course. Perhaps it will all work out for the best, and someday we’ll look back and chuckle about the time when we had a president who didn’t know anything about anything that was happening and could never be counted on to make coherent, factual statements on any subject. But traditionally, we haven’t elected presidents like that — for what have always seemed like pretty good reasons — and the risks of compounding disaster are still very much out there.

Comment →
CK's WP Plugins

Categories

Extraordinary Comments

CK's WP Plugins