E
E
Egor2014-09-29 11:07:01
PHP
Egor, 2014-09-29 11:07:01

How to change the value of a profile field in modx?

You need to change the value of the photo field for the user. I'm trying to do this:

global $modx;
$profile = $user->getOne('Profile');
$profile->set('photo', $sImage);
$profile->save();

Nothing comes out. What could be the error please.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrew Vakulenko, 2014-09-29
@pro100ShCoder

try like this:

$user = $modx->getObject('modUser',1); // 1 - user id 
$profile = $user->getOne('Profile');
$profile->set('photo', $sImage);
$profile->save();

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question