Open Cory05 opened 3 years ago
I also have this error. Appears to be a bug. Not sure how else to update user details.
@Cory05 if you know the username of the user, you can build a query as a workaround.
var userQuery = new UsersQueryBuilder { Context = WordPressPCL.Models.Context.Edit, //another conditions }; var usersWithUsername = await client.Users.Query(userQuery, true);
You can then set the username and the field you are trying to edit and save the user.
I have just noticed that client.Users.Update(user); passes NULL as email.
There is no way to update a user at the moment.
I am trying to retrieve the email address of a user, but the email is always null. Could this may be related??
I am able to retreive a user. The username is always null, even though it is set in the WordPress site.
I am trying to retrieve the email address of a user, but the email is always null. Could this may be related??
WordPress only exposes a user's username and email address if context=edit
(see https://developer.wordpress.org/rest-api/reference/users/ for details).
This is related to https://github.com/wp-net/WordPressPCL/issues/266.
I am able to retreive a user. The username is always null, even though it is set in the WordPress site. Attempting to update any data with the user raises the error WPException: Invalid parameter(s): username. The code is pretty straight forward.
WordPressPCL.Models.User user = await client.Users.GetByID(21); user.NickName = "Jane Smithy"; await client.Users.Update(user);
Is this a bug?
Thanks.