tags:

views:

17

answers:

1

I am working on an plugin for wordpress that will check against an external database to see if the user is a member of that site. If they are, and they don't have a wp login, then the plugin will need to create a login for them. I have everything working (at least in isolation/unit testing), but what I cannot figure out is how to hook into the login process.

Basically what I need to happen is when the login form is submitted, I first need wp to call my function in my plugin. My plugin will then either create a new user (if needed), then I will let wp continue with login.

How can I do that? Is there an action that I am missing?

A: 

So what I ended up doing was to hook into the action "wp_login_failed". So if the member was not a member of the wp site, then my method was called, which then called the external site. If a member was found, a member was created (using "wp_insert_user()"), and then manually logged in.

If you do this, make sure that you use "wp_redirect()" to send them where you want them to go, otherwise the system will present them with an error screen as wp_login has registered a bunch of errors. (Unless you know how to clear the errors).

Brandon Hansen