There was a requirement from client where he wants validation based on user role. So we need to check login user (current user) role name and put validation on it. This can be achieved by using below simple steps.
we can get the current user role using the following code,
global $current_user; include_once(‘modules/ACLRoles/ACLRole.php’); $ACLRole = new ACLRole(); $roles = $ACLRole->getUserRoleNames($current_user->id); echo "<pre>"; print_r($roles);
Hope you find this blog post helpful.
Feel free to add comments and queries, that helps us to improve the quality of posts.
You can contact us at firstname.lastname@example.org