Skip to content

Instantly share code, notes, and snippets.

Roland Barker xnau

View GitHub Profile
@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' );
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-submit-button.php
<?php endwhile; // field loop ?>
<?php // we are going to add our new submit button code here
</fieldset>
<?php endwhile; // group loop ?>
<?php // this fieldset is the one we are going to remove
View pdb-record-bootstrap-tabs-submit.php
<?php endwhile; // field loop ?>
<div id="submit-button" class="controls">
<?php pdb_field_group_tabs_submit_button( $this ) ?>
</div>
</fieldset>
<?php endwhile; // group loop ?>
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
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 / pdb-backend-dynamic-values.php
Last active Mar 1, 2017
demonstrates a simple filter for capturing a dynamic value on the admin side in Participants database
View pdb-backend-dynamic-values.php
<?php
add_action( 'pdb-form_element_build_text-line', 'xnau_place_dynamic_value' );
/**
* sets the value of a dynamic hidden field in the backend
*
* @param object $field
*/
function xnau_place_dynamic_value( $field )
{
/*
@xnau
xnau / pdb-record-backend-user.php
Last active Mar 1, 2017
Record the user who created or edited a record in the backend
View pdb-record-backend-user.php
<?php
add_action( 'pdb-after_submit_add', 'xnau_record_backend_user' );
add_action( 'pdb-after_submit_update', 'xnau_record_backend_user' );
/**
* record the user who created or edited a record in the backend
*
* @param array $record the record data
*/
function xnau_record_backend_user( $record )
{
@xnau
xnau / pdb-html-form-element-example.php
Last active Mar 14, 2017
demonstrates using a plugin to add a custom form element that simply prints out any HTML
View pdb-html-form-element-example.php
<?php
/**
* Plugin Name: PDB HTML Form Element
* Description: a general-purpose form element that simply displays HTML
*
*/
class PDb_html_form_element_example {
/**
@xnau
xnau / pdb-single-edit-link.php
Last active Mar 16, 2017
demonstrates adding an edit link to s single record page
View pdb-single-edit-link.php
You can’t perform that action at this time.