Hi, guys,
I just wondered how am I supposed to login into Gallery using it's embed API. The problem is that regarding this:
http://gallery.menalto.com/apidoc/GalleryCore/Classes/GalleryEmbed.html#methodlogin
I need to pass a variable called $extUserId. I tried to pass id's (like 0,1,23,56), usernames (like 'admin', 'someuser', 'whatever'), random strings and number and I always got error. So do you have an idea what shout I pass as an $extUserId?
And how am I supposed to get/set the Active user because most of the methods require $activeUserId (probably I could get it after logging??).
Thanks in advance 
P.S.: Sorry if I posted it in a wrong category...
Posts: 2
Huh, I can't believe that nobody used the API for such functionality...
Posts: 16504
You're asking in the wrong place ;) I'm moving this thread to the Integration/Embedding Development forum.
Have you read the documentation also?
http://codex.gallery2.org/Development
http://codex.gallery2.org/Gallery2:Embedding
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here
Posts: 4342
From the documentation, it looks like $extUserId is the user id in the system into which Gallery is embedded (drupal, whatever) - see for instance the isExternalIdMapped function on the same page.
If you want to create an embedded session based on an internal Gallery username/userId you don't need to use the Embedded class. Just load the GalleryUser Entity using the id or username and send it to the (global) Gallery object's setActiveUser function:
global $gallery; list ($ret, $myUser) = GalleryCoreApi::loadEntitiesById($myUserId, 'GalleryUser'); if ($ret) { //die appropriately with user not found error . . . } $gallery->setActiveUser($myUser); //start session, Gallery::Login event here etc. . . .If you want to be picky you can start a session and send a 'Gallery::Login' event too - see GalleryEmbed::login(...) for code you can crib.
That would be my first approach to try, anyway.