Hide some pod’s fields from users

This topic is: not resolved

This topic contains 1 reply, has 2 voices, and was last updated by  sc0ttkclark 1 year, 1 month ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #167643

    bakaburg1
    Participant
    Post count: 30

    Hi,
    I’m totally new to pods so I hope my question makes sense!

    I need to create a user profile pod in which only some fields are visible to users while only the pod "owner" and the admin can see all the data.

    I understood from the docs that I ca bind users to pods so the first problem is solved. I just have to check if the user logged in is the same one bound to the pod or is the admin.

    I have a second problem: I want user pods to be created from a front end page by new users. If I’m not wrong it should be possible to create new pods from the front end isn’it?

    Third and most problematic question: the admin should be able to add new fields in the pod without using the code. And even more important should be able to create a checkbox field that allows users to choose which part of their data is public and which is not.

    So I need two things: to have a pod template that shows all of the pods fields without hard coding them with the getField() function so that the admin is free to add and delete
    whichever field he wants. There is a way to loop through the fields of a pod to achieve this?
    The second problem is that users need to be able to hide groups of field from external visitors. How can I achieve this? The only thing that come to my mind, if it’s possible to loop through fields, is that I could tell the admin to create a checkbox field called eg "public" and set up a condition in the code that hide all the fields after the checkbox is it unchecked.

    How do you suggest me to organize this work?

    Thanks!

    #167644

    sc0ttkclark
    Keymaster
    Post count: 800

    Skipping around, sorry.. but on your second issue, you can use publicForm on the front of your site to create new pod items, was that what you needed or did you explain ‘I want user pods to be created’ as in you want to create new pods themselves, not items?

    Your first issue is also resolved by either using publicForm or an implementation of Pods UI (pods_ui_manage), check the codex for more information and a tutorial on it.

    Third, that’s pretty problematic, but possible. You can use the PodAPI to create new pods, add fields, etc.., so you could basically make an easy to use interface for your admins to use outside of the normal (and advanced) method of the Pods > Setup page.

    You can loop through fields, definitely. Here’s some code to do that which I was using to loop on another site during a debug process:

    To hide fields, maybe give admin a field to enter a comma separated list of field names to hide, then use:

    Hope that helps!

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

Wordpress Cloud Hosting