I need to make some custom fields added to the usermeta table read only when they are displayed in the user profile (specifically show users a membership number that is entered by an admin user which they cannot change).
Having failed to find a plugin that does this (Cimy user will, but has it’s own tables and I have to use wp_usermeta) I am wondering how to go about writing a plugin which would intercept output to the profile page, and IF the current user is NOT admin parse it to look for an input tag with a particular name, and then set the additional parameter disabled=”disabled” in the HTML code to make it non-editable.
<input type="text" name="member_number" id="member_number" value="000012" class="regular-text" />
<input type="text" name="member_number" id="member_number" disabled="disabled" value="000012" class="regular-text" />
Any help here much appreciated!
- The topic ‘Read only profile fields’ is closed to new replies.