Users can't edit profile

6 years 11 months ago - 6 years 11 months ago #293966 by Cluster89
Replied by Cluster89 on topic Users can't edit profile
In user.php bind is
if (array_key_exists('params', $array))
		{
			$this->_params->loadArray($array['params']);
but why loadarray and not loadstring it is a string inside. If i replace with loadString everyting is fine.
array params is always stored in _params.
So the LDAP plugin is probably not acting acoordingly on usersave to handle the params and onuserbeforesave is just too late.

Please Log in to join the conversation.

6 years 11 months ago #293981 by krileon
Replied by krileon on topic Users can't edit profile
Should never be an issue assuming API calls are used at all times. Accessing and parsing ->params with JSON encode or decode functions will cause issues like this. Either needs to be done through a Registry object or just properly call the getParam/setParam functions as needed. I've no idea what the LDAP plugin is doing in regards to params.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.
The following user(s) said Thank You: Cluster89

Please Log in to join the conversation.

6 years 11 months ago #293985 by Cluster89
Replied by Cluster89 on topic Users can't edit profile
Hello,
and do you know confirmed that the CB profile save works fine with other third party params?
Because to me it looks like UserTable::load is called and loads the row (including the params).
Then UserTable::bindSafely is called, which calls $row->bind( $postCopy ); which executes the piece above, while in params is still the raw string from the db (which should not be there). So I am not sure if extensions have a chance to act between those 2 calls.
However when UserTable::store is finally called, _mapUsers(); loads the cms user and the params again and put them correctly in _params, but it is fine there anyways because the bindSafely has already been called. And the actual cms store cares only for _params (which is corrupted if the above code gets executed with the raw string in params). So it looks like params should not be loaded at all in UserTable::load or be erased there at least it works in my case.

Please Log in to join the conversation.

6 years 11 months ago #293998 by krileon
Replied by krileon on topic Users can't edit profile
We've no issues with other plugins extending params. ->params is always supposed to be a raw string. There is never a case where it shouldn't be. ->_params is the Registry object of ->params and is what getter and setter function calls are made against. ->_params is populated during ->load of the Joomla user object, during binding, or during storage. For CB the binding of ->params to ->_params happens at time of bind or store since we don't use a Joomla user ->load (it's called indirectly). You can see this if you var_dump $this during bindSafely or saveSafely.

Review your LDAP plugin and see what it's doing to $user during the onUserBeforeSave event to see what could be going wrong.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.
The following user(s) said Thank You: Cluster89

Please Log in to join the conversation.

6 years 11 months ago - 6 years 11 months ago #294011 by Cluster89
Replied by Cluster89 on topic Users can't edit profile
Hello and thanks again.
But the thing is onUserBeforeSave is called too late.
$this->_cmsUser->save(); in UserTable::store ends up calling it.
But bindSafely is called before and has already corrupted it at this point.
I agree params should always be raw string and is, that is why $this->_params->loadArray($array); (called inside bindSafely) is corrupting it. It puts into _params a [0] index with the whole string, which is where the growing wrong string is coming from. Akward that joomla uses loadarray there if it is always a string. Do you know any other plugin that uses params on users so I can check why it is working in other cases

Please Log in to join the conversation.

6 years 11 months ago #294014 by krileon
Replied by krileon on topic Users can't edit profile
The bindSafely is only called on a POST case and it binds the params to it there where params in POST is always an array. Do you have the user params field turned off in CB > Field Management? It maybe null case being the issue here. If something is modifying POST or modifying the user object before binding and converting it to a string that's where you'll get a problem like this though.

You need to look into what the LDAP plugin is doing to the user object to begin with. If during binding the LDAP plugin converts it to a string then yes you'll likely have it infinitely creating a nested array which is then JSON encoded. For the LDAP plugin to extend parameters during that trigger all it has to do is a ->setParam. It should do nothing else to params.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.
The following user(s) said Thank You: Cluster89

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.218 seconds

Facebook Twitter LinkedIn