G2 Beta 4 with my own userdatabase integrated in my website

ActiveNight

Joined: 2005-07-10
Posts: 71
Posted: Sun, 2005-07-24 14:17

I have got my own user-database and I want to use it with G2 Beta 4. It is NOT a CMS. My website (it's a online-community-system) and the database-structure was provided completely by myself. Is there a tutorial?

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Sun, 2005-07-24 14:32

no tutorial yet, but you should look at the Embedding and Integration topic (link in my signature).
And you should take a look at the small wrapper script (you'll find a link to it at the bottom of the first post of the Embedding and integration topic).
And last but not least, we have docs/EMBEDDING and some existing integrations, where you can see how it works.

CMS or no CMS, there's no difference.

i move the topic to the integrations forum.

 
ActiveNight

Joined: 2005-07-10
Posts: 71
Posted: Sun, 2005-07-24 19:06

Hmm...it seems to be harder then I thought.
Where can I equalize my own user-database with the g2-database? Where and how do I have to insert the usernames,passwords and IDs into the g2-db?
And how will the users log into the gallery? It should work automatically.
Im overextended...

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Sun, 2005-07-24 19:38

have you actually read docs/EMBEDDING and looked at the sample wrapper linked in the embedding and integration topic?

i'm sorry that there are not better docs at the moment, but i've explained how it works in topics that are linked in the first post of the embedding and integration topic.

 
ActiveNight

Joined: 2005-07-10
Posts: 71
Posted: Sun, 2005-07-24 20:45

yes of course...I used the sample wrapper and I read the docs/EMBEDDING...
the integration topic is too related with cms
do i have to write my own registration-script?

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Sun, 2005-07-24 20:56

how do you create new users for your own website?
each time when you create a new user for your website, you have to call
GalleryEmbed::init(some params);
GalleryEmbed::createUser(some params);

that's it.

and in each request, use the user id from your website in the GalleryEmbed::init(some params); call.

 
ActiveNight

Joined: 2005-07-10
Posts: 71
Posted: Sun, 2005-07-24 21:49

In my own website I create users by:

          $sql = "
              INSERT INTO
                usertable (username, userpassword, useremail,userrealname)
              VALUES
                ("$value1","$value2","$value3","$value4")";
              $db->query($sql);

The IDs by SQL auto_increment..

 
ActiveNight

Joined: 2005-07-10
Posts: 71
Posted: Sun, 2005-07-24 21:51

In my own website I create users by:

          $sql = "
              INSERT INTO
                usertable (username, userpassword, useremail,userrealname)
              VALUES
                ("$value1","$value2","$value3","$value4")";
              $db->query($sql);

The IDs by SQL auto_increment..

Where can I find these "some paramaters" ? What means "init", "createUser" ?

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Sun, 2005-07-24 22:02

have you really looked at my example wrapper script, docs/EMBEDDING?

see modules/core/classes/GalleryEmbed.class for the details.
or take a look at the existing integrations into wp, xaraya, ....

basically, what you havw to right after your execute $sql thing is:

require_once('path/to/g2/embed.php');
/* initialize G2 */
$ret = GalleryEmbed::init(array('fullInit' => true));
if ($ret->isError()) {
print $ret->getAsHtml();
exit;
}

/ create user in g2 and create a mapping of our user to G2's user */
$userName = $value1;
$ret = GalleryEmbed::createUser($userName, array('email' => $value3, 'fullName' => $value4, 'password' => $value2));
if ($ret->isError()) {
print $ret->getAsHtml();
exit;
}

that was the code to create a user g2 right at the moment when you create a user in your website.

 
ActiveNight

Joined: 2005-07-10
Posts: 71
Posted: Mon, 2005-07-25 19:34

Ah...thank you..
And how I can guarantee that the IDs of my website-users and the IDs of the gallery2-users agrees? Or isn't this recommended? Should I also hand over the hash procedure (md5) ?

 
ActiveNight

Joined: 2005-07-10
Posts: 71
Posted: Mon, 2005-07-25 19:59

Getting this error:

Quote:
Error (ERROR_BAD_PARAMETER)
in modules/core/classes/GalleryEmbed.class at line 291 (gallerystatus::error)
in /srv/www/htdocs/web4/html/neu/g2register.php at line 25 (galleryembed::createuser)

:(

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Mon, 2005-07-25 20:12

id's don't have to be the same. g2 maps your users by their id (i assumed you have no user id in your website, thus i used the username as the id in the above code snippet) with the g2 users.

as the error says, bad parameter = wrong usage.

take a look at the existing integrations, take a look at modules/core/classes/GalleryEmbed.class.