Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow ezuser datatype fromString to be used for updates #109

Merged
merged 1 commit into from Sep 1, 2011
Merged

Allow ezuser datatype fromString to be used for updates #109

merged 1 commit into from Sep 1, 2011

Conversation

peterkeung
Copy link
Contributor

When creating a user, it's important to make sure there isn't an existing user with the same username or e-mail address (when RequireUniqueEmail is enforced). However, when updating a user, this limitation should be lifted if the match is on the user that you're trying to update.

@andrerom
Copy link
Contributor

andrerom commented Sep 1, 2011

This probably fixes this one doesn't it?
http://share.ez.no/forums/developer/problems-with-attributes-of-the-user-datatype-in-ezcontentfunctions

That is if you actually use updateAndPublishObject for this.

@peterkeung
Copy link
Contributor Author

That is the thread that reminded me to submit this pull request, actually.

andrerom added a commit that referenced this pull request Sep 1, 2011
Allow ezuser datatype fromString to be used for updates
@andrerom andrerom merged commit 75b247a into ezsystems:master Sep 1, 2011
@andrerom
Copy link
Contributor

andrerom commented Sep 1, 2011

Thanks, merged :)

@nfrp
Copy link
Contributor

nfrp commented Sep 1, 2011

Thanks Peter & Andre !

@skrosoft
Copy link
Contributor

It seems there is a problem with the serialized draft present in the data_text attribute. Data are saved when calling the fromString function but is written back to the previous value when attribute->store() is called.

I solved this like that:

$user->setAttribute('email', $email); // change the email in the ezuser table
$user->store();

$contentObject = $user->contentObject();
$dataMap = $contentObject->dataMap();
$userDataMap = $dataMap['user'];
$userDataMap->setAttribute('data_text', ''); // empty the serialized data
$userDataMap->store(); // auto generation of new serialized data using the previously saved ezuser

// increment the version control
$result = eZContentFunctions::updateAndPublishObject( $contentObject, array('attributes' => array('user' => "$login|$email")) );

peterkeung pushed a commit to peterkeung/ezpublish that referenced this pull request Oct 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants