Should be a quick one for most modxers out there but i just haven’t been able to figure this one out.
I’ve got a user setting for each user named “active_survey_id” and i’m failing to be able to update this on form post in my snippet.
I’ve been messing around with various bits of codes i’ve been able to find on various sites. It’s actually been really difficult to get information regarding this. Should i be using something else to house settings that are changed for individual users?
Please put me out of my misery!
if(isset($_POST['idProject'])) {
$postedSurvey = $_POST['idProject'];
echo "$postedSurvey";
//$profile = $modx->user->getOne('Profile');
//$fields = $profile->get('extended');
//$fields['active_survey_id'] = '10';
//$profile->set('extended', $fields);
//$profile->save();
$setting = $modx->getObject('active_survey_id');
$setting->set('active_survey_id', $postedSurvey);
$setting->save();
//echo "$userSurvey";
//var_dump($fields);
//$newId = $modx->getObject('active_survey_id');
//$newId->set('value', '3');
//$newId->save();
}
I’ve checked out the following page and it didn’t seem to help me:
Modx User Settings