I'm developing a custom plugin in PHP so existing plugins are not usable. What I want to achieve is that I want to display different url within a post for some users . For users that are registered in wordpress, contacted me and are 'approved'. I want to set up this extra user profile field so I can use this field in a condition. So guests and users without this field or without the right value in this field will get url1 but the other ones url2.
requirements
- only users with admin role
- can create/edit extra user profile field
- for all other users
I know how I can add extra user profile field in Wordpress (see the links below), but I don't know how to restrict editing that field to users in a given role and how user with admin role can create/edit this filed for all users. It seems to me that I have to add new code under wordpress dashboard/users/new user and/or dashboard/users/authors & users.
I did some google search and found few sites on how to add extra user profile field
- Adding and using custom user profile fields
- User Contact Fields in WordPress 2.9
- Add Data to User Field in WordPress
It seems to me that Adding and using custom user profile fields is almost what I want to do but I still do not know how to manage the "only admin' can do that.