/** * Returns a shared instance of the eZCollaborationProfile class * pr user id. * note: Transaction unsafe. If you call several transaction unsafe methods you must enclose * the calls within a db transaction; thus within db->begin and db->commit. * * @param int|false $userID Uses current user id if false. * @return eZCollaborationProfile */ static function instance($userID = false) { if ($userID === false) { $user = eZUser::currentUser(); $userID = $user->attribute('contentobject_id'); } $instance =& $GLOBALS["eZCollaborationProfile-{$userID}"]; if (!isset($instance)) { $instance = eZCollaborationProfile::fetchByUser($userID); if ($instance === null) { $group = eZCollaborationGroup::instantiate($userID, ezpI18n::tr('kernel/classes', 'Inbox')); $instance = eZCollaborationProfile::create($userID, $group->attribute('id')); $instance->store(); } } return $instance; }