I have ascertained that passwords are getting corrupted when a user tries to save their profile or reset their password via the "Forgot Login?" method. Either way, once they do that, their password is NOT going to work (anymore). I did this by simply setting my password using the Joomla User Manager, going to the #__users table and copying my encrypted password into a text file, then editing my profile using the CB User Manager (in the back end...it doesn't matter; they both do the same thing) to set my password to the very same value, then going into the #__users table again and sure enough, the password was different. Sounds like an Auto Action issue, right?
So I unpublished all AA's that trigger off profile save. Some trigger onBeforeUserUpdate|onBeforeUpdateUser and some trigger After. After doing that I was able to save my profile and change my password with the CB User Manager and log back in. Then I published each of the AA's one by one until there was one left, all along the way confirming my profile changes were saving and I could log out and back into the site back end. So it has to be that AA, right? For fear of getting caught in that situation again, I did not republish that one. Instead, I am hoping you can examine that Code AA's PHP code and tell me if you see anything that could be a problem. I don't see it, but you know how that is after you've stared at something for a few days.
This AA is triggered off onBeforeUserUpdate or onBeforeUpdateUser. There are quite a few conditions to meet for this to even get executed, but I did not think those were relevant here (though the fact is requires an address change makes me wonder why the effect was so rampant).
Code:
// Get some handy functions
include_once (JPATH_SITE."/../../php-scripts/get-latlon.php");
$mydb = JFactory::getDbo();
$address = "[cb_address] [cb_city] [cb_state] [cb_zip]";
$coord= getlatlon($address);
if ($coord['status'] == "OK")
{
if (isset($coord['postal_code']))
$zipcode = $coord['postal_code'];
else
$zipcode = [cb_zip];
$mydb->setQuery("SELECT timezone from #__zipcodes WHERE zip=$zipcode");
$user->cb_tzone = $mydb->loadResult();
$user->cb_streetaddress = $coord['address'];
$user->cb_lat = $coord['lat'];
$user->cb_lon = $coord['lon'];
}
else $user->cb_lon = $coord['status'];
The file get-latlon.php has several functions that do different things related to Google Maps API. That entire set of functions has been thoroughly tested and is in use all over the site. So please do not focus on that. But I will explain what's going on here.
I have never been sure if CB AA's come equipped with a database object (e.g., $db), so I create $mydb here. I need it to lookup the timezone for the user's zipcode (cb_zip). It is not used to update anything. I send all the parts of the user's address into the getlatlon function, which does the Google API query and returns the pieces of information I need in an array, $coord. It's important that the zipcode be right or looking it up in my national zipcodes table won't work. So I default to using what Google gives me (postal_code), but if that's NULL (and that does happen), I have no choice but to resort to using the user-entered cb_zip.
Since this is an AA triggered off onBeforeUserUpdate, I can use the $user object to update the CB fields you see there using the values returned from getlatlon. If the result of getlatlon is that Google couldn't geocode the address, the status will not be OK, in which case I put that status into the cb_lon field so I can see what the error was (this almost never happens).
For whatever reason, publishing this AA keeps the profile save from completing AND WORSE YET,
IT CORRUPTS THE USER'S PASSWORD. Yep, it does. All I have to do is republish this and I can reproduce it in a heartbeat (OK, I haven't tried it but it happened every time before I unpublished all those AAs together and this is the only one left unpublished).
I would love to get some feedback on this, to get to the bottom of it. When I tested this code, I did not have the luxury of CB's variable substitution. The code works fine when I put hard-coded strings in. So something is going on with substitution. And no, that included file get-latlon.php does not use any substitution. It's used all over the site, not just in CB AA's.
This really hurts my head.
Bruce