the last version of the user object is represented in the database
an older version ends up in the database
Joomla! 3.7 - Beta 1
It seems like the JUser::getInstance method caches the user by id. If you do save an user by using JUser::save some onUserAfterSave methods are executed. On of them belongs to the plgSystemFields. It tries to get the user by id. This works for the first time. After you modified the user object a second time somewhere else, it retrieves the old version from the cache and pushes it to the database.
May screenshot shows an example. The first step tries to save some basic data to the user and the second the address data. The latter is missing in the database afterwards.
Category | ⇒ | com_users |
Status | New | ⇒ | Information Required |
@franz-wohlkoenig seems like this issue was resolved.
Here is my test code:
$user = JFactory::getUser();
echo "<br>foo=" . $user->getParam('foo');
echo "<br> foo2=". $user->getParam('foo2');
$user->setParam('foo', 'bar');
$user->save();
$user->setParam('foo2', 'bar2');
$user->save();
The second run renders both values as expected.
Status | Information Required | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2017-04-05 18:41:08 |
Closed_By | ⇒ | svenbluege |
@svenbluege can you please confirm Issue on latest Staging?
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/13926.