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.
<h2>requirements</h2>
<ul>
<li>only users with admin role</li>
<li>can create/edit extra user profile field </li>
<li>for all other users</li>
</ul>
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
<ul>
<li><a href="http://justintadlock.com/archives/2009/09/10/adding-and-using-custom-user-profile-fields" rel="nofollow noreferrer">Adding and using custom user profile fields</a></li>
<li><a href="http://yoast.com/user-contact-fields-wp29/" rel="nofollow noreferrer">User Contact Fields in WordPress 2.9</a></li>
<li><a href="http://andrewferguson.net/2006/05/16/add-data-to-user-field-in-wordpress/" rel="nofollow noreferrer">Add Data to User Field in WordPress</a></li>
</ul>
It seems to me that <a href="http://justintadlock.com/archives/2009/09/10/adding-and-using-custom-user-profile-fields" rel="nofollow noreferrer">Adding and using custom user profile fields</a> is almost what I want to do but I still do not know how to manage the "only admin' can do that.
<h2>requirements</h2>
<ul>
<li>only users with admin role</li>
<li>can create/edit extra user profile field </li>
<li>for all other users</li>
</ul>
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
<ul>
<li><a href="http://justintadlock.com/archives/2009/09/10/adding-and-using-custom-user-profile-fields" rel="nofollow noreferrer">Adding and using custom user profile fields</a></li>
<li><a href="http://yoast.com/user-contact-fields-wp29/" rel="nofollow noreferrer">User Contact Fields in WordPress 2.9</a></li>
<li><a href="http://andrewferguson.net/2006/05/16/add-data-to-user-field-in-wordpress/" rel="nofollow noreferrer">Add Data to User Field in WordPress</a></li>
</ul>
It seems to me that <a href="http://justintadlock.com/archives/2009/09/10/adding-and-using-custom-user-profile-fields" rel="nofollow noreferrer">Adding and using custom user profile fields</a> is almost what I want to do but I still do not know how to manage the "only admin' can do that.