Skip to content

Instantly share code, notes, and snippets.

View xnau's full-sized avatar

Roland Barker xnau

View GitHub Profile
@xnau
xnau / pdb-unapprove-edits.php
Last active October 11, 2025 19:23
Shows how to unapprove a Participants Database record when it is edited on the frontend
<?php
/**
*
* Plugin Name: Unapprove Record on Frontend Edit
* Description: When a record is edited by a frontend user, switch the approval to "no"
*
*/
/*
* set it up so that our function will be triggered when a record is updated
@xnau
xnau / pdb-login-check-multiple.php
Created October 8, 2025 19:58
Demonstrates a method for checking two fields for a username match when using the Participants Database Login
<?php
/**
* Plugin Name: PDB Login Check Multiple Usernames
* Description: check two fields for a username match
* Version: 0.1
*/
add_filter( 'pdb-login_username_query', 'xnau_modify_login_query' );
/**
@xnau
xnau / pdb-record-bare-field.php
Created October 2, 2025 17:22
Utility template for displaying only the fields in a Participants Database record edit display
<?php
/**
* special purpose template that only shows the named fields as bare elements
*
*/
if ( $this->record_found() ) :
while ( $this->have_groups() ) : $this->the_group();
@xnau
xnau / pdb-record-show-grandchildren.php
Last active October 16, 2025 17:45
Proof-of-concept for a Participants Database Multi-Relational record template that shows grandchildren
<?php
/**
* show grandchildren template
*
* this demonstrates a way to show the grandchildren of a parent type
*
*/
// this is the name of the parent type this template is for
$parent_type = 'teacher';
@xnau
xnau / pdb-prevent-editor-delete.php
Last active September 23, 2025 02:42
Demonstrates a simple plugin to prevent a Participants Database user with an editor role from deleting records
<?php
/**
* Plugin Name: PDB Prevent Editor Delete Records
* Description: prevent users with an editor role from deleting records
* Version: 1.0
*
* @see https://xnau.com/user-access-control/
*/
add_filter( 'pdb-access_capability', 'xnau_editor_delete_cap', 10, 2 );
<?php
/**
* Plugin Name: PDb MailChimp Custom Merge Tags
* Description: adds a custom merge tag to the MailChimp registration
* Author: Roland Barker, xnau webdesign
* Version: 1.0
* Author URI: https://xnau.com
* License: GPL3
*/
@xnau
xnau / pdb-custom-email-tag.php
Last active February 18, 2025 19:34
Shows a simplified way to add a custom email value tag for use in a Participants Database email template
<?php
/**
* Plugin Name: PDb Custom Email Tag
* Version: 0.1
*/
// this is a proof-of-concept example
add_filter( 'pdb-template_email_tag_map', 'xnau_add_custom_email_tag', 10, 2 );
@xnau
xnau / pdb-log-running-total.php
Last active February 9, 2025 04:02
Shows how to set up a running total with the Participants Database Participant Log plugin
<?php
/**
* Plugin Name: PDb Log Running Total
* Description: keeps a running total for each record
* Version: 2.1
*/
/*
* this plugin keeps a cumulative total for each record by subtracting or adding
@xnau
xnau / pdb_literal_relations_field.php
Last active January 29, 2025 18:16
Shows how to set up a field that holds a literal list of relations for the Participants Database Multi-Relational plugin
<?php
/**
* Plugin Name: PDb Multi-Relational Literal Relations Field
* Description: Maintains a field in the database with a list of the record's relations
* Version: 0.1
*/
/*
* this is designed to maintain a field in the record that can be used for simple filtering
@xnau
xnau / pdbmrdb_record.php
Created January 26, 2025 20:12
Provides a utility class for the Participants Database Multi-Relational plugin that can be used in a shortcode template
<?php
/**
* Plugin Name: PDb Multi-Relational Utility Class
* Description: Provides a utility class for showing a record's relations
* Version: 0.1
*/
class pdbmrdb_record {