MainWP Community

Automating user management on child sites

Hi all,

Hope all is well – what a crazy year it has been!

Appreciate if you could point me in the right direction to achieve this:

  • We have a web application
  • We have MainWP (self hosted)
  • We have MainWP child sites

We want the web application to send a request to MainWP in regards to a specific child site (or all) to:

  • Create a new WordPress admin account
  • Update a WordPress admin account

The reason we are doing this is we regularly need to create new accounts and share the logins with people and we don’t want to keep doing it manually.

Thank you

Hi @WPLover, if I understand your requirement correctly, this would require coding a custom extension. Basically, your web app should send request to your dashboard, the custom extensions gets request and creates new user(s) on your child sites.

1 Like

Hi @bogdan

Thanks for sharing

At first look at the documentation (codex) it seemed that it only covers how to work with the MainWP dashboard.

Then I found out that the extension tutorial shows us how to work with the child sites.

From there I can see how to build an extension that would do what we need – but only if accessed through the MainWP dashboard.

Appreciate any tips on how we can make it a remotely accessible URL and any tips on the authentication?

Example:

  • Web application sends an authenticated request (logged into WordPress and able to send requests to MainWP) to MainWP
  • MainWP fires the extension function we created
  • MainWP returns response

Thank you!

I would like to share that I was finally able to get it done!

How?

  • Using WP REST API to register a new API route on WordPress
  • Using MainWP custom extension to create the account
  • Combining both together we are now able to remotely create accounts on child sites

This was fun!

Thank you

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Wow, very nice solution. Thanks for sharing it. I am very happy to see that you were able to get this done.

1 Like