I have created a custom role that I've named customer

public function setup_user_roles()
  add_role('customer', 'Customer', $customer_capabilities);
  add_role('moderator', 'Moderator', $moderator_capabilities);

I've used the plugin registration hook to add them and the capabilities are only read for the customer and only edit_users for moderator role. I need to give to users te ability to modify only their own profile informations and for modeartors the ability to approve accounts. Not sure if I need to add other capabilities to achive this, at the moment the two roles are added to wp roles and seems working as expected. What I need is to have the accounts of the customers not able to login until thay are approved from a moderator. I've added a custom meta field that will have the status pending, approved or rejected but how I can rely on it when users try to login? Is there a better way for this without an external plugin?


1 Answer 1


Actually Wordpress has ability to prevent user access without acceptation. You should uncheck "Anyone can register" on the /wp-admin/options-general.php

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.