Hi,
Enrique Jiménez Ruiz schrieb:
First, I try to use it:
$GLOBALS[‘phpgw_info’][‘user’][‘groups’]
$GLOBALS[‘phpgw_info’] was never supported in EGroupware, it has to be
$GLOBALS[‘egw_info’], thought I never seen ‘groups’.
ralfbecker_dr schrieb:
This entry is not set by the api. As var as I can remember, it was never
set.
Then pretty PLEASE remove the relevant API documentation at
https://community.egroupware.org/index.php?wikipage=ApplicationDevelopmentGuide%2FConfigurationVariables
!!!
“User information
(…)
$GLOBALS[‘egw_info’][‘user’][‘groups’] = Groups the user is a member of
”
It drove me absolutely bonkers trying to find this seemingly (!!!)
well-documented entry, which was, as you say, never even there…
The primary group is set in $GLOBALS[phpgw_info][user][primary_group]
No it isn’t.
Well, this might be old behaviour (‘phpgw_info’!), so I looked further.
In another of your (i.e. ralf’s) forum answers ( see
http://www.egroupware.org/forum#nabble-td691460 ) I found the following:
$memberships =
$GLOBAL[‘egw’]->accounts->memberships($GLOBALS[‘egw_info’][‘user’][‘account_id’]);
and
$members = $GLOBAL[‘egw’]->accounts->members(‘xyz’,true);
respectively, which look good, because they use ‘egw’ and ‘egw_info’.
But still to no avail - both give me this error:
“Fatal error: Call to a member function memberships() on a non-object in
/(…)/egroupware/timesheet/inc/class.timesheet_ui.inc.php on line …”
That’s really wired, $GLOBALS[‘egw’]->accounts gets automatically
instanciated since quite some time. What EGroupware version are you using?
(I removed the non-relevant part of the path and the line number)
What’s the matter here, why does this not work?
And why must it be so cumbersome to find out something as simple as group
memberships?
$memberships = $GLOBAL[‘egw’]->accounts->memberships(
$GLOBALS[‘egw_info’][‘user’][‘account_id’], true);
// true = return just array of account_id’s instead of account_id =>
account_lid pairs
That’s definitely right code! Somethings really wrong or outdated on
your system, if that’s not working.
Ralf
Ralf Becker
Director Software Development
Stylite AG
Morschheimer Strasse 15 | Tel. +49 6352 70629 0
D-67292 Kirchheimbolanden | Fax. +49 6352 70629 30
Email: rb@stylite.de
www.stylite.de | www.egroupware.org
Managing Directors: Andre Keller | Ralf Becker | Gudrun Mueller
Chairman of the supervisory board: Prof. Dr. Birger Leon Kropshofer
VAT DE214280951 | Registered HRB 31158 Kaiserslautern Germany