We are using a field called myconnections to store the user_ids of a users connections so that we can we can pass the array via REST. We update it with a code action but it doesn't seem to be working and I can't see why. The result of the following code is that nothing is ever stored in the field;
$user_id = $user->id;
if($user_id){
$db = JFactory::getDBO();
$query = "SELECT id FROM #__comprofiler WHERE user_id = ".$user_id;
$db->setQuery($query);
$check_id = $db->loadResult();
if($check_id){
$query = "SELECT (REPLACE(REPLACE(asset,'.connection',''),'profile.','')) AS asset_user_id FROM #__comprofiler_plugin_activity WHERE user_id = ".$user_id;
$db->setQuery($query);
$cb_myconnections = $db->loadColumn();
if($cb_myconnections){ $cb_myconnections = implode('|*|',$cb_myconnections); }
$profile = new stdClass();
$profile->id = $check_id;
$profile->cb_myconnections = $cb_myconnections;
$db->updateObject('#__comprofiler', $profile,'id');
}
}