Support » Theme: P2 » P2 and comment author url

  • Resolved gbrazell


    I’m attempting to use this code in a functions.php file within my p2-child theme:

    function force_comment_author_url($comment)
        // does the comment have a valid author URL?
        $no_url = !$comment->comment_author_url || $comment->comment_author_url == 'http://';
        if ($comment->user_id && $no_url) {
            // comment was written by a registered user but with no author URL
            $comment->comment_author_url = '' . $comment->user_id;
        return $comment;
    add_filter('get_comment', 'force_comment_author_url');

    There is no other code in that functions.php, and my reason for needing this is to force the comment url of my users to the front-end profile page created by the WP Symposium plug-in (found at this url:

    Everything works perfectly with this code, comment author names link to the proper profile page of the user, except now when clicking Reply in a comment, P2 kicks this overlay error message.

    As you can see, P2 knows I’m logged into the testdude account by looking at the top right of the reply window, but it still pops the message saying I need to log-in again. It will also not allow me to click the reply button.

    Removing this functions.php file fixes the issue with P2, so it’s directly related to this code and change via the child theme. Any thoughts, ideas, suggestions would be greatly appreciated.

Viewing 2 replies - 1 through 2 (of 2 total)
  • I believe it has to do with my use of:

    add_filter('get_comment', 'force_comment_author_url');

    And by filtering all ‘get_comment’, I’m breaking functionality in p2 somewhere along the lines. Been scratching my head on how to do this without editing the p2 theme directly. Hopefully somebody has experience with p2 and comment_author.

    This was actually a cookie issues, caused by testing in an “incognito window” which blocked wordpress and p2 from creating cookies. Thanks for being a soundboard though!

    Perhaps that code I posted above will help somebody in the future, cuz it works a treat for custom comment_author_urls.


Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘P2 and comment author url’ is closed to new replies.