User object returns with all data empty
Permalink
I am working with trying to get a custom Registration block working that I started about a year ago. I got most of my controller's code from concrete's single-page Register controller. When I submit the form, I get the following error "Fatal error: Cannot use object of type User as array in /var/www/html/mc-hosts/concrete/core/models/userinfo.php on line 534". The code that is supposed to process the registration is as follows;
The $u object is created with all data fields empty and therefore passing with the [uID] empty. I tried presetting the $u->uID = 0, which I understand is the ID of a user that is not logged in, but I still get this error. What am I not supplying to "UserInfo::register($u)"?
The following is the full data object, $u;
I am using concrete5.6.3.2
Any help I can get would be greatly appreciated. Thanks.
$u = new User(); $registered = UserInfo::register($u);
The $u object is created with all data fields empty and therefore passing with the [uID] empty. I tried presetting the $u->uID = 0, which I understand is the ID of a user that is not logged in, but I still get this error. What am I not supplying to "UserInfo::register($u)"?
The following is the full data object, $u;
I am using concrete5.6.3.2
Any help I can get would be greatly appreciated. Thanks.
Hello Thomas,
Sorry I didn't see this earlier, but the error you are getting is telling you the problem. It's expecting an array and you are trying to pass in a user object.
If you take a look at the 5.6 Users documentation page, you'll see that the $data passed in should be an array:
https://www.concrete5.org/documentation/developers/5.6/permissions/u...
Makes sense if you think about it, there is nothing to retrieve from the User object until the user has been added.
Maybe this will help with your new go at it,
John
Sorry I didn't see this earlier, but the error you are getting is telling you the problem. It's expecting an array and you are trying to pass in a user object.
If you take a look at the 5.6 Users documentation page, you'll see that the $data passed in should be an array:
https://www.concrete5.org/documentation/developers/5.6/permissions/u...
Add a User $newUserInfoObject = UserInfo::add($data) Where $data is an array that can contain o uName - the username. Required. o uEmail - Email address. Required. o uPassword - the non-encrypted password. o uIsValidated - Whether the email address has been validated. If not specified, -1 will be saved. o uIsFullRecord - Set to 1 unless set in the array to 0.
Maybe this will help with your new go at it,
John
thanks anyway to all who looked at my issue.