I have created some non admin users and given lead module access to that users. I have added one custom field in user module called “Member Type”. I have three different types of member type (A, B, C). I have added ‘before save’ hook in lead module and I want to do some functionality when lead is edited by user who have member type ‘A’. In hook I have used global $current_user for getting member type of logged in user. When I am saving lead record, it gives “you do not have permission to module” error. But when I am removing $current_user from code, lead saves properly with out any error. It is issue with accessing user module record. So how can I give access to user module to non admin user? or how can I get logged in user member type in lead hook? Please help.
How can I access logged in user details for non admin user?
Ok, i’m not quite sure the issue is access as you are saying the before_save works when you take out the current_user.
Does the script fail if you are logged in as a non admin person? Reason I’m asking is that ‘current_user’ will be set to THAT user when they do an action so you don’t need to do anything else. There is something else at play here… are you able to show your code?