Comment Plugin

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Comment Plugin

Oliver Specht
Hi,
I'd like to write a plugin for the comment function of wordpress. My
problem is, that I need the nickname/username of the poster of a
comment. The specialty is, that the user is not logged in so I need the
POST data from the comment form.

How do I get it? I used the get_comment_author() function but it only
returns "Anonymous"...

Thx!

Oliver
--
Oliver Specht
Open Metanet - Discuss Web Pages

http://www.webride.org/
mailto:[hidden email]
_______________________________________________
wp-hackers mailing list
[hidden email]
http://lists.automattic.com/mailman/listinfo/wp-hackers
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Comment Plugin

Austin Matzko
On 4/10/06, Oliver Specht <[hidden email]> wrote:
> Hi,
> I'd like to write a plugin for the comment function of wordpress. My
> problem is, that I need the nickname/username of the poster of a
> comment. The specialty is, that the user is not logged in so I need the
> POST data from the comment form.
>
> How do I get it? I used the get_comment_author() function but it only
> returns "Anonymous"...

If you're trying to get comment data right after it's been posted, why
don't you do something like this:

1. Hook a function into the "comment_post" action, which occurs once a
comment has been entered into the database and passes the comment's id
to the function.
2. Use get_commentdata([the comment's id]) to get the author info
about that comment.

function get_the_comment_author($id) {
$data = get_commentdata($id);
$author = $data['comment_author'];
...
}

add_action('comment_post', 'get_the_comment_author');
_______________________________________________
wp-hackers mailing list
[hidden email]
http://lists.automattic.com/mailman/listinfo/wp-hackers
Loading...