Skip to content

Instantly share code, notes, and snippets.

View xnau's full-sized avatar

Roland Barker xnau

View GitHub Profile
@xnau
xnau / pdb-search-input-placeholder.php
Last active November 26, 2023 18:49
Shows how to add a placeholder to the Participants Database standard list search input (deprecated)
<?php
/**
* Plugin Name: PDb Standard Search Input Placeholder
* Description: shows how to set a placeholder value in the standard list search input
*/
add_filter( 'pdb-search_input_attributes', 'xnau_set_search_input_attributes' );
/**
@xnau
xnau / pdb-email-conditionals.php
Last active September 7, 2023 07:27
Shows how to add an additional conditional to a Participants Database email template
<?php
/**
* Plugin Name: PDb Email Conditionals
* Description: shows how to add additional conditional checks to an email template
*/
class PDb_Email_Template_Conditionals {
/**
@xnau
xnau / pdb-override-email-limit.php
Created September 5, 2023 00:38
Shows how to obverride the Participants Database email session limit
<?php
/**
* Plugin Name: PDB Override Email Limit
* Description: sets a new outgoing email limit
* Version: 1.0
*/
// overrides the session email limit with a new limit
add_action( 'pdb-mass_email_session_limit', function($limit){
$limit = 500; // this is your new limit
@xnau
xnau / pdb-custom-image-filename.php
Created August 18, 2023 03:10
Shows how to set a custom filename for an uploaded image
<?php
/**
* Plugin Name: PDB Custom Image Filename
* Description: names an uploaded image file according to other values in the record
* Version: 1.0
*/
// attach the handler function to the filter
add_action( 'pdb-file_upload_filename', 'pdb_set_custom_filename', 10, 3 );
@xnau
xnau / pdb-check-link-match.php
Last active May 7, 2023 19:07
Shows how to set up a duplicate record check on a link-type field
@xnau
xnau / pdb-list-sort-columns.php
Last active April 20, 2023 06:31
Shows how to set up a click-to-sort header for a Participants Database list table template
<?php
/**
* @version 1.0
*
* template for participants list shortcode output
*
* this demonstrates how to add a click-to-sort header to the list
*
*/
@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 {
/**