• Resolved bonnerl17

    (@bonnerl17)


    I’m designing a plugin and as part of what it does it’s going to change what comment_author_link() returns, and as part of it I need the user’s ID number. But when I try to use comment_ID() it echo’s/prints it no matter where I put it. (Note: I’m using comment_ID() when I query the database to get the comment authors #ID, so if you know a better way to get their #ID I’d be glad to hear about it!)

Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator Samuel Wood (Otto)

    (@otto42)

    www.ads-software.com Admin

    Well… which are you trying to get? The User’s ID or the Comment’s ID? These are not the same things.

    Anyway, you can use get_comment_ID() to get the comment ID back instead of echoing it.

    Thread Starter bonnerl17

    (@bonnerl17)

    I’m needing the users ID.

    Anyway, you can use get_comment_ID() to get the comment ID back instead of echoing it.

    Thanks.

    Moderator Samuel Wood (Otto)

    (@otto42)

    www.ads-software.com Admin

    The problem is that the users ID is not stored with the comment. It only stores the user name, email, url with the comment. If you want to link that info to a user, you’ll probably need some custom SQL.

    Actually, the user ID is stored with a comment (under the column user_id). So within the comment loop:

    $comment->user_id

    will hold it. That is, if the comment is from a logged in user on your blog. Otherwise the value will be null.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘comment_ID()’ is closed to new replies.