WordPress.org

Ready to get started?Download WordPress

Forums

Participants Database
Creating a Parent/Child relationship (5 posts)

  1. paorganic
    Member
    Posted 1 year ago #

    XNAU,

    Thanks again for all your hard work on this!

    We are using your plugin to register parents and their children for an ongoing membership to a motivational program of sorts.

    What I need to do is capture first the adult's information:
    Name, Age (must be over 21), Address, Other contact information

    Then once I get that, I'd like to have a button that then takes them to another registration page to enter their first child in. In doing so, it'll snag the ID assigned to that parent's record (let's say 001) and in a sense create the relationship between the Parent and the child...pardon the pun, but this is truly a Parent/Child relationship ;-)

    They enter in the child's name, gender and age. From the gender and age, I want to create a field that combines those data fields (e.g. for a boy who is 12, it'd be B12) and then appends that with the ID that your plugin has assigned to that new record, so like B12_0002. And then in my custom field parentID inserts 001.

    If they have another child, they click a button to add another child, complete the same information (say this time it's a girl who's 8, so G08) and it's G08_003...again also still entering into the custom field parentID a value of 001.

    Hopefully that makes sense. As it's not a relational database with multiple tables and joins, I figured this was the best way to do it.

    Does this all sound possible with your plugin/database?

    Thanks again!

    Joshua

    http://wordpress.org/extend/plugins/participants-database/

  2. xnau
    Member
    Plugin Author

    Posted 1 year ago #

    Joshua,

    This is possible, you can create a custom field type that works as an extensible set of fields to allow the addition of an arbitrary number of fields to the record. If you take a look at the plugin API, there are several hooks that give you a way to create your custom form element.

  3. peggyst
    Member
    Posted 1 year ago #

    Joshua,

    I would love to hear how this works for you, as I'm doing something similar.

    We are creating a form for kids to input the # of free throws and field shots (for basketball) that they make on a given day and they are supposed to go back in and record these shots, with the goal of totaling 1,000 shots at the end of the summer.

    I had seen another question, which Xnau answered, about providing the total sum in the [pdb_list], but I cannot figure out how to allow my users to go back to the same field and enter new data - which I would typically do with a relationship. In the same way that someone would track hours.

    I'm guessing I might have to go the API route as well, but it will be a learning curve for me...

  4. paorganic
    Member
    Posted 1 year ago #

    Thanks again!

    I'm guessing it's this one; pdb-after_submit_signup – provides access to the processed new participant record, raw values as stored in the database.

    I understand the description...but this is my first time working with hooks. I'll read more into it, just initially not sure how'd I'd access that record and parse out the fields I need to create then combine those to input it into subsequent field we need.

    This will be new for me so I'll keep my fingers crossed.

    @peggyst - I'll let you know how I make out at this :-)

  5. xnau
    Member
    Plugin Author

    Posted 1 year ago #

    paorganic,

    That particular hook will allow you to mess with the submitted values, and that approach could work, but it would be pretty limited in what you can do.

    On my plugin API page, near the bottom, is an outline for creating a custom form element that allows the user to save several values in an array. It's really just a sketch, but it will get you started. Please note I don't offer free support for this kind of thing...

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic