WordPress.org

Ready to get started?Download WordPress

Forums

Read only profile fields (4 posts)

  1. iaeon
    Member
    Posted 2 years ago #

    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!

  2. iaeon
    Member
    Posted 2 years ago #

    I probably have to do this for more than one field!

  3. rcostica
    Member
    Posted 2 years ago #

    I'd love to see an answer to this problem as well.

    Thank you in advance!

  4. iaeon
    Member
    Posted 2 years ago #

    User Meta plugin now supports this so may do the trick for you.

Topic Closed

This topic has been closed to new replies.

About this Topic