Skip to content

Commit

Permalink
Bug fix: 'add reply' link should link directly reply to comment form
Browse files Browse the repository at this point in the history
See #77
  • Loading branch information
raamdev committed Dec 11, 2015
1 parent 3a85894 commit 686b273
Showing 1 changed file with 5 additions and 2 deletions.
Expand Up @@ -89,6 +89,9 @@
// URL to this comment; i.e. the one we're notifying about.
$_comment_url = get_comment_link($_comment->comment_ID);

// URL to the reply link for this comment
$_comment_reply_url = get_permalink($_comment->comment_post_ID).'?replytocom='.$_comment->comment_ID.'#respond';

// How long ago the comment was posted on the site (human readable).
$_comment_time_ago = $plugin->utils_date->approx_time_difference(strtotime($_comment->comment_date_gmt));

Expand Down Expand Up @@ -121,7 +124,7 @@
<?php echo __('continue reading', $plugin->text_domain); ?>
</a>
<?php if($sub_post_comments_open): ?>
| <a href="<?php echo esc_attr($_comment_url); ?>">
| <a href="<?php echo esc_attr($_comment_reply_url); ?>">
<?php echo __('add reply', $plugin->text_domain); ?>
</a>
<?php if($replies_via_email_enable): ?>
Expand Down Expand Up @@ -150,7 +153,7 @@
<?php echo __('continue reading', $plugin->text_domain); ?>
</a>
<?php if($sub_post_comments_open): ?>
| <a href="<?php echo esc_attr($_comment_url); ?>">
| <a href="<?php echo esc_attr($_comment_reply_url); ?>">
<?php echo __('add reply', $plugin->text_domain); ?>
</a>
<?php if($replies_via_email_enable): ?>
Expand Down

1 comment on commit 686b273

@raamdev
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jaswsinc Here's why 686b273 fixes a bug:

If someone reads a comment in a comment notification email and then clicks "add reply", the most common expectation will be that we're replying to the comment, not replying to the entire post (after all, we just read a specific comment and then clicked 'add reply'; we didn't read the entire post and click 'add reply').

However, prior to this commit, the 'add reply` link was linking directly to the comment. You could argue that the user then just needs to click the "Reply" button on the comment form to reply to that comment, however there is one common scenario where this does not happen:

If a new comment notification arrives and a user clicks 'add reply', they are sent to the permalink for the comment (e.g., /hello-world/#comment-34). However, if this comment is the most recent comment (i.e., the last comment in the list of comments), the main comment reply form will be directly beneath the comment:

2015-12-11_08-58-02

When the user sees this comment form, there won't be any reason for them to click "Reply" on the comment they're actually responding to, so instead they will use the comment form that is visible thinking they're replying to the comment they just read, when in fact they're just posting a new top-level comment responding to the whole post.

This makes for a lot of confusion! I recall fixing a similar bug in StCR over a year ago.

In any case, this commit changes the link for by 'add replyin the email templates so that it usesreplytocom=, e.g.,/hello-world/?replytocom=34#respond`. This causes the reply form to be loaded already assigned to the comment to which the user is replying.

The only downside to this is that using replytocom doesn't load the form in-line with the comment being replied to (i.e., you'd have to scroll back up and look for the comment you're responding to if you want to re-read it), however in my experience that's worth giving up in return for linking to a comment form that doesn't require clicking "Reply" on the comment you want to reply to.

Please sign in to comment.