Register new users in the integartion of an other script

cosmosing

Joined: 2007-03-20
Posts: 12
Posted: Tue, 2007-04-03 18:02

I tried to integrate G2 with phpfox in a shared registrations process. Say, if the new users of the website want to register, no matter they are at phpfox REG page, or at G2 Reg page, they can register once and log in freely from both login page.

Now, the problems are like this:
1. G2 has developed an unsual Registration Protection machenicsm that prevents outsider registration. I don't know how this it's made. If you try the following way, you will fail.
(1) create a new user with norman registration process in G2, it will create a Pending User. You can find out this pending user in PhpMyAdmin, its user name and password will be transfered to g_user table when it's verified.
(2) NOW TAKE CARE: create a user in g_user table by phpmyadmin, name it differently with the same password copied from the hashpassword field of the previous registered user. You will not believe it, the new user will be not able to login! The G2 just go blank or say "The action you attempted is not permitted. "
(3) What about create a user in g_pendingusers? Use the same way by phpmyadmin, you may expect to find this user when you log in as Admin. But when you log in as admin, you will not find the pending user when you click Registration menu. This is also abnormal.

2. G2 is basically based on OOP and MVC pattern. It SHOULD be easy to reuse the classes to develop a new registration module used for phpfox, pligg or zencart, but I found it hard to understand G2 in short time. Therefore, reuse is a mission impossible for new comers to G2. I am not going to continue the job, because it cost me too much time and without any progressing but appreciating the delicate designed system. I do enjoy the disassembling works, but stopped anyway.

Advice anyone who is interested in this integration job:

1. if I could isolate the registration of G2 and create an interface, say a function like this:
$reg = new OutsideRegistration();
$reg->addUser($user, $name, $pwd, $email);

I will be very appreciated!
(also, need the login outsider interface)

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Wed, 2007-04-04 00:16

Did you see G2's embedding docs and embedding API?

see:
http://codex.gallery2.org/Gallery2:Embedding

@pending user:
by default, g2 is a slave in the master-slave relationship between your application and g2.
therefore, you would use the user-registration of your application and not the one of g2.

if you want to use g2 for user-registration and synchronize to the new user to your application, then you need to create a new g2 module which listens for GalleryEntity::save events and implements an event handler to synchronize the new users to your application.

forget about phpmyadmin, specific db tables etc. there's a clean API which you can use. no need to go into such gory details.

--------------
Documentation: Support / Troubleshooting | Installation, Upgrade, Configuration and Usage