A
A
Axiniya2020-05-10 22:45:05
WordPress
Axiniya, 2020-05-10 22:45:05

How to create a sub account in WordPress?

There is a site with ready-made roles, you need to give the right to one of the roles to create child accounts from the my_account page.
I can't find a solution at all.
I will be glad to any advice.
Thank you.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
W
WP Panda, 2020-05-11
@wppanda5

I did so.
To the user with the super_manager role, I added a form with the addition of a user with the manager role. further in a separate table with user settings, in order not to store all this in user_meta, it saved each other's id and a unique hash.
To determine the child/parent pairing, each other's id and hash match are checked.

O
Orkhan Hasanli, 2020-05-11
@azerphoenix

Quite a non-trivial task, especially for CMS WP.
What is a subaccount in your understanding?
How is it different from a regular user account?
What sign will be a sign that this is a subaccount?
Here is my vision of all this:
- It is necessary to develop a functionality (for example, a plug-in) that will enable users with certain roles to add a user through a form. For the form, you can use the acf_form() capabilities
- When the form is completed and submitted to the backend, you also get the current user's id and write its value in the meta field for the new user you create from the submitted form. Those. a sign that this is a subaccount will be the id of the referrer (the user who created the subaccount).
It is somewhat reminiscent of an affiliate (referral program) "bring a friend and get ...", when each user can invite a user via a link and if he registers, he is additionally assigned a referrer id.
I don't think there is a ready solution for your problem. If you don’t know how to code, then I recommend contacting a freelance exchange. And if you know how, then I indicated the algorithm of work above.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question