Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add createUser method on ApiClient #55

Merged
merged 2 commits into from
Sep 25, 2024
Merged

add createUser method on ApiClient #55

merged 2 commits into from
Sep 25, 2024

Conversation

ashfame
Copy link
Member

@ashfame ashfame commented Sep 24, 2024

This PR adds a method to create the user, which would be authors in our use case. Currently not called from anywhere.

username, email and password are 3 required fields, but only details I can imagine we would have to work with, would be name + possibly a username at times. username is also not modifiable. A DB query is possible of course but it escapes me why it's recommended to not change/edit username.

Regardless this isn't a problem, since we can create temp users with whatever data we have. Afterwards the administrator can create new users with the right details and then just delete the ones created by us. At delete, WordPress prompts with the option of re-assigning all content attributed to the user being deleted to another user. So, it works out.

window.trywp.apiClient.createUser({ "username": "aa", "email": "[email protected]", "password": "aa", "roles":["author"], "firstname": "aaaa", "lastname": "kkkk" })

@ashfame ashfame self-assigned this Sep 24, 2024
@ashfame
Copy link
Member Author

ashfame commented Sep 25, 2024

@psrpinto & I discussed it would probably be best if user is prompted with author info to be filled out, after we have identified how many authors are there and already processed them. This could be a fitting thing for a "finalise import" step where we would potentially need to run a bunch of things after liberating data to make it fitting for a WP install - such as liberating media assets.

src/api/ApiClient.ts Outdated Show resolved Hide resolved
@ashfame ashfame merged commit 8ad484c into trunk Sep 25, 2024
3 checks passed
@ashfame ashfame deleted the create_user_method branch September 25, 2024 14:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants