• Resolved jmcria

    (@jmcria)


    My organization sponsors weekly events that require a one time registration and weekly check-in. Participants Database appears to do all we need. I have 2 problems:
    1) Search the database on last_name and show the edit_link to each record that matches. pdb-list-details can be customized to search on last-name rather than from a pulldown list of field names. pdb-list can be customized to show edit_link which contains the personal ID for each record. How can I combine these in one shortcode to give search results with the edit_link to each found record? This is the check-in process.
    2) The Participants Database can be downloaded as a CSV file for use in a spreadsheet. I see no instructions on how to do that – probably because it is too obvious…

    https://ww.wp.xz.cn/plugins/participants-database/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Roland Barker

    (@xnau)

    You just need to use the same customization that is used on the default list template, apply it to the “detailed” template, they both work the same in the section that shows the list of records.

    To export a CSV, first, make sure all the fields you want exported hace “CSV” checked in the field definition. Then,on the “list participants” page in the admin, click on the export CSV button at the bottom of the page.

    Thread Starter jmcria

    (@jmcria)

    I tried the edit_link edit on on the detailed template but I must have it in the wrong location. I put it on either side of the “echo PDbFormElement… line without success. This the code:
    ` <tbody>
    <?php while ( $this->have_records() ) : $this->the_record(); // each record is one row ?>
    <tr>
    <?php while( $this->have_fields() ) : $this->the_field(); // each field is one cell ?>
    <td>
    <?php
    echo PDb_FormElement::get_field_value_display($this->field);
    // IF STATEMENT ADDED FOR CUSTOM2
    if ($this->field->name == ‘edit_link’) {
    $this->field->link = $record->get_edit_link();} ?>
    //
    </td>`

    As you can see I am not very strong on php. If you could send me a code snippet showing where the IF statement goes would be very helpful.

    Thank you for the CSV download directions. You have a large site and I thought I looked everywhere.

    Thank you for your quick response

    Plugin Author Roland Barker

    (@xnau)

    I know the documentation is not well organized…hard to find the time to tidy that up.

    You got the code mostly right, you just need to do your if statement before the echo so that it is changed before it gets displayed.

    Thread Starter jmcria

    (@jmcria)

    You will have to be more specific with the template edit code. Whenever I insert the “edit_link” if statement into the detailed template (sortcode: [pdb-list template=custom2]) the search goes into an endless loop regardless of which side of the echo command. Custom2 template works as expected when all of my edits are commented out.

    Note: the // comment tag in the code snippet from the earlier post is out of place but that has been corrected.

    Thank you again and sorry I am slow. Participants Database will be a valuable addition to our website.

    Plugin Author Roland Barker

    (@xnau)

    Well, I’m not really in a position to debug your template, I’m sorry. It is assumed you have enough knowledge of PHP to avoid minor issues like you describe. Try this…I don’t know if t will fix your template, but this is the error I see in what you showed me…you have a section like this:

    <?php
    echo PDb_FormElement::get_field_value_display($this->field);
    // IF STATEMENT ADDED FOR CUSTOM2
    if ($this->field->name == 'edit_link') {
    $this->field->link = $record->get_edit_link();} ?>

    change that to:

    <?php
    // IF STATEMENT ADDED FOR CUSTOM2
    if ($this->field->name == 'edit_link') {
    $this->field->link = $record->get_edit_link();}
    echo PDb_FormElement::get_field_value_display($this->field);
    ?>

    and it should work.

    Thread Starter jmcria

    (@jmcria)

    I noticed that $Record is never defined in pdb-list-detailed.php so I added
    $record = new PDb_Template($this);
    just below
    while ( $this->have_records() ) : $this->the_record();
    Everything works fine now!
    Thank you. You have a great plugin!

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘search and edit link question’ is closed to new replies.