This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
template for participants list shortcode output | |
this template demonstrates a "table-less" reponsive layout for the list of records | |
using the PDb_Template class for each record | |
*/ | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* | |
* template for participants list shortcode output with adetail link on several fields | |
* | |
*/ | |
// define an array of field names to place the detail link on | |
$detail_link_fields = array( 'first_name','last_name','photo' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: Participants Database Set Private ID Length | |
* Description: sets a custom length for the private ID | |
*/ | |
// set the private ID length to 9 | |
add_filter( 'pdb-private_id_length', function ( $length ) { return 9; } ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'pdb-after_submit_update', 'xnau_record_last_user' ); | |
/** | |
* record the user who created or edited a record in the backend | |
* | |
* @see https://codex.wordpress.org/Function_Reference/wp_get_current_user | |
* | |
* @param array $record the record data | |
*/ | |
function xnau_record_last_user( $record ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// if the record is not approved, they cannot edit the record. | |
// you can easily adapt this to any other checkbox field so you can use that field to prevent editing | |
add_filter( 'pdb-check_submission', function() { | |
if ( !is_admin() && $_POST['action'] === 'update' ) { | |
$record = Participants_Db::get_participant( $_POST['id']); | |
// if the field has a value of "yes" allow editing | |
// if it is any other value, editing will not be allowed | |
return $record['approved'] === 'yes'; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'pdb-access_capability', 'set_pdb_access_controls', 10, 2 ); | |
/* | |
* @param string $cap the current capability level that gives access to the function named in $context | |
* @param string $context the specific action that is being tested | |
* @return string the capability that is allowed to access the function named in $context | |
*/ | |
function set_pdb_access_controls( $cap, $context ) | |
{ | |
// set the access capability for a specific action |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
this template demonstrates how to set up a simple search that only searches on a single field: city | |
to change which field is searched on, look at line 50, change the "value" of that hidden field | |
*/ | |
?> | |
<div class="wrap <?php echo $this->wrap_class ?>" id="<?php echo $this->list_anchor ?>"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* template for showing a google map in a single record template | |
* | |
*/ | |
/* | |
* this is the name of the group the address fields are in | |
* | |
* change this to match the name of the group that contains your address fields | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: PDB Audio Element | |
* Description: Demonstrates how to show an uploaded audio file in an audio element | |
* | |
*/ | |
add_filter( 'pdb-before_display_form_element','pdb_audio_element_display_function', 10, 2); | |
/** | |
* displays the audio element |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'pdbcptet-recipient_tags', 'xnau_filter_recipients' ); | |
/** | |
* filters the recipient list | |
* | |
* @param array $tag_list all the tags and their values | |
* @return array | |
*/ | |
function xnau_filter_recipients( $tag_list ) | |
{ |