Mukesh Nandeda Dhakad
Mukesh Nandeda Dhakad

Reputation: 173

ParseQuery PHP SDK how to modify other user data

I am using parse PHP SDK, I want to update user data using administrator user. I am trying to update user information like this my code:

$query = new ParseQuery("_User");
$query->equalTo("username", "nanu44");
foreach ($result as $doc) {
    $doc->set('name', "new info");
    $doc->save();
}

But it is giving me an error that can not modify user data. Please suggest me

Upvotes: 0

Views: 282

Answers (1)

lipusal
lipusal

Reputation: 145

The Parse PHP documentation says:

Data stored in a ParseUser can only be modified by that user. By default, the data can still be read by any client.

A possible solution is to use your master key to override this security measure by doing

$doc->save(true) (documentation here),

or to edit User ACLs so you have write access to other users, though I'm not 100% sure this is possible with the User class; see the first link for more details.

Upvotes: 2

Related Questions