Skip to content

Instantly share code, notes, and snippets.

View xnau's full-sized avatar

Roland Barker xnau

View GitHub Profile
<?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
<?php endwhile; // field loop ?>
<div id="submit-button" class="controls">
<?php pdb_field_group_tabs_submit_button( $this ) ?>
</div>
</fieldset>
<?php endwhile; // group loop ?>
@xnau
xnau / pdb-volunteer-dropdown.php
Last active January 22, 2022 18:44
Demonstrates a plugin for using database values to populate a dropdown control in Participants database.
<?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 / pdb-backend-dynamic-values.php
Last active March 1, 2017 08:02
demonstrates a simple filter for capturing a dynamic value on the admin side in Participants database
<?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 March 1, 2017 08:39
Record the user who created or edited a record in the backend
<?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-single-gmap.php
Last active November 3, 2017 18:09
Demontrates a single record template for Participants Database that includes a location map for the listing
<?php
/*
* template for showing a google map in a single record template
*
*/
/*
* this is the name of the group the address fields are in
*
* change this to match the name of the group that contains your address fields
*/
@xnau
xnau / pdb-html-form-element-example.php
Last active March 14, 2017 20:02
demonstrates using a plugin to add a custom form element that simply prints out any HTML
<?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 March 16, 2017 01:13
demonstrates adding an edit link to s single record page
@xnau
xnau / pdb-one-time-use-pid.php
Last active March 25, 2017 18:30
demonstrates how to reset the private ID after it is used to open a record edit page
<?php
/*
* 3-20-17 updated to run on pdb-before_submit_update filer
*
*/
add_filter( 'pdb-before_submit_update', 'pdb_otu_regenerate_pid' );
/**
* regenerates the private id for the current record
*
<?php
/*
*
* template for participants list single record output
*
* use this template with a shortcode like this: [pdb_list template=single]
* if you want to show the search control, use this:
* [pdb_list search=true template=single]
*
*/