• Resolved Jules Colle

    (@jules-colle)


    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)?

    https://www.ads-software.com/extend/plugins/wp-members/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Chad Butler

    (@cbutlerjr)

    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: https://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).

    Thread Starter Jules Colle

    (@jules-colle)

    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.

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

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Is it possible to hide fields on the front-end/or edit HTML without javascript?’ is closed to new replies.