Autopopulate PODs meta based on logged-in WP/BP User

This topic is: not resolved

This topic contains 3 replies, has 2 voices, and was last updated by  madyogi 2 years, 2 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #165257

    madyogi
    Member

    I am building a WordPress site with a BuddyPress install at the moment. I’m hoping to use it as a small-scale education site for yoga teachers. My main question at this point has to do with meta information related to the creation of a new pod.

    For example, I have a Sequence Design pod. I will want students to post scanned images/pdfs of yoga sequences they’ve drawn up, which are then all displayed in a list, each of which links to a page that allows teachers to download the pdf/image and then comment back and forth with students about the particular sequence.

    Is there a good way to track the meta associated with an individual POD entry? I want to pull data like "student name" and "date posted," but I don’t want those to be input by the student, since they could theoretically put anything they want in there. I would rather those fields be defined by who’s currently logged into WordPress, and what time they are actually creating the pod.

    Thanks.

    #165260

    madyogi
    Member

    Perhaps this kind of thing would be better served by Custom Post Types? I assume they come with the typical Post Meta attached, so you can easily pull that info out in an archive page. I don’t mind going that route, but I like the cleanliness of PODs in terms of not just appending the custom post type to the Posts Table.

    Any thoughts? Thanks in advance for any help.

    #165258

    hsatterwhite
    Member

    You could do this using Pods publicForms (I recommend this) or creating your own custom form using the Pods API. There is a Pod package that auto-sets the current user for you and you can look to this recent thread on the development blog, where Scott explains and recommends the right way to capture date/timestamps using built in WordPress functions.

    Essentially you’d want to create the other fields that you want to capture this meta data with and set them to hidden (see the publicForms documentation above) and on which ever one is used for capturing the username set the input helper for it.

    #165259

    madyogi
    Member

    Awesome … Thanks for pointing me in the right direction, hsatterwhite! I have to say, though, I still have no idea what to do with the package you mentioned. If you could elaborate on how such code might be used, that would be great.

    In the mean time, I was able to make a page template for my blog that includes a publicForms call. This page allows me to add new instances of the "sequence-design" pod. I also used input helpers to fill in the automated meta information. I left the fields’ display property to true, but disabled them with HTML in the helper. As you referenced, datei18n(); does the trick for filling in the date. In lieu of using the Pod package for getting the logged-in user information, I just used the get_currentuserinfo wordpress function to fill in that info. Everything seems to work as I’d hoped, though I’d still like to know what one is supposed to do with the package you referenced.

    Thanks!

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

You must be logged in to reply to this topic.

Wordpress Cloud Hosting