ZenphotoCMS Forum
Getting user name - Printable Version

+- ZenphotoCMS Forum (https://forum.zenphoto.org)
+-- Forum: Support (https://forum.zenphoto.org/forum-1.html)
+--- Forum: General support (https://forum.zenphoto.org/forum-4.html)
+--- Thread: Getting user name (/thread-12271.html)



Getting user name - n20capri2 - 2015-08-18

I'm doing some custom stuff for a client where logged in users are able to select certain things then submit. Their selection then goes to the DB and an email is sent to client.

I've got everything except I can't figure out how to grab their username. Right now I'm hard coding it for testing - Doesn't even have to be username - ID or email address would work too.

Please help,
Thanks,
Mike




Getting user name - acrylian - 2015-08-18

THe object of the current logged in user is availabe in the global variable $_zp_current_admin_obj. The object is from the Zenphoto_Administrator class:
http://www.zenphoto.org/documentation/classes/_lib-auth.php.html

To get a specific user use $userobj = Zenphoto_Authority::newAdministrator("', 1);




Getting user name - fretzl - 2015-08-18

I think you're looking for something like this:

`

`
This gets the User name of the current logged-in user.




Getting user name - acrylian - 2015-08-18

Right ;-) The naming of methods is a bit confusing as there is also a method getName() which actually refers to the optional "full name" and not the "user name".




Getting user name - n20capri2 - 2015-08-24

Cool I got it. Thanks guys. Now I'm having an issue with Safari only where the user gets logged out when I "add" something to a cart. (but they are really still logged in) It appears as if hitting the add button adds the www to the url bar and safari doesn't like this. If I manually remove the www I'm back to being logged in.

On the other hand IE works perfectly as-is...but if I manually remove the WWW it shows as if I'm logged out...but again really logged in...No issues there because it works fine as-is. But for some reason Safari is being weird...Mozilla works fine either way

Is this a DNS, WWW vs no WWW issue?

Any ideas are welcome...Everything else is perfect except this little issue. As it turns out both partners use MAC's so I kind of have to get this straightened out! lol

Thanks,
Mike




Getting user name - acrylian - 2015-08-25

Since the cart you are using is not Zenphoto I would look for the issue there. Maybe a config issue of the cart?




Getting user name - n20capri2 - 2015-08-26

It's completely custom. Turned out to be a relative path issue that only Safari didn't like. It's all straightened out now.

Thanks again