• This topic had been closed, but I have new information to contribute.
    One issue is that the “website” field can’t be removed.
    You may have to use jQuery to hide it.
    Here is an example:

    // hide things we don't want:
    $(".form-table:first").hide();
    $(".form-table:last tr:first").hide();
    $("h3:first").hide();
    // hide them using the eq pseudoselector, which starts counting at 0 rather than 1
    $(".form-table:eq(1) tr:eq(4)").hide();
    $(".form-table:eq(1) tr:eq(5)").hide();
    $(".form-table:eq(2) tr:eq(1)").hide();

    This hides the fields here and there– I’m basically hiding the first table, the first row of the last table, and the first H3 tag. Then using the EQ pseudoselector, various other fields rows are hidden, one of which is the website field. Of course this will break at some point if the User Info tables are changed, but nothing in the world is guaranteed. (It sure would be nice if the inputs all had labels in this layout.)

    I also used another hack to add some additional input fields, “comments” and “internal_comments” — but they showed up as regular text inputs. So below is some jquery to change them into textareas, which are more useful. Apparently, though, the returns in the textareas are turned into spaces.

    var commentsbox = $("#organization");
    commentsbox.replaceWith('<textarea id="'+commentsbox.attr('name')+'" name="'+commentsbox.attr('name')+'">' + commentsbox.attr('value')+ '</textarea>');
    var commentsbox = $("#comments");
    commentsbox.replaceWith('<textarea id="'+commentsbox.attr('name')+'" name="'+commentsbox.attr('name')+'">' + commentsbox.attr('value')+ '</textarea>');
    var commentsbox = $("#internal_comments");
    commentsbox.replaceWith('<textarea id="'+commentsbox.attr('name')+'" name="'+commentsbox.attr('name')+'">' + commentsbox.attr('value')+ '</textarea>');

Viewing 2 replies - 1 through 2 (of 2 total)
  • Anders

    (@seananders1227)

    Good solution, beyond me why these fields don’t have unique classes.

    Thread Starter bkjproductions

    (@bkjproductions)

    Below is some code that one could use as a starter.
    When you add the action to enqueue the scripts (heartily recommended) you can test to see what page you want it to appear, thanks to the hook.
    When you add the filter for the extra contact method, you can test to see if the current user can manage options.

    [Code moderated as per the Forum Rules. Please use the pastebin]

    Here is a sample userinfo.js which would live in your plugin’s folder specified by WP_PLUGIN_URL above
    [Code moderated as per the Forum Rules. Please use the pastebin]

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Remove some profile fields’ is closed to new replies.