I've searched the API docs, but can't seem to find what I need. Basically, I'm looking for a method that can be called from an embedding application to find out if a user has created any albums or uploaded any items. Something like GalleryEmbed::isUserHasContent($user)...
Does this exist? If not, any suggestions on how best to get this information? Many thanks.
Posts: 32509
fetchAllItemIdsByOwnerId() in GalleryCoreApi
1. call GalleryEmbed::init with fullInit
2. call GalleryCoreApi:fetchAllItemIdsByOwnerId
Posts: 23
Thanks! In between those two steps, though, I need to fetch the gallery user id by the external user id. I know how to use GalleryEmbed::getExternalIdMap(), but that seems rather heavy-handed. Is there an easier way?
Posts: 32509
no, it's IMO reasonably easy. 3 function calls.. if we had a GallerEmbed wrapper for the whole thing it would be reduced to 2 function calls for you, but in the background it would do the same 3 function calls.
Posts: 23
You're right, it is easy. When I said heavy-handed, though, I mean that the getExternalIdMap seems to return the entire contents of the ExternalIdMap table, which in my case has over 3000 rows. It seems like it would be much more efficient to just select the single value that I need, especially since the query can use a pk index.
I can implement this code quite easily in the embedding app, but my concern is what happens if/when a Gallery update changes the database structure and this no longer works. That's why I'd be more comfortable using the Gallery API, if it were available.
Is this something that others might benefit from? I'd be happy to attempt a patch, if you think this is something that deserves a spot in the API.
Anyway, thanks for your help.
Posts: 32509
there's already
GalleryCoreApi::loadEntityByExternalId to load the user by your external id.