tags:

views:

163

answers:

3

When my user registers in Drupal and his account is created, I'd like to be able to create an account in a 3rd-party system (e.g. some moodle site).

Is that possible with an existing module? If not, what would be the preferred way to add this functionality?

+2  A: 

You'll need to create a new custom module and implement the hook_user().

Specifically, you'll need to support the 'insert' operation, but of course you could add support for many others (such as delete or update) so you can manage users from your Drupal installation as well.

BTW: no existing module will couple exactly with your system, unless you're referring to a 3rd party application - in which case it'd help if you could tell us which one you're using :)

Seb
If it is in fact Moodle, I believe there is a module already built which supports this.
David Wees
+2  A: 

You might also check out the Moodle module for Drupal. I used it a couple years ago and it was kind of a headache, but I'd guess that it's come a long way since then.

Interestingly, they recommend using OpenID to manage users between the sites. That may be easier than implementing your own hook_user instance if you aren't very comfortable writing Drupal modules. Just a thought.

theunraveler
+1  A: 

I second Sebs suggestion of using hook_user() for this, either after the fact on the 'insert' action, or upfront on 'validate', or on both, depending on how you need to deal with an eventual failure of Drupal itself or the 3rd-party-system.

Also, given your other question in this context, it looks like you might be interested in the following posts/discussions concerning external authentication in general:

You might also want to take a look at the OpenID integration in Drupal core as a somewhat 'authoritative' source of examples.

Henrik Opel

related questions