Skip to content

Instantly share code, notes, and snippets.

View xnau's full-sized avatar

Roland Barker xnau

View GitHub Profile
@xnau
xnau / pdb-single-bootstrap-tabs.php
Created February 28, 2018 18:08
Participants Database responsive single record template with tabs support
<?php
/**
* @name pdb single template bootstrap
* @version 2.1
*
* default template for displaying a single record for the twitter bootstrap framework
*
* http://twitter.github.com/bootstrap/
*
*/
@xnau
xnau / pdb_admin_capabilities.php
Last active March 2, 2018 07:30
Shows how to set up the use of custom admin capabilities for Participants Database
<?php
/*
Plugin Name: PDb Custom Admin Capabilities
Description: Sets up the use of custom admin capabilities for Participants Database
*/
add_filter( 'pdb-access_capability', 'xnau_setup_admin_capabilities', 10, 2 );
/**
* sets the custom capabilities for use with the plugin
*
* @param string $capability the default capability for the role
@xnau
xnau / set-email-recipient.php
Created March 8, 2018 18:43
Shows how to replace the recipient value in the "to" field of a Participants Database email template.
<?php
add_filter( 'pdbcptet-recipient_tags', 'xnau_filter_recipients' );
/**
* replaces the recipient identifier with the recipient's email address
*
* @param array $tag_list the tag replacement data
* @return array
*/
function xnau_filter_recipients( $tag_list )
{
@xnau
xnau / singlerecordlink_filter_example.php
Last active March 17, 2018 18:05
Shows how to place the single record link on multiple fields in a Participants Database list display
@xnau
xnau / pdb-bypass_text_filter.php
Created March 17, 2018 18:07
Shows how to bypass the HTML tag filters on a Participants Database text field
<?php
/**
* bypass HTML sanitizing on the "home_page" field
*
* @param string $text the sanitized text
* @param object $field the current field object
* @return string the display string
*/
function xnau_bypass_homepage_field_sanitize( $text, $field ) {
if ( $field->name === 'home_page' ) {
@xnau
xnau / pdb-contact-form-additions.php
Last active June 8, 2023 22:20
Demonstrates how to add fields to a Participants Database Contact Form
<?php
/**
* Plugin Name: PDB Contact Form Additions
* Description: adds additional fields to the Participants Database contact form
* Version: 2.1
*/
add_action( 'pdbcff-before_message_area', 'pdbcfa_add_fields' );
/**
* inserts additional fields into the contact form
@xnau
xnau / pdb-generate-member-id.php
Last active October 10, 2023 07:00
Demonstrates a way to generate and provide a unique ID for new signups and new records in Participants Database
<?php
/**
* Plugin Name: PDB Generate Member ID
* Description: provides a unique ID for new signups and new records in Participants Database
* Version: 2.2
*/
class pdb_generate_member_id {
/**
@xnau
xnau / change_currency_value_display.php
Last active June 8, 2018 20:12
shows how to change the display of a Participants Database field
<?php
/**
* Plugin Name: PDB Customize Currency Display
* Description: replaces a zero value with a custom string
*/
add_filter( 'pdb-before_display_form_element', 'xnau_show_currency_value', 10, 2 );
/**
* replaces a 0 value with a string
*
* @param string $display the display string
@xnau
xnau / pdb-comma-decimal-display.php
Created May 18, 2018 19:04
Demonstrates how to show decimal numbers using comma as the separator
<?php
/**
* Plugin Name: PDB Comma Decimal Separator Display
* Description: alters the display of decimal numbers to use comma as the decimal separator, and point as the thousands separator
*/
add_filter('pdb-before_display_form_element', 'xnau_show_comma_decimals', 10, 2 );
function xnau_show_comma_decimals( $display, $field )
{
// we are only modifying these form element types
if ( $field->form_element === 'decimal' || $field->form_element === 'currency' ) {
@xnau
xnau / pdb-limit-signups.php
Last active May 22, 2018 18:39
Shows how to limit the number of Participants Database signups
<?php
/**
* Plugin Name: PDB Limit Signups
* Description: Adds a count of the number of Participants Database signups, and prevents new signups
* once a number of registrations has been reached
*/
add_filter( 'pdb-signup_shortcode_output', 'xnau_limit_signups' );
/**
* adds a display of the number of signups and prevents signups once a limit is reached
*