Support » Plugin: Participants Database » [Plugin: Participants Database] Filter on a per-page basis?

  • I’ll explain my setup briefly so my question makes sense:
    I have a website for a volunteer organization that has separate posts for each volunteering event. I’ve already inserted a PDB signup form on each event page, and I used the hidden field feature to log which post/page the signup came from.

    I understand that the [pdb_list] shortcode can be filtered to only show signups if they match a certain criteria, but can that criteria be “dynamic” based on where the list is placed? As in, can each event page show a list of who has signed up for that event and that event only?
    Thank you for your help, and please do not hesitate to ask if you need further clarification.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author xnau webdesign



    Check out “hidden fields” these can be set up to dynamically assign a property from the $post or $wp_user objects. Then in your [pdb_list] shorcode filter for the value you stored in the hidden field.

    1. create a new field name “post name” and make it a hidden field with a default value of ‘post->post_name’…add it to the signup form. when someone signs up, the post slug of the page the shortcode was on will be recorded.

    2. in your [pdb_list] shortcode, add a filter like this: [pdb_list filter=”post_name=slug”] Now only people who signed up on that post will be listed. Note the name of the field is used, not the title.

    anyway, check the docs about hidden fields.

    I get how to use the hidden fields–I already have a field for the page that the form was submitted from.
    I’m trying to make it so that [pdb_list] can be set up something like [pdb_list filter=’my_field_name=$post’] so that each page has a list of people who signed up from that page itself (each page would have a signup and a list of people who signed up)

    I guess shortcodes can’t contain php though, so that currently does not work.
    Any ideas?

    Plugin Author xnau webdesign


    Ah, I see. The way to do this is to put the shorcode in the template using the do_shortcode function. You can use a php variable in the argument string:

    <?php echo do_shortcode('[pdb_list filter="my_field_name='.$post->post_name.'"]') ?>

    Didn’t work for me–I got no records found every time.
    I ended up using a rather inefficient method:

    $longname = single_post_title("", FALSE);
    $eventname = substr("$longname", 0, 11);

    and then I used filter="event_name~'.$eventname.'"
    It seems like for some reason the filter was being too strict and it wouldn’t work with your method, so I had to take the first 11 characters of the post name and filter with that.

    If you can think of a more elegant way to do this, please let me know!

    Another thing: is it possible to change the text of “No records could be found?”

    Plugin Author xnau webdesign



    Why don’t you try using the post ID?

    Also, if there’s a problem suing the post_name, perhaps you could tell me what your post_name for the page was so I can see if there’s a bug.

    I haven’t been using post ID because I want the csv to still have the “friendly” name of the event that people are attending.
    (Which is why my hidden field logs $post->post_title, rather than post_name)
    But even when I used the filter with the variable, I got no records found.

    I checked the value of the variable by putting an echo $post->post_title and I manually made sure there was a participant with the exact same characters in the field of the record.

    Is the event name too long, perhaps? It is “Turtleback Book Fair Set-up”
    Or maybe the hyphen is messing it up?

    Thank you for all your’s rare to get so much help nowadays 🙂

    Plugin Author xnau webdesign



    I understand about using the post_title so people will get a readable data field, but you could also capture the post ID or name…they will be a whole lot more reliable when it comes to filtering the list.

    It’s the spaces, not the hyphen messing things up in your example. The shortcode filter currently doesn’t deal well with spaces.

    As to helping people using the plugin, well, it’s how I learn to make it better.

    Ah, so you’re suggesting I also capture the post ID and filter by that, and capture the post_title just for display/logging purposes?
    That makes a lot of sense..I’ll go try it out now.
    Thank you!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘[Plugin: Participants Database] Filter on a per-page basis?’ is closed to new replies.