Hello. I searched all over for this but couldn't find anything.
I'm working on the Gallery 2.2 CB plugin (created by Martin Lc). I've got all the bugs worked out except for one...
To be brief, I'm having an issue with guests in Joomla versus guests in Gallery 2. In G2, a guest actually has a g_id (i.e.,'5'). However, in a standard Joomla installation, guests have no id mapping (i.e., null or empty).
Here is the code I have thus far:
function getUserId($uid){
if(!file_exists('components/com_gallery2/init.inc')){
return _G2BRIDGE_GALLERYNOTINSTALLED;
}
/* setup base */
require_once('components/com_gallery2/init.inc');
/* first check init and plugin */
core::initiatedG2();
if(!core::isInitiated() || !core::isModuleActive('useralbum')){
return null;
}
/* check user */
$ret = GalleryEmbed::isExternalIdMapped($uid, 'GalleryUser');
if($ret && $ret->getErrorCode() & ERROR_MISSING_OBJECT){
/* user doesn't exist or isn't synced */
return null;
}
/* get the Gallery 2 user */
list($ret, $user) =
GalleryCoreApi::loadEntityByExternalId($uid, 'GalleryUser');
if($ret){
return null;
}
return $user->id;
}
As you can see, the code has a logic error in that it does not deal with the Joomla guest situation. How do I do the guest mapping? Thanks for the help!
Regards,
Brat.
Posts: 50
No help needed. I worked out the code myself, thanks.
Posts: 32
Hi Brat,
would you mind sharing your code with us? I soon will have the same problem ...
TIA birdie60
Posts: 50
Whoops! Sorry, I've been in and out for a while and am just now getting back to posting (busy, busy, busy).
I've attached my current working CB plugin. It works with G2.2.2 and G2.2.3 (at least it's held up so far). As I mentioned earlier, this is really a fixed version of an already existing plugin, so feel free to improve as needed.
Hope this helps!
Regards,
Brat.