Skip to content

Instantly share code, notes, and snippets.

Avatar

Roland Barker xnau

View GitHub Profile
@xnau
xnau / pdb-update_notify.php
Created Nov 7, 2016
Notify the user when their record is updated by an admin
View pdb-update_notify.php
<?php
/*
Plugin Name: Participants Database Update Notify
Description: Notifies the user when their record is updated
*/
/*
* before the update is stored, send an email notification to the participant
*/
add_filter( 'pdb-before_submit_update', 'pdb_send_record_update_notification' );
@xnau
xnau / pdb-email_on_approval.php
Created Nov 7, 2016
Sends the Participants Database welcome email when a record is approved
View pdb-email_on_approval.php
<?php
/*
Plugin Name: Participants Database Send Welcome On Approval
Description: Sends the welcome email when a record is approved.
*/
/*
* check the new record data before the record is updated
*/
add_filter( 'pdb-before_submit_update', 'pdb_send_record_update_notification' );
@xnau
xnau / pdb_custom_form_elment_example.php
Last active Sep 1, 2018
example of creating a Participants Database Custom Form Element
View pdb_custom_form_elment_example.php
<?php
/**
* Plugin Name: PDB Array Form Element
* Description: a demonstration of the basic technique for creating a custom form element in Participants Database
*
*/
add_filter( 'pdb-set_form_element_types', 'my_array_register_element' );
add_action('pdb-form_element_build_array','my_array_element_building_function');
add_filter('pdb-before_display_form_element','my_array_element_value_display_function', 10, 2);
@xnau
xnau / pdb_external_links.php
Last active Nov 29, 2018
Making Participants Database list links to external sites open in a new tab
View pdb_external_links.php
@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
View pdb-signup-city-select
<?php
/*
* bootstrap template for signup form
*
* demonstrates a simple dependent selector
*
* the cities available for selection are constrained by the selected state
*
*/
?>
@xnau
xnau / city_selector.js
Last active Jan 16, 2019
Just the javascript from the state/city selector example
View city_selector.js
<script>
jQuery(function($){
// name of the parent field
var parent = 'state';
// name of the child field
var child = 'city';
// defines the parent selector dropdown
var parent_select = $('select[name='+parent+']');
View custom_validation_example.php
<?php
/**
* validates a field submission for a valid URL
*
* @param PDb_Validating_Field $field
* @return null
*/
function xnau_check_valid_url( $field )
{
// first, check to see if it is the field we want to validate
View custom_validation_error_message.php
<?php
/**
* adds a custom validation error message
*
* @param array $error_messages
* @return array
*/
function xnau_add_url_validation_error_message( $error_messages )
{
// add our message with a placeholder for the field name
View pdb-record-bootstrap-tabs-head.php
<div class="wrap <?php echo $this->wrap_class ?>">
<?php
if (!empty($this->participant_id)) :
// output any validation errors
$this->print_errors();
?>
<?php
// print the form header
You can’t perform that action at this time.