Skip to content

Instantly share code, notes, and snippets.

View xnau's full-sized avatar

Roland Barker xnau

View GitHub Profile
@xnau
xnau / pdb_set_records_payment_status.php
Last active September 10, 2020 01:41
Demonstrates how to set up a simple "with selected" action in the Participants Database admin record list.
<?php
/*
* Plugin Name: PDB Set Paid Status Tutorial
* Version: 0.1
* Description: Demonstrates how to set up a simple "with selected" action in the Participants Database admin record list.
* Author: Roland Barker, xnau webdesign https://xnau.com
*
*/
/**
* defines our action and adds it to the dropdown
@xnau
xnau / list-last-week.php
Last active August 8, 2017 18:49
Showing the last week's records in Participants Database
<?php
// determine the range of dates to show
$start = date( 'M j,Y', strtotime(  '-7 days' )  ); // the date 7 days ago
$end = date( 'M j,Y' ); // today's date
// now build the shortcode with the date range filter
echo do_shortcode( '[pdb_list filter="date_recorded>=' . $start . '&date_recorded<=' . $end . '" ]' );
?>
@xnau
xnau / list-this-month.php
Last active August 8, 2017 18:53
Showing results from the current month with Participants Database
<?php
// determine the range of dates to show
$start = date( 'M 01,Y' ); // first day of the current month
$end = date( 'M t,Y' ); // last day of the current month
// now build the shortcode with the date range filter
echo do_shortcode( '[pdb_list filter="date_recorded>=' . $start . '&date_recorded<=' . $end . '" ]' );
?>
@xnau
xnau / set_private_id_length.php
Last active September 30, 2017 18:54
shows how to change the Participants Database private id length
<?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; } );
@xnau
xnau / pdb-signup-change-default.php
Last active September 1, 2017 18:26
demonstrates how to set the default value of a field in the template in Participants Database
<?php
/**
* bootstrap template for signup form
*
* this demonstrates how to set the default value of a field in the template
*
* outputs a Twitter Bootstrap-compatible form
* http://twitter.github.com/bootstrap/index.html
*
* @version 0.3
@xnau
xnau / pdb-list-special.php
Last active September 12, 2017 19:12
Demonstrates how to use the PDb_Template class in a custom list template for Participants Database
<?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
*/
?>
@xnau
xnau / pdb-list-detail-link.php
Created September 23, 2017 18:21
Demonstrates how to add the detail link to several fields in the Participants Database list display
@xnau
xnau / pdb_set_age_value.php
Last active July 29, 2021 17:45
Demonstrates how to set up a field that shows a person's age in Participants Database
<?php
/**
* Plugin Name: Participants Database Show Participant's Age
* Description: Sets up a field that shows a person's age
* Version: 2.0
*/
class pdb_set_age_value {
@xnau
xnau / pdb-check-multiple.php
Last active July 10, 2018 19:41
Demonstrates a way to check multiple fields for a match in Participants Database
<?php
/**
* Plugin Name: PDB Multiple Field Match Check
* Description: checks a new Participants Database submission against
* the database for a matching record using multiple fields
* Version: 1.2
*/
add_filter( 'pdb-incoming_record_match', 'xnau_check_for_match', 10, 2 );
/**
@xnau
xnau / pdb-iframe-element.php
Last active March 20, 2022 17:51
Demonstrates how to create a Participants Database form element that displays an iframe
<?php
/**
* Plugin Name: PDB Iframe Form Element
* Description: Demonstrates how to create a Participants Database form element that displays an iframe
*
*/
add_filter( 'pdb-set_form_element_types', 'pdb_iframe_register_element' );
add_action( 'pdb-form_element_build_iframe','pdb_iframe_element_building_function');
add_filter( 'pdb-before_display_form_element','pdb_iframe_element_value_display_function', 10, 2);