1283 Posts
Bucklash
5 years ago
3
Topic

Hi Klas

In the standard user form...

Using afterstore...

I have no joy when trying to update a different users data

$content = JCckContentUser::getInstance(441); <- a different user to current one
$content->setProperty( 'gender', 'C' )->store(); <- an example of trying to save something

Nothing happens.

Do you get same result?

Get a Book for SEBLOD
1283 Posts
Bucklash
5 years ago
0
Level 1
  • I can edit my own details, so...
  • ...perhaps on the front end you can only manipulate your own user details (site and/or admin form) using the methods shown above?
    • Seems to be the case

...Is there a way to alter another user's data on the front end using Seblod's methods as shown above?

4229 Posts
Kadministrator
5 years ago
1
Level 1

Current user needs to have edit permission on the content type your are storing. Current user is pulled from JFactory::GetUser, which gets it from JFactory::getSession()->get('user') , so you could use JFactory::getSession()->set('user') to replace current(most likely default) user with admin or desired id. Just don't forget to change it back to rpevious user object after store or from that moment on current user will have admin rights. Haven't tested, but should work.

1283 Posts
Bucklash
5 years ago
0
Level 2

Ok thanks, very helpful

Jon

Get a VIP membership