Re: How to retrieve a user's full name
Michael J Rubinsky <[email protected]> Sun, 08 Jan 2017 17:17:36 +0000
| Newsgroups | gmane.comp.horde.devel |
|---|---|
| Message-ID | <20170108171736.Horde.F9N9GXkh6f2ETYS3o7yRsOl@h4.theupstairsroom.com> |
Quoting Sebastian Birnbach <[email protected]>: > I am trying to retrieve a user's name from Horde. The particular user I am > testing has two identities and two full names in the preference pane (in my > case ' Dr. Jekyll' and 'Mr. Hyde'). > > To my understanding, the full name in the currently active identity should > be retrievable through $prefs->getValue('fullname'), but this returns an > empty string. The same is true for $prefs->getValue('id'). This is not correct. You need to use the Horde_Prefs_Identity object, not the Horde_Prefs object. I.e., $identity = $GLOBALS['injector']->getInstance('Horde_Core_Factory_Identity')->create(); $name = $identity->getName(); // User's default identity. or $name = $identity->getName($identity); where $identity is one of the user's identities. > $prefs->getValues('identities') returns a longer string that contains the > desired information, but embedded in an unknown structure: > a:3:{i:0;a:7{s:16:"default_identity";i:0;s:9:"from_addr";s:0:"";s:8:"fullname";s:0:"";s:2:"id";s:18:"Standardidentität";s:10:"identities";s:6:"a:0:{}";s:10:"properties";N;s:8:"location";s:0:"";}i:1;a:4:{s:2:"id";s:6:"Jekyll";s:8:"fullname";s:10:"Dr. > Jekyll";s:9:"from_addr";s:0:"";s:8:"location";s:0:"";}i:2;a:4:{s:2:"id";s:4:"Hide";s:8:"fullname";s:8:"Mr. > Hide";s:9:"from_addr";s:0:"";s:8:"location";s:0:"";}} > > What is the preferred way of obtaining the full name of the current user? > > > Sebastian > -- > dev mailing list > Frequently Asked Questions: http://wiki.horde.org/FAQ > To unsubscribe, mail: [email protected] -- mike The Horde Project http://www.horde.org https://www.facebook.com/hordeproject https://www.twitter.com/hordeproject -- dev mailing list Frequently Asked Questions: http://wiki.horde.org/FAQ To unsubscribe, mail: [email protected]
smime.p7s
(application/pkcs7-signature, 3.2 KB) - not displayed