Comment-user-id redirect to my site (6 posts)

  1. Ufon
    Posted 2 years ago #


    And it will explain the problem:

    When a user is registered (and logged in) and filled with the string "site" (in his profile). And if it is a comment, the link is to his site, right? Right. Well I need to link led is not on his website and in his profile.

    /users/?userID=(here id) - this is a link to his profile.

    Profile is implemented well. But just paste the link I can not. Also, if the user is not registered on the link leads to the site (I would)

    Now, as I have tried to implement it:

    There is such a file in wordpress \ wp-includes \ comment-template.php

    It is just in charge for that function on line 147 (for me) and it is called get_comment_author_link

    Here's the code:

    function get_comment_author_link( $comment_ID = 0 ) {
        /** @todo Only call these functions when they are needed. Include in if... else blocks */
        $url    = get_comment_author_url( $comment_ID );
        $author = get_comment_author( $comment_ID );
        if ( empty( $url ) || 'http://' == $url )
            $return = $author;
            $return = "<a href='$url' rel='external nofollow' class='url'>$author</a>";
        return apply_filters('get_comment_author_link', $return);

    I repeat what I want:

    PHP code
    $ return = "<a href='trololo.rf/users/?userID=$user_id-> ID 'rel =' external nofollow 'class =' ​​url '> $ author </ a>";

    Tried to add a variable that receives the id like this

    PHP code
    $ user_id = get_userdata (1);

    Not working. Or I don `t know how to apply it

    Yet seen such an option

    PHP code
    $ user = get_userdata ($ comment-> user_id);
    echo $ user-> ID;

    I do not know how to use it.

    Here's a link to a similar problem Comment-user-id
    That's all. Please help. Break all that you can.
    Knowledgeable people respond!

  2. esmi
    Forum Moderator
    Posted 2 years ago #

    Can I just clarify this? You want a commentator's website link to actually link to his profile on your site? If so, how would you expect to handle situations where:

    - the commentator has supplied a website link but is not subscribed to your site?
    - the commentator has not supplied a website link but is subscribed to your site?

  3. Ufon
    Posted 2 years ago #

    1. link to a website that he wrote.
    2. a link to his profile, even if not complete.

  4. Ufon
    Posted 2 years ago #

    I do not know much English, if something goes wrong, do not hurt me, okay? =)

  5. esmi
    Forum Moderator
    Posted 2 years ago #

    In that case, all of this could be handled via the comment display in your theme's comments.php template file. You could use the callback parameter in wp_list_comments to construct a comment display that suited your needs.

  6. Ufon
    Posted 2 years ago #

    Ok thanks I will try to do something for your advice =)

Topic Closed

This topic has been closed to new replies.

About this Topic