Skip to content

Instantly share code, notes, and snippets.

Roland Barker xnau

Block or report user

Report or block xnau

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@xnau
xnau / pdb-match-multiple-fields.php
Last active Nov 9, 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.0
*
* requires PDB version 1.9.4.2 or later
*/
add_filter( 'pdb-incoming_record_match_object', 'xnau_check_for_match', 10, 2 );
@xnau
xnau / pdb-wp-user-shortcodes.php
Last active Nov 6, 2019
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-suspend-email-autop.php
Last active Jul 29, 2019
Shows how to conditionally suspend auto-paragraphs with a Participants Database Email Template
View pdb-suspend-email-autop.php
add_filter( 'pdb-rich_text_filter_mode', 'suspend_rich_text_for_sms', 10, 2 );
// changes the rich text filtering mode according to content
function suspend_rich_text_for_sms( $format_setting, $content ) {
// the setting is only altered if the message is an sms message
if ( content_is_sms( $content ) ) {
$format_setting = 'none';
}
@xnau
xnau / pdb-email-cron.php
Last active Apr 20, 2019
Shows how to set up a Participants Database email that will automatically send when conditions are met
View pdb-email-cron.php
<?php
/**
* Plugin Name: PDB Email Cron
* Plugin URI: https://xnau.com/?p=7354
* Description: Provides a basic framework for setting up an automated Participants Database email send
* Version: 1.0
* Author: xnau webdesign
* Author URI: https://xnau.com
* License: GPL2
@xnau
xnau / pdb-show-user-record.php
Created Apr 2, 2019
Shows how to display a single Participants Database record for a logged-in WordPress user.
View pdb-show-user-record.php
<?php
// this is meant to be used with some kind of plugin that lets you insert php into a page
//
// the Participants Database field named 'user_login' is expected to have the user's user login value
//
$current_user = wp_get_current_user();
if ( $current_user->ID ) {
$record_id = Participants_Db::get_record_id_by_term('user_login', $current_user->user_login );
@xnau
xnau / pdb_email_reply_to_header.php
Created Feb 27, 2019
Shows how to set the "reply-to" header on a Participants Database email template
View pdb_email_reply_to_header.php
<?php
/**
* Plugin Name: PDB Set Reply-To Header
* Description: sets the reply-to header for a Participants Database email template
*/
add_filter( 'pdb-template_email_header', 'xnau_add_reply_to_header', 20, 2 );
/**
* adds a reply-to header to a Participants Database email template
*
@xnau
xnau / pdb-multi-field-as-or.php
Last active Apr 9, 2019
When using Participants Database Combo Multisearch, shows how to make the selections within a multiselect field work as OR terms when global filter mode is enabled.
View pdb-multi-field-as-or.php
<?php
/**
* Plugin Name: PDB Multi Field as OR in Filter Search
* Description: make the selections within a multiselect field work as OR terms when
* global filter mode is enabled
*/
add_filter( 'pdb-multisearch_filter_mode', 'xnau_set_multi_field_as_or', 10, 2 );
/**
* sets the filter mode for the terms within a multi select field as an OR instead
@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-single-custom.php
Created Dec 4, 2018
Example of the use the the PDb_Template class for a Participants Database single record shortcode
View pdb-single-custom.php
<?php
/*
* template for displaying a business detailed view
*
* single record template
*/
// get the template object for this record
$this_business = new PDb_Template($this);
?>
<h1 class="business-title"
@xnau
xnau / pdb-total-field-handler.php
Last active Aug 18, 2019
Shows how to set up a Participants Database field that keeps a total of several other fields.
View pdb-total-field-handler.php
<?php
/*
Plugin Name: Participants Database Total Field
Description: Maintains a total of several fields
*/
// this updates the total when the record is updated
add_filter( 'pdb-before_submit_update', 'xnau_update_total_field' );
/**
You can’t perform that action at this time.