Problem creating content object

Author Message

Thomas Negeli

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:

  1. $ezpublishUser = eZUser :: fetchByName('externalUserName')
  2. $contentObject = eZContentObject::fetch($ezpublishUser->attribute('contentobject_id'));
  3. $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):

  1. $contentObject = eZContentFunctions :: createAndPublishObject($params);
  2. $existUser = eZUser::fetch($contentObject->attribute('id'));
  3. $existUser->setAttribute('login', $login);
  4. $existUser->setAttribute('email', $imagineUser['email'] );
  5. $existUser->setAttribute('password_hash', md5($password) );
  6. $existUser->setAttribute('password_hash_type', eZUser::PASSWORD_HASH_MD5_PASSWORD );
  7. $existUser->store();

I tried

  • eZContentCacheManager :: clearObjectViewCache( $contentObject->attribute('id') );
  • eZContentCacheManager :: clearAllContentCache(true);

but it didn't change anything. Any idea?

Cheers

Thomas

Thomas Negeli

Tuesday 02 March 2010 4:57:10 am

News: if I edit the data of a user in the backend, I can display all data in the frontend correctly.

Only my selfcreated users are not displayed correctly.

Why this?

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.