Tuesday 02 March 2010 12:55:12 am
Hi Community, I have a problem creating content objects in the users area. I have to dynamically create user objects, because authentication runs via an external third party system. This works by now. I can create the users in eZPublish with the data filled automatically and than view them in the admin siteaccess, so to say in the backend. The data is displayed correctly. When I want to access the same user data in the frontend I only get displayed parts of the data from the user. I can for example read his first_name, last_name and useraccount attributes. But I can't access additionall attributes I have crated for the user class (landline (string), fax (string), bill_data (Matrix), ...). They are there, but an Integer Attribute for example always is 0. The strange thing is, that I can read all this additional attributes in the admin siteaccess with the right data, so I think I have created everything right so far. What I do is the following:
- $ezpublishUser = eZUser :: fetchByName('externalUserName')
- $contentObject = eZContentObject::fetch($ezpublishUser->attribute('contentobject_id'));
- $dataMap = $contentObject->attribute('data_map');
At this point I think I can access the attribute I have crated ('imagine_user_id') via
- $imagineUserId = $dataMap['imagine_user_id']->attribute('data_int');
but it is always 0 in the frontend. The right value is displayed in the backend. I have created the user before with the following lines ($params need to be right because the user is created correctly):
- $contentObject = eZContentFunctions :: createAndPublishObject($params);
- $existUser = eZUser::fetch($contentObject->attribute('id'));
- $existUser->setAttribute('login', $login);
- $existUser->setAttribute('email', $imagineUser['email'] );
- $existUser->setAttribute('password_hash', md5($password) );
- $existUser->setAttribute('password_hash_type', eZUser::PASSWORD_HASH_MD5_PASSWORD );
- $existUser->store();
I tried
- eZContentCacheManager :: clearObjectViewCache( $contentObject->attribute('id') );
- eZContentCacheManager :: clearAllContentCache(true);
but it didn't change anything. Any idea? Cheers Thomas
|