User registration: writing to joomla DB as well as external

Your code modifications and patches you want to share with others.
Locked
pzero
Joomla! Fledgling
Joomla! Fledgling
Posts: 4
Joined: Sat Nov 28, 2009 5:21 am

User registration: writing to joomla DB as well as external

Post by pzero » Sat Nov 28, 2009 5:32 am

Hi,

I have sucessfully modified my user registration form to include about 4 new custom feilds I require. Only 1 of these feilds needs to write back to the jos_users table and I have that working successfully.

The other 3 feilds (along with a mixture of the standard joomla user registration feilds) I need to write into another DB external to joomla.

I am wondering what file on the server end specifies the writing the user registration information, so that I can hack up the sequence to add the write to the second location.

I hope that makes sense, as im fairly new to php and joomla.

User avatar
3by400Inc
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 232
Joined: Wed Oct 08, 2008 6:25 pm
Location: Dahlonega, GA
Contact:

Re: User registration: writing to joomla DB as well as external

Post by 3by400Inc » Sat Nov 28, 2009 5:38 am

Hi, PZero -

Not withstanding your previous work, and not really knowing what you're trying to accomplish, you might be interested in knowing that you can allow Joomla registration to utilize LDAP and OpenID. If you go to Extensions, Plugin Manager, in the admin console, you can enable either of these two options rather than using the standard Joomla authentication.

Hope this helps!
Thanks!
3by400, Inc.
http://www.3by400.com

User avatar
toivo
Joomla! Master
Joomla! Master
Posts: 11074
Joined: Thu Feb 15, 2007 5:48 am
Location: Oxford, UK

Re: User registration: writing to joomla DB as well as external

Post by toivo » Sat Nov 28, 2009 5:48 am

The registration information is saved in the function register_save() of the user controller in components/com_user/controller.php.

Before you go ahead and hack the core Joomla files (which is not recommended, by the way), have a look at the user events in the plugin system, http://docs.joomla.org/Reference:User_E ... gin_System. You can use for example the event onBeforeStoreUser which is demonstrated in libraries/joomla/user/user.php.

And here is a thread which shows how you can connect to a different database using the method getInstance() in the JDatabase class. Check out the example at the end: http://forum.joomla.org/viewtopic.php?f=126&t=330641
Toivo Talikka, Global Moderator
troubleshooting smtp and other articles http://talikka.com/joomla

pzero
Joomla! Fledgling
Joomla! Fledgling
Posts: 4
Joined: Sat Nov 28, 2009 5:21 am

Re: User registration: writing to joomla DB as well as external

Post by pzero » Sat Nov 28, 2009 9:14 pm

Thanks for the replies so far, I have just realised that I can update this second DB with a HTTP post command. Where can you suggest I add this?

User avatar
toivo
Joomla! Master
Joomla! Master
Posts: 11074
Joined: Thu Feb 15, 2007 5:48 am
Location: Oxford, UK

Re: User registration: writing to joomla DB as well as external

Post by toivo » Sat Nov 28, 2009 9:22 pm

As outlined before, the user events in the plugin system are designed for this type of operations. You can build a form with hidden fields and use cURL to post the form data: http://php.net/manual/en/function.curl-exec.php.
Toivo Talikka, Global Moderator
troubleshooting smtp and other articles http://talikka.com/joomla

User avatar
toivo
Joomla! Master
Joomla! Master
Posts: 11074
Joined: Thu Feb 15, 2007 5:48 am
Location: Oxford, UK

Re: User registration: writing to joomla DB as well as external

Post by toivo » Sat Nov 28, 2009 9:36 pm

Correction: use an array with cURL: http://community.salesforce.com/sforce/ ... ge.id=3299
Toivo Talikka, Global Moderator
troubleshooting smtp and other articles http://talikka.com/joomla

solagracia77
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Fri Feb 12, 2010 9:29 pm

Re: User registration: writing to joomla DB as well as external

Post by solagracia77 » Mon Feb 15, 2010 1:33 am

it looks quite complicated, is there any easier way to do that?
Just one link and the solution for the problem above, please.
Thanks,
Joe


Locked

Return to “Core Hacks and Patches”