Skip to content

Instantly share code, notes, and snippets.

View xnau's full-sized avatar

Roland Barker xnau

View GitHub Profile
@xnau
xnau / pdb-populate-chosen-selector.php
Last active March 30, 2022 18:48
Demonstrates how to load a "Chosen" dropdown with options in Participants Database
<?php
/**
* Plugin Name: PDB Populate Chosen Dropdown
* Description: tests loading a chosen element with options
*
* sets our function to be called when the pdbcde-before_element_rendered action
* is triggered by the form just before the "Chosen Dropdown" is shown so we can
* change the list of options to show
*/
@xnau
xnau / pdb-set-decimal-datatype.php
Last active December 29, 2017 19:26
Describes how to set a custom datatype for a Participants Database field form element
<?php
/**
* @wordpress-plugin
* Plugin Name: Set Decimal Datatype
* Description: set a custom datatype for a Participants Database decimal form element
*/
add_filter( 'pdb-form_element_datatype', 'xnau_set_decimal_type', 10, 2 );
/**
* sets the datatype for decimal fields
*
@xnau
xnau / pdb-search-detailed.php
Created December 22, 2017 19:08
A "detailed" template for the Participants Database search shortcode
<?php
/*
*
* template for participants list search form
*
*/
?>
<div class="wrap <?php echo $this->wrap_class ?>">
<?php echo $this->search_error_style ?>
<div class="pdb-searchform">
@xnau
xnau / pdb-allow-html-text.php
Last active August 6, 2019 14:24
Demonstrates how to allow HTML in Participants Database text fields
<?php
/**
* @wordpress-plugin
* Plugin Name: PDB Allow HTML
* Description: Installs a filter allowing HTML in Participants Database text fields
*/
add_filter( 'pdb-text_field_output', 'xnau_allow_html_in_text', 10, 2 );
/**
* allows sanitized HTML in text fields
*
@xnau
xnau / pdb_unapprove_unpaid_account.php
Created January 6, 2018 08:16
Demonstrates how to "unapprove" a record in Participants Database Member Payments if the account is not paid
<?php
/**
* @wordpress-plugin
* Plugin Name: Unapprove Unpaid Records
* Description: unapproves the record if the account has not been paid
*/
add_action( 'pdbmps-status_change_to_due', 'xnau_unapprove_unpaid_account' );
/**
* unapproves the record if the payment lapses
*
@xnau
xnau / pdb-record-member-payment-tabs-status.php
Created January 28, 2018 03:49
Demonstrates how to control the payment method according to the member's payment status
<?php
/*
* demonstrates a profile payment form where the payment is controlled by the member's payment status
*/
?>
<div class="wrap <?php echo $this->wrap_class ?>">
<?php
if ( !empty( $this->participant_id ) ) :
// output any validation errors
@xnau
xnau / pdb-login-redirect-filter.php
Last active February 6, 2018 18:30
Demonstrates how to alter the redirect according to a value in the user's record when using the PDB Login add-on
<?php
/*
Plugin Name: Redirect PDB Login
Description: Alters the redirect according to a value in the user's record when using the PDB Login add-on
*/
add_action( 'pdb-login_after_validate_submission', 'xnau_setup_pdb_login_redirect', 10, 2 );
/**
* sets up the redirect filter
*
* this checks the newly-logged-in user's record and
@xnau
xnau / pdb-list-field-control.php
Last active February 10, 2018 18:45
demonstrates how to control the display of some fields in a Participants Database record list based on the value of another field
<?php
/*
*
* template for participants list shortcode output
*
* demonstrates how to control the display of some fields based on the value of another field
*
*/
// these are the fields that we are controlling the display of
@xnau
xnau / pdb-multi-field-match-import.php
Last active March 28, 2023 04:10
Demonstrates how to set up a multiple-field match when a signup form is submitted or importing a CSV to Participants Database
<?php
/*
* Plugin Name: PDb Multi-Field Match Import
* Description: Demonstrates how to set up a multiple-field match when a signup form is submitted or importing a CSV to Participants Database
* Version: 2.0
*
*/
class PDb_Multifield_Match_Import {
/**
@xnau
xnau / pdb-signup-redirect-filter.php
Created February 26, 2018 20:06
Demonstrates how to enact a conditional redirect based on the submitted data from a Participants Database signup form
<?php
// place the filter on the posted data before it is submitted
add_filter( 'pdb-before_submit_signup', 'xnau_conditional_signup_redirect' );
/**
* changes the signup form "thanks" page depending on a value in the form
*
* @param array $post the posted data
* @return array post data
*/
function xnau_conditional_signup_redirect( $post )