WordPress.org

Ready to get started?Download WordPress

Forums

Help Req: get_commentdata returning nothing? (1 post)

  1. fel64
    Member
    Posted 7 years ago #

    I'm trying to make a plugin that will register users when they make a comment if they are not already registered. Hooking myself into comment_post (which gives my function the comment ID) I then take the comment ID and using get_commentdata I want to get the comment data back, such as author name and email. (I then sanitize, check etc, then call wp_create_user).

    However, get_commentdata is returning an empty array despite me passing along a valid comment ID. This is the output I get (I retrieved this output by mailing it to myself):

    Array
    (
        [comment_ID] =>
        [comment_post_ID] =>
        [comment_author] =>
        [comment_author_email] =>
        [comment_author_url] =>
        [comment_author_IP] =>
        [comment_date] =>
        [comment_content] =>
        [comment_karma] =>
        [comment_approved] =>
        [comment_type] =>
    )

    I do not need to use get_commentdata, it just seemed like the appropriate function. How can I use it to get the comment data, or what function should I use instead and how?

Topic Closed

This topic has been closed to new replies.

About this Topic