[wp-hackers] "commenter" user role

John O'Nolan john.wp at onolan.org
Wed Mar 10 20:20:40 UTC 2010


I'm fairly sure that this argument isn't going to go anywhere now  
until someone actually writes some code, and other people respond to  
it. So we might as well just wait for that to happen.

John




On 10 Mar 2010, at 19:52, Otto wrote:

> On Wed, Mar 10, 2010 at 1:27 PM, Jeremy Clarke  
> <jer at simianuprising.com> wrote:
>> If you think that the current system for doing this is clunky then  
>> you
>> should work on improvements to the current system. I'd love it there
>> was a built-in way to set up your comment form in such a way that it
>> basically signs people up for accounts by default, without seeing the
>> admin. That might be plugin territory or not, but there's no reason  
>> to
>> believe that changing the DB structure will improve it inherently.
>
> It's actually not that hard to do as a plugin.
>
> add_action to pre_comment_on_post. That function looks at the
> submitted email value, then calls get_user_by_email to see if the user
> has already registered or not. If not, it can add him using
> wp_insert_user and the submitted values. Then it will need to call
> wp_set_current_user() to make the user "logged in". After that, the
> normal comment handling code will automatically fill in the user_ID
> field.
>
> Should be no more than, say, 15-20 lines of code.
>
> -Otto
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers



More information about the wp-hackers mailing list