WordPress.org

Support

Support » Plugins and Hacks » Read only profile fields

Read only profile fields

  • 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.

    e.g.
    <input type="text" name="member_number" id="member_number" value="000012" class="regular-text" />
    would become
    <input type="text" name="member_number" id="member_number" disabled="disabled" value="000012" class="regular-text" />

    Any help here much appreciated!

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Read only profile fields’ is closed to new replies.