简体   繁体   中英

Insert drupal registrations in a second database

I have a drupal 7 website that i would like to link with a java application that has it's own database. In order to do that i need to make sure users don't have to insert their information twice. So there should be 2 registration options:

  1. Register on the drupal website and after that you should be able to login into the java application aswell.
  2. Register in the java application and after that you should be able to login with the same credentials onto the drupal website.

The second registration option is not really an issue since i can just insert a new row (with user info) within the user table into the drupal database. But i have no idea how i can do the first option. Do i need to modify the drupal core for this?

Using the drupal hooks -- hook_user_insert and hook_user_update - you can use the db_set_active('seconddbname') for pointing out your second db and insert the user datas.

Hope this can be useful for you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM