Skip to content

Instantly share code, notes, and snippets.

@xnau
Last active March 22, 2021 04:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xnau/eff6f14f55f9115e9358eeec7821e882 to your computer and use it in GitHub Desktop.
Save xnau/eff6f14f55f9115e9358eeec7821e882 to your computer and use it in GitHub Desktop.
Demonstrates how to show a different Participants Database record edit form depending on a value in the record.
<?php
// determine the approval status of the record and show the appropriate shortcode
switch ( $this->participant_values['approved'] ) {
case 'yes' :
echo do_shortcode( '[pdb_record groups="main,address,personal"]' );
break;
case 'no':
echo do_shortcode( '[pdb_record groups="main"]' );
break;
case null: // show this if there is no valid record
echo do_shortcode('[pdb_record]');
}
@xnau
Copy link
Author

xnau commented Feb 20, 2021

The idea here is that some members will have access to more of their record if they are approved. You can adapt this to any kind of value test in the record to determine which record edit form to display.

The "null" test is needed in case the page is opened with no valid private ID.

@xnau
Copy link
Author

xnau commented Mar 22, 2021

General instructions on using Participants Database custom templates:

Using Participants Database Custom Templates

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment