Skip to content

Instantly share code, notes, and snippets.

Roland Barker xnau

View GitHub Profile
@xnau
xnau / pdb-video-element.php
Last active Jul 8, 2020
Shows a way to create a Participants Database form element that displays an embedded video by using WordPress' built-in video embed filters
View pdb-video-element.php
<?php
/**
* Plugin Name: PDB Video Form Element
* Description: Demonstrates how to create a Participants Database form element that displays a video
* Version: 3.0
* Text Domain: pdb-video-form-element
* Domain Path: /languages
*
*/
@xnau
xnau / pdb-list-edit-link.php
Last active May 23, 2020
Participants Database Default List Template with Edit Record Link
View pdb-list-edit-link.php
@xnau
xnau / pdb-wp-user-shortcodes.php
Last active May 23, 2020
Provides shortcodes for showing Participants Database content according to the logged-in WordPress user.
View pdb-wp-user-shortcodes.php
<?php
/**
* Plugin Name: PDB WP User Shortcodes
* Description: defines several shortcodes for use with Participants Database and WordPress Users
*/
class PDb_User_List_Shortcodes {
/**
* @var string name of the user ID field
@xnau
xnau / pdb-list-dropdown-search.php
Last active Apr 10, 2020
Shows how to set up a dropdown search input for a Participants Database list display.
View pdb-list-dropdown-search.php
<?php
/*
template for participants list shortcode output
this template demonstrates a "table-less" responsive layout for the list of records
with a dropdown selector search interface
*/
/**
@xnau
xnau / pdb-single-category-link.php
Last active Mar 5, 2020
Provides an example of a Participants Database custom template that places a link to show all records in the same category as the current record.
View pdb-single-category-link.php
@xnau
xnau / pdb-volunteer-dropdown.php
Last active Jan 17, 2020
Demonstrates a plugin for using database values to populate a dropdown control in Participants database.
View pdb-volunteer-dropdown.php
<?php
/**
* Plugin Name: PDB Volunteer Dropdown
* Description: load the registered volunteers into a Participants Database form dropdown
*/
/*
* sets our function to be called when the pdb-form_element_build_dropdown action
* is triggered by the form
*
@xnau
xnau / wp-locale-conversion-array.php
Created Feb 1, 2019
Conversion array for WordPress locale codes and standard language codes and names
View wp-locale-conversion-array.php
<?php
$wp_locale_conversion = array(
'af' => array(
'name' => 'Afrikaans',
'code' => 'af',
'wp_locale' => 'af'
) ,
'ak' => array(
'name' => 'Akan',
'code' => 'ak',
@xnau
xnau / pdb-match-multiple-fields.php
Last active Dec 31, 2019
Provides a way to use multiple fields to match a record in the database when importing or adding new records in Participants Database
View pdb-match-multiple-fields.php
<?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: 2.1
*
* requires PDB version 1.9.4.2 or later
*/
add_action( 'pdb-incoming_record_match_object', 'xnau_check_for_match' );
@xnau
xnau / pdb_set_age_value.php
Last active Dec 23, 2019
Demonstrates how to set up a field that shows a person's age in Participants Database
View pdb_set_age_value.php
<?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-set-field-readonly.php
Created Dec 21, 2019
Shows how to set the readonly status of a Participants Database field based on the field data
View pdb-set-field-readonly.php
<?php
// set the first_name field to read only
add_filter( 'pdb-before_field_added_to_iterator', function ($field) {
/** @var PDb_Field_Item $field */
if ( $field->name() === 'first_name' ) {
$field->make_readonly();
}
});
You can’t perform that action at this time.