Skip to content

Instantly share code, notes, and snippets.

View xnau's full-sized avatar

Roland Barker xnau

View GitHub Profile
@xnau
xnau / pdb-autocomplete-cache.php
Created April 12, 2023 04:32
Shows how to turn off caching of the autocomplete terms in Particinats Database Combo Multisearch
<?php
/**
* Plugin Name: PDB Autosuggest Term Cache Set
* Description: shows how to set the cache time for the Combo Multisearch autrosuggest term list
*
*/
// set the cache time to 1 second, effectively bypassing it
add_filter( 'pdbcms-autosuggest_term_list_expiration', function( $cache_time ) { return 1; } );
@xnau
xnau / pdb-custom-format-tag.php
Last active April 10, 2023 20:34
Shows how to define a custom format tag for a caclulated field in Participants Database
<?php
/**
* Plugin Name: PDB Custom Format Tag
* Description: shows how to add a custom formatting tag for use in a Participants Database calculated field
* Version: 1.0
* Tutorial: https://xnau.com/using-custom-format-tags-for-calculation-fields/
*
* this requires Participants Database version 2.4.8 or later!
*/
@xnau
xnau / pdb-record-approval-switch.php
Created January 21, 2023 18:01
Shows how to control which Participants Database fields are availble for editing based on the user's approval status
<?php
/*
* when the user opens their record for editing, we check on their approval status
* and then select the shortcode to use based on that.
*/
switch ( $this->participant_values['approved'] ) {
case 'yes' :
echo do_shortcode( '[pdb_record]' );
break;
@xnau
xnau / pdb-custom-sum.php
Last active January 15, 2023 19:56
Shows how to set up a custom calculation on a Participants Database Participant Log
<?php
/**
* Plugin Name: PDB Custom Log Sum
* Description: calculates a summary value for a participant log
*/
class pdb_custom_log_sum {
/**
@xnau
xnau / pdb-single-conditional-show.php
Last active October 2, 2022 19:13
Single record template for Participants Database that demonstrates how to skip showing a field based on another value in the record.
<?php
/**
* @name pdb single template
* @version 2.2
*
* demonstrates how to skip displaying a field based on a value in the record
*
* you will need to change 3 values:
* 'conditional_field' should be the name of the field you may want to skip showing
* 'check_field' should be the name of the record value you are checking
@xnau
xnau / pdb-signup-radioselect.php
Last active September 24, 2022 17:38
Template for a Participants Database signup form that demonstrates how to disable or enable a field based on the selected value of another field
<?php
/**
*
* template for the signup form
*
* shows an example of letting the selected value of a radio control enable or disable another field
*
*/
?>
<script>
@xnau
xnau / pdb-list-record-columns.php
Last active August 17, 2022 18:14
Demonstrates a custom template for showing a Participant Database list in "reverse" form: rows as fields and columns as records.
<?php
/**
* @version 1.1
*
* PDbList template demonstrating how to show a "reverse" table with records as
* columns and fields as rows
*
*/
/** @var PDb_List $this */
@xnau
xnau / pdb-with-selected-send-signup-email.php
Created July 20, 2022 19:11
Tests adding the "send signup" item to the Participants Database With Selected admin list function
<?php
/**
* Plugin Name: PDb With Selected Signup Email
* Description: adds the send signup email item to the "with selected" function
*/
add_filter( 'pdb-admin_list_with_selected_actions', function ( $actions ) {
return $actions + array(
'send signup email' => 'send_signup_email'
);
@xnau
xnau / pdb_custom_log_template.php
Last active July 19, 2022 18:32
Demonstrates how to define a custom template component set for the Participant Log add-on
<?php
/**
* Plugin Name: PDB Custom Log Template
* Description: provides a customized template for the Participant Log display
*/
/**
* demonstrates how to provide a custom template for a Participant Log display
*
* @package WordPress
@xnau
xnau / pdb-record-edit-log.php
Last active March 13, 2022 19:48
Shows how to add an email template tag that shows all the changes made on a Participants Database record update.
<?php
/**
* Plugin Name: PDB Record Edit Log Tag
* Description: provides a custom email tag that shows which fields were updated
* Version: 1.0
*
*/
class PDb_Record_Edit_Log_Tag {