WordPress.org

Ready to get started?Download WordPress

Forums

WP-Members
[resolved] Is it possible to hide fields on the front-end/or edit HTML without javascript? (4 posts)

  1. Jules Colle
    Member
    Posted 1 year ago #

    Love your plugin.

    I'm trying to do the following things, but without much luck:

    1. I have created some custom user fields, but some of them only need to appear on the registration page, and I don't want them to be editable on the profile page afterwards.
    2. I also have a custom field that I don't want to display on front-end, not even on registration. But the administrator must be able to edit it.

    I managed to get this to work with some jQuery, hiding the fields, but I have a third use-case tat's a bit more complex, so I'm wondering if there isn't a way to somehow write a kind of template for how the form elements will look. Not only CSS-wise. Here's an example of what I want to do:

    3. Registered users can sign up for workshops. I created a custom post type called workshop. On the workshop page (blocked for guests) there will be a button to subscribe to a workshop. Behind the scenes, there is a text-field for every user containing a comma separated string containing the titles of the workshops the user has subscribed to. I created this text-field by WP-Members. Now my question is: how do I get the value from the text-field, so I can create a button, and secondly how would I update the text-field after the user clicks my button (= submits my form)?

    http://wordpress.org/extend/plugins/wp-members/

  2. Chad Butler
    Member
    Plugin Author

    Posted 1 year ago #

    For #1, you would need to filter the fields out of the form when in the update state. You can do that with the wpmem_register_form filter (see: http://rocketgeek.com/plugins/wp-members/users-guide/filter-hooks/wpmem_register_form/). In your filter, you would need to change the field from being an input to be a hidden field with whatever data the user has already entered (or you have entered) - otherwise you'll lose the stored value.

    On #2, just set the field's "Display" option to unchecked. Then the field will show to the admin on the user profile and can be used by the admin, but it won't display to the user.

    #3 you can can use the WP function get_user_meta to get the value of that usermeta (which would have a meta_key of whatever the field's option name is).

  3. Jules Colle
    Member
    Posted 1 year ago #

    Cool, thank you for the quick response. I managed to do it in a more hackish way, but I will definitly use your plugin again now I know how to get around this the right way.

  4. DesignFlute
    Member
    Posted 1 year ago #

    @Jules Colle, how did you solve your first thing:
    "1. I have created some custom user fields, but some of them only need to appear on the registration page, and I don't want them to be editable on the profile page afterwards.

    I have the very same need and I have just started to look into it as to how to do it. If you could put that coding part here, it will help me a lot.
    Thanks in advance.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic