Skip to content

Instantly share code, notes, and snippets.

View xnau's full-sized avatar

Roland Barker xnau

View GitHub Profile
@xnau
xnau / pdb-custom-dynamic-field.php
Created September 22, 2021 20:07
Demonstrates how to implement a Participants Database custom dynamic hidden field that gets its value from the shortcode
<?php
/**
* Plugin Name: PDB Custom Dynamic Field
* Description: demonstrates how to place a value from the shortcode into a dynamic hidden field
*/
class PDb_Custom_Dynamic_Field {
/**
@xnau
xnau / pdb-single-edit-button.php
Created September 16, 2021 19:41
Shows how to add a PArticipants Database record edit button to the single record template
<?php
/**
* @name pdb single template
* @version 1.0
*
* default template for displaying a single record with a record edit button
*
*/
if ( $this->participant_id > 0 ) :
@xnau
xnau / pdb-export-image-paths.php
Created July 12, 2021 19:55
Shows how to include the absolute URI for image files in a Participants Database CSV export
<?php
/**
* Plugin Name: PDB Export Absolute Image Paths
* Description: Shows how to include the absolute path to image files in a CSV export
*
*/
class PDb_Image_Paths_Export {
/**
@xnau
xnau / pdb_alternate_id_field.php
Created June 22, 2021 22:18
Shows how to set up an alternate record ID scheme in Participants Database
<?php
/*
* Plugin Name: Participants Database Alternate ID Field
* Version: 0.1
* Description: allows the use of a custom field for the general ID that is used to show a record
* Author: xnau webdesign
*/
class PDb_alternate_id_field {
/**
@xnau
xnau / pdb-custom_summary.php
Last active May 20, 2021 17:47
Demonstrates how to show a custom summary value for a Participants Database Participant Log
<?php
/**
* Plugin Name: PDB Custom Summary
* Description: provides a customized sum value for the "Work Log" log
* Version: 1.0
*
*/
class pdb_work_log_summary {
@xnau
xnau / delete-orphan-columns.txt
Last active June 18, 2021 18:20
Removing Unused Columns from Participants Database
on any administrative page, add ?pdb-remove-orphan-columns to the URL, then hit return to execute it.
This will delete the columns that do not have a corresponding field definition from the main Participants Database table.
WARNING: THIS WILL DELETE DATA
Always work with a backup for operations like this.
for example:
https://xnau.com/wp-admin/admin/php?pdb-remove-orphan-columns
@xnau
xnau / pdb-check-signup-submission.php
Last active April 25, 2021 20:15
Shows how to check a Participants Database signup submission for a valid email address
<?php
/**
* checks a signup submission for a valid email
*
* @return bool true to accept the submission, false to reject it
*/
add_filter( 'pdb-check_submission', function() {
// this check is only applied to signups
if ( filter_input( INPUT_POST, 'action', FILTER_SANITIZE_STRING ) === 'signup' ) {
@xnau
xnau / pdb-add-kml.php
Last active April 24, 2021 04:53
Shows how to add a KML file to a Participants Database Locations Map map.
<?php
// adds a KML to a a Google Map
add_filter( 'pdbgmap-additional_map_code', 'xnau_add_kml' );
/**
* adds a KML file to the map configuration
*
* this is based on the example at Google
* @see https://developers.google.com/maps/documentation/javascript/kml
* @param string $js_object empty string
* @return string a valid JS object
@xnau
xnau / pdb-single-show-timestamp.php
Created March 17, 2021 18:20
Shows how to display a timestamp as a public field in a Participants Database single record display.
<?php
/**
* @name pdb single template show timestamp
* @version 2.0
*
* template for displaying a single record
*
*/
if ( $this->participant_id > 0 ) :
?>
@xnau
xnau / pdb-select-email-recipient.php
Last active March 12, 2021 05:04
Shows how to route the Participants Database signup notification email to a recipient based on a value in the submission
<?php
/*
* Plugin Name: Participants Database Custom Signup Email Recipient
* Version: 0.1
* Description: sets the signup notification email recipient based on a value in the signup submission
* Author: Roland Barker, xnau webdesign http://xnau.com
*
*/