1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Implemented Custom Field: not viewable anywhere / only for Admin

Discussion in 'Closed Suggestions' started by erich37, Jun 27, 2014.

  1. erich37

    erich37 Well-Known Member

    I do have created a few "user custom fields" which show to the user at the "Register Page".

    So Admin can easily verify user based on these "custom fields" which he need to populate (required fields) during registration (sign up).

    But there is one issue:
    these "custom fields" should only show to Admin in order to be able to verify the user.

    It would be great if there would be an "option" in order to not "display" these fields in "Preferences" or anywhere else.

    Chris D likes this.
  2. Chris D

    Chris D XenForo Developer Staff Member

    That's there, already:

  3. Mike

    Mike XenForo Developer Staff Member

    @Chris D: I'm not sure if you're referring to the "viewable on profile pages" option, but that wouldn't cover the case of users editing them. "Editable only once" would though (if you made the field required, it would be filled in at registration).
    Chris D likes this.
  4. Chris D

    Chris D XenForo Developer Staff Member

    Yeah I was thinking "viewable on profile pages", initially.

    I think it achieves part of the solution, as in, only Admins can view its contents. But you're right, "Editable only once" goes some way to the other part too. The only problem I can foresee with that, though, is the field will be shown to existing users who never got shown that field during registration.

    So I think that's the only missing piece. And the only solution I can think for that immediately is a template edit to hide it from the custom fields editing template.

    I think permission based fields would be a good addition, though, eventually.

    Viewable by:
        User group A    User group B
        User group C    User group D
    Editable by:
  5. erich37

    erich37 Well-Known Member

    it is actually working fine now as it is, I just do not want to show these "Custom Fields" when user clicks onto "Preferences".

    I have also "Editable only once" activated, but the "Custom Fields" are still visible for the user at "Preferences".

    I would like to show these "custom fields" to the user at the "Register Page" only, and showing these "custom fields" to Admin only.

    May I ask why this suggestion has been marked as "implemented" ?
    Is it already possible to achieve this somehow ?

    Last edited: Jun 28, 2014
  6. Mike

    Mike XenForo Developer Staff Member

    If the field is editable only once (and it has a value), it doesn't show up on the front-end -- just confirmed it. So yes, that should do it in general. If you're wanting to ensure that it never shows up (even without a value), that could probably be done with a template conditional and is probably something that is more fitting of something specific to you.
  7. Chris D

    Chris D XenForo Developer Staff Member

    Template: custom_fields_edit

    (Based on the info in your screenshot):
    <xen:if is="{$field.field_type} == 'textbox'">
    Change to:
    <xen:if is="{$field.field_type} == 'textbox' AND {$field.field_id} != 'compwebsite'">
    Following Mike's advice above and also setting the field to be not viewable on profiles, plus this template edit basically achieves what you want.

Share This Page