Skip to content

Instantly share code, notes, and snippets.

View xnau's full-sized avatar

Roland Barker xnau

View GitHub Profile
@xnau
xnau / pdb-disable-retrieve-form-brute-force.php
Created February 12, 2026 19:48
Shows how to disable the Brute Force check on the Participants Database Resend Private Link Form
<?php
/**
* Plugin Name: PDB Disable Retrieve Form Brute Force Protect
* Description: disables the brute force protection in the retrieve private link form
*/
add_filter( 'pdb-retrieve_link_brute_force_protect', function () { return false; } );
@xnau
xnau / pdb-log-list-prefilter.php
Last active February 10, 2026 21:44
How to set up a prefilter for a Participants Database Participant Log list display
<?php
/**
* Plugin Name: PDB Log List Prefilter
* Description: filters which log entries are presented in a log list
*
* @see https://gist.github.com/xnau/856b362ccdd7545cdfd02dbbb83b273e
*/
if ( !class_exists( 'xnau_filtered_log_template' ) ):
class xnau_filtered_log_template
@xnau
xnau / pdb-record-unsaved-warning.php
Created December 10, 2025 18:45
Shows how to add a script that checks the Participants Database record edit form for unsaved changes
<?php
/**
* custom template for the [pdb_record] shortcode that demonstrates showing a
* warning to a user if they have unsaved changes to the record
*/
?>
<script>
jQuery(function($){
// tracks the form for unsaved changes
var unsaved = false;
@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 );