Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-13415

user/register adding node assignment for DefaultUserPlacement outside database transaction

    XMLWordPrintable

Details

    Description

          $contentObject = $class->instantiate( $userCreatorID, $defaultSectionID );
          $objectID = $contentObject->attribute( 'id' );
      
          // Store the ID in session variable
          $http->setSessionVariable( "RegisterUserID", $objectID );
      
          $userID = $objectID;
      
          $nodeAssignment = eZNodeAssignment::create( array( 'contentobject_id' => $contentObject->attribute( 'id' ),
                                                             'contentobject_version' => 1,
                                                             'parent_node' => $defaultUserPlacement,
                                                             'is_main' => 1 ) );
          $nodeAssignment->store();
      

      should be in a database transaction.

      There's more... setting is_enabled attribute and adding verification code should also be in a transaction I think:

                      // Disable user account and send verification mail to the user
                      $userSetting = eZUserSetting::fetch( $user->attribute( 'contentobject_id' ) );
                      $userSetting->setAttribute( 'is_enabled', 0 );
                      $userSetting->store();
      
                      // Log out current user
                      eZUser::logoutCurrent();
      
                      // Create enable account hash and send it to the newly registered user
                      $hash = md5( time() . $user->attribute( 'contentobject_id' ) );
                      $accountKey = eZUserAccountKey::createNew( $user->attribute( 'contentobject_id' ), $hash, time() );
                      $accountKey->store();
      

      Attachments

        Activity

          People

            cyberwolf cyberwolf
            cyberwolf cyberwolf
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: