I have started writing a custom plugin for WordPress to manage a custom login and registration form that will be made in vuejs.
I have this code that will at the moment only register the needed endpoints I need.
<?php
/*
* Plugin Name: Customers manager
*/
class CustomersManager {
public function __construct(){
add_action('rest_api_init', array($this, 'setup_endpoints'));
}
public function setup_endpoints(){
register_rest_route(
'customers/v1',
'/registration',
array(
'methods' => 'POST',
'callback' => array($this, 'create_new_customer')
)
);
register_rest_route(
'customers/v1',
'/login',
array(
'methods' => 'POST',
'callback' => array($this, 'login_customer')
)
);
}
}
?>
I need to add two custom roles, one that will be for customers and another that will be for some operators that will take care of activate users account. I want to create a method for this and based on the role I need to redirect the user to a custom area or to a single menu that will be in wordpress dashboard and that I will add using the dedicated hook. Is there any hook I can use for the custom roles and I need to call it inside the constructor?