Support » Plugin: Members » Can I restrict Custom Fields (Pods) on Post?

  • Hello,

    I just wonder if Members can help me with this requirement:

    Hide certain area of a post, page or custom-post-type
    – such as certain Custom-Fields or Pods Fields –
    from showing to any unregistered website visitor.

    The visitor should be able to see the standard content and images, but custom fields should only be displayed to registered users.

    Is this possible with Members?

    Thank you and have a nice day,
    Sascha

Viewing 6 replies - 1 through 6 (of 6 total)
  • You can wrap the output that you want to protect with one of the Members shortcodes (https://github.com/justintadlock/members, down the page is the section on shortcodes), so you can do:

    
    [members_access role="paid_members"]
    content you want to restrict
    [/members_access]
    

    But if you’re trying to restrict fields on ‘input’, ie in the back-end admin, you can control that with the Advanced Options of the field where in Pods there is a section to Restrict the fields Visibility based on Role or Capability.

    • This reply was modified 3 months, 1 week ago by  Jim True.

    Thank you Jim,

    I’m impressed about your effort to reply to support-requests even in other forums than Pods, nice one 🙂

    So, in case of using the wrapping-solution I’d simply need to place the appropriate Pods-Template inside the [member_access] tags, e.g.

    [members_access role=”paid_members”]
    [pods name=”pods_test” template=”pods_test_template”]
    [/members_access]

    is that correct?

    Thank you and kind regards,
    Sascha

    Yep, that should work just fine. I use that same methodology but I put the members_access shortcodes actually inside my Pods Templates. That way I show general information to non members and members see additional stuff. It’s very flexible.

    Plugin Author Justin Tadlock

    (@greenshady)

    If working with shortcodes, there’s also a [members_logged_in] shortcode that works the same way but only displays content to users who are logged into the site.

    
    [members_logged_in]Only show to logged-in users.[/members_logged_in]
    

    If within templates (not using shortcodes), you don’t even need Members. You can do:

    
    <?php if ( is_user_logged_in() ) : ?>
    
    	Only show to logged-in users.
    
    <?php endif ?>
    

    @greenshady You’re awesome! I use your plugin practically on every site I build 😉

Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.