New Module Help - accessing user names and email addresses

azflyer

Joined: 2005-10-24
Posts: 7
Posted: Mon, 2005-10-24 05:47

Hello,

I'm in the process of writing a new module and I need a little help.

In my module.inc during a handleEvent function, I need to access userid names and email addresses. Does anyone know how this is done?

Thanks

 
azflyer

Joined: 2005-10-24
Posts: 7
Posted: Tue, 2005-10-25 01:59

Anyone know the answer to this?

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Tue, 2005-10-25 04:16

if you're handling GalleryEntity::save / ::delete events for GalleryUser entities, then you first have to get the entity from the event and then call $entity->getEmail() or $entity->getId() to get what you want.
please see the "developers" and the "documentation" link in the upper right corner.

 
azflyer

Joined: 2005-10-24
Posts: 7
Posted: Tue, 2005-10-25 15:42
valiant wrote:
if you're handling GalleryEntity::save / ::delete events for GalleryUser entities, then you first have to get the entity from the event and then call $entity->getEmail() or $entity->getId() to get what you want.
please see the "developers" and the "documentation" link in the upper right corner.

Hi,

Thanks for the reply. I have gone through the documentation and haven't had any luck finding this particular answer. Otherwise the doumentation has been very helpful to me.

I have much of the new module working great by following the docs and other modules as examples.

What I'm actually doing is writing a notification module so when new albums or items are added to albums a notification goes out to users that have a notification flag turned on and notifications are turned on within the album settings or parent album settings. This feature is something that I wrote into Gallery 1.x which I'm still using to date and it works great. I want to move to Gallery 2 but need to have this functionality.

So during:

function handleEvent($event) {
$album = $event->getEntity();
if (GalleryUtilities::isA($album, 'GalleryItem') &&
$album->testPersistentFlag(STORAGE_FLAG_NEWLY_CREATED)) {

I need to go through all the users and grab names and email addresses of the users who have the new item notification flag turned on.

I hope that makes sense.

Thanks for your help.

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Tue, 2005-10-25 16:08

have you seen the other notification module discussion?
http://gallery.menalto.com/node/38700

maybe you two could work together. and if not, there are some tips for you in the other topic.