Skip to content

Instantly share code, notes, and snippets.

Avatar

Roland Barker xnau

View GitHub Profile
@xnau
xnau / pdb-custom_summary.php
Last active May 20, 2021
Demonstrates how to show a custom summary value for a Participants Database Participant Log
View pdb-custom_summary.php
<?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 May 17, 2021
Removing Unused Columns from Participants Database
View delete-orphan-columns.txt
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 Apr 25, 2021
Shows how to check a Participants Database signup submission for a valid email address
View pdb-check-signup-submission.php
<?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 Apr 24, 2021
Shows how to add a KML file to a Participants Database Locations Map map.
View pdb-add-kml.php
<?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 Mar 17, 2021
Shows how to display a timestamp as a public field in a Participants Database single record display.
View pdb-single-show-timestamp.php
<?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 Mar 12, 2021
Shows how to route the Participants Database signup notification email to a recipient based on a value in the submission
View pdb-select-email-recipient.php
<?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
*
*/
@xnau
xnau / pdb-default-date.php
Last active Feb 8, 2021
Shows how to set the default date for a specific date field in Participants Database
View pdb-default-date.php
<?php
/**
* Plugin Name: PDB Default Date
* Description: sets the default date for a specific date field
*/
add_action( 'pdb-before_display_form_input', 'xnau_set_default_date' );
/**
@xnau
xnau / pdb-log_list-single-link.php
Last active Nov 3, 2020
Shows how to include a link to the single record in a Participants Database Participant Log global log list.
View pdb-log_list-single-link.php
@xnau
xnau / pdb-log_list-edit-link.php
Last active Apr 24, 2021
Shows how to add a record edit link to a Participants Database Participant Log Global Log List template.
View pdb-log_list-edit-link.php
@xnau
xnau / pdb-signup-limit.php
Last active Oct 6, 2020
Shows how to set up a Participants Database signup form that limits the number of signups
View pdb-signup-limit.php
<?php
/**
*
* signup form that limits the number of signups
*
*/
// set the maximum number of signups
$limit = 100;