WordPress.org

Ready to get started?Download WordPress

Forums

Nicer comment permalinks (12 posts)

  1. zach
    Member
    Posted 10 years ago #

    I really like the sounds of this. This is exactly what I want to do. Has anyone had problems implementing this? If not, does anybody see anything wrong with it? Or am I a guinea pig?

  2. MathiasBynens
    Member
    Posted 10 years ago #

    Matt probably fixed the dollar sign bug on the forums, so now the code shows up as it should. (Thanks Matt!)
    Zach: Just go and implement it by following the instructions, it should work fine... If you're not feeling safe, create a backup of wp-comments.php. Let me know if it worked!
    I'm convinced you aren't a guinea pig by the way.

  3. OperaManiac
    Member
    Posted 10 years ago #

    why not just make it like this!
    /1 for comment 1
    /2 for comment 2
    or am i asking for too much! :D

  4. Matt Mullenweg
    Troublemaker
    Posted 10 years ago #

    The reason that comment IDs are used instead of comment order is that the links are supposed to be permalinks. If you link to the fifth comment in a thread, and then the third comment gets deleted, your link is broken if you use the above method. It would also be broken if a comment is held for moderation and approved later, as once it's approved it would show up in the normal flow with the time it was posted. Using the ID provides a permanent anchor for every comment as long as it exists on the page.

  5. MathiasBynens
    Member
    Posted 10 years ago #

    Matt: Yeah, but if a comment is deleted in a default WP install, the permalink won't point to any comment anymore, but just to the post itself...
    I get your point; however I'll still use these comment permalinks just because of the fact that nobody's linking to comments on my blog but me ;)
    Sushubh:
    That won't work, unless .htaccess allows rewriting # (which it doesn't as far as I know).

  6. Lilandra
    Member
    Posted 10 years ago #

    ooo
    i like that..

  7. Matt Mullenweg
    Troublemaker
    Posted 10 years ago #

    You can't access fragment identifiers (#anchors) with mod_rewrite. The post plus a number at the end is already used for posts with multiple pages.

  8. zach
    Member
    Posted 10 years ago #

    If a comment is deleted, I believe it is good form to leave it's carcass in the flow. Simply put 'Flame removed.', etc. But, now that I think about it, I really don't relish the idea of seeing 10 comments in a row that say 'Spam Removed'; that would suck.
    However, I do find it confusing as hell when a permalink to a comment says "Link to comment-375 on this page', especially when it's like the 3rd from the top. It hurts my trust in the permanence of the link.
    So now I don't know what to do. I've already had to override the default ordered list's numbering because I don't want the ordered number different than the comment URI number.
    Dammit, what have I gotten myself into?

  9. Matt Mullenweg
    Troublemaker
    Posted 10 years ago #

    If you don't trust the permenance than create a custom system based on date and poster-name.

  10. charle97
    Member
    Posted 10 years ago #

    that's what i'm going to do.

  11. zach
    Member
    Posted 10 years ago #

    Wait. allusion's idea can't work. It makes too much sense. It's too logical.

  12. Anonymous
    Unregistered
    Posted 10 years ago #

    [digging it all up again]
    Having global comment IDs makes sense as permalinks, but the permalinks are no longer cruft-free. Just longer.
    Anyway, I replaced my comment_ID():
    function comment_ID() {
    global $comment;
    echo mysql2date('g:i:sa', $comment->comment_date);
    echo '-';
    $author = apply_filters('comment_author', $comment->comment_author);
    if (empty($author)) {
    echo 'Anonymous';
    } else {
    $author = preg_replace("/[^A-Za-z0-9]/", "", $author);
    echo $author;
    }
    }

    It will generate links like "/2004/05/21/hello-world/#3:31:00am-MrWordPress". Everything works fine, so long as no-one wants to use accented or non-English characters.
    It should be obvious that I don't know what I am doing, but maybe someone else can make this workable. :)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.