Skip to content

Instantly share code, notes, and snippets.

Avatar

Roland Barker xnau

View GitHub Profile
@xnau
xnau / pdb-log_list-edit-link.php
Last active Oct 13, 2020
Shows how to add a record edit link to a Participants Database Participant Log Global Log List template.
View pdb-log_list-edit-link.php
@xnau
xnau / pdb-signup-limit.php
Last active Oct 6, 2020
Shows how to set up a Participants Database signup form that limits the number of signups
View pdb-signup-limit.php
<?php
/**
*
* signup form that limits the number of signups
*
*/
// set the maximum number of signups
$limit = 100;
@xnau
xnau / pdb-single-option-value-optgroup.php
Last active Sep 21, 2020
Shows how to find the optgroup of a field value in a Participants Database custom template.
View pdb-single-option-value-optgroup.php
<?php
$record = new PDb_Template( $this );
// name of the field you're interested in
$field = 'interests';
// get the array of defined options
$option_list = $record->get_field_prop( $field, 'options' );
// assume the title is blank at first
@xnau
xnau / pdd-record-frontend-profile-tabs.php
Last active Sep 16, 2020
Shows how to set up a Participants Database WP Profile template that uses a tabbed interface.
View pdd-record-frontend-profile-tabs.php
<?php
/**
* shows a WP user profile edit form with Participants Database fields in a tabbed interface
*
*/
global $PDb_WP_Users, $PDb_Frontend_Profile, $post, $wp;
/** @var \pdbwpu\Plugin $PDb_WP_Users */
/** @var \pdbwpu\Frontend_Profile $PDb_Frontend_Profile */
$profileuser = $PDb_Frontend_Profile->this_user();
@xnau
xnau / pdb-record_page_title.php
Last active Sep 12, 2020
Shows how to set the page title according to the Participants Database record data.
View pdb-record_page_title.php
<?php
/**
* Plugin Name: PDB Record Page Title
* Description: uses data from a Participants Database record to set the page title
*
* This plugin uses one or more fields from a participants database record to set
* the title of the page.
*/
class pdb_record_page_title {
@xnau
xnau / pdb-email-html-wrap.php
Last active Sep 5, 2020
Shows how to wrap an outgoing Participants Database email with an HTML framework
View pdb-email-html-wrap.php
<?php
/*
* Plugin Name: PDb HTML Email Wrapper
* Description: Adds a structural HTML wrapper to outgoing Participants Database emails.
*/
class pdb_email_html_wrapper {
/**
*
@xnau
xnau / pdb-shortcode-notify.php
Last active Sep 3, 2020
Shows how to set up a custom "shortcode present" notification for Participants Database
View pdb-shortcode-notify.php
<?php
/*
* Plugin Name: PDb Shortcode Placement Notification
* Description: Tells the Participants Database plugin that a shortcode is present on the page.
*/
add_filter( 'pdb-shortcode_in_content', 'xnau_notify_shortcode_present', 10, 2 );
/**
* tells the plugin that a shortcode is present
*
@xnau
xnau / pdb-activate-shortcode.php
Created Aug 22, 2020
Demonstrates how to let Participants Database know there is a shortcode on a page (see comments for full explanation)
View pdb-activate-shortcode.php
// check for a specific post ID, then fire the action if it matches
add_action( 'wp', function () {
global $post;
if ( $post->ID == 9627 ) {
do_action( 'pdb-shortcode_present');
}
});
@xnau
xnau / xnau-email-html-wrapper.php
Last active Sep 5, 2020
Shows how to wrap an outgoing WordPress email with structural HTML such as a doctype, meta tags, style, etc.
View xnau-email-html-wrapper.php
<?php
/*
* Plugin Name: xnau HTML Email Wrapper
* Description: Adds a structural HTML wrapper to outgoing WordPress emails.
*/
class xnau_email_html_wrapper {
/**
*
@xnau
xnau / pdb-login-recaptcha.php
Last active Jul 17, 2020
Demonstrates a Participants Database custom template that adds a reCAPTCHA to the Participant Login form.
View pdb-login-recaptcha.php
<?php
/**
* @version 1.0
*
* the uses a recaptcha field in the login form if available
*
* @global PDb_reCAPTCHA $PDb_reCAPTCHA
*/
global $PDb_reCAPTCHA;
$recaptcha_fieldname = 'captcha'; // change this to match your captcha field name
You can’t perform that action at this time.