Skip to content

Instantly share code, notes, and snippets.

Avatar

Roland Barker xnau

View GitHub Profile
@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_set_age_value.php
Last active Jul 29, 2021
Demonstrates how to set up a field that shows a person's age in Participants Database
View pdb_set_age_value.php
<?php
/**
* Plugin Name: Participants Database Show Participant's Age
* Description: Sets up a field that shows a person's age
* Version: 2.0
*/
class pdb_set_age_value {
@xnau
xnau / pdb-export-image-paths.php
Created Jul 12, 2021
Shows how to include the absolute URI for image files in a Participants Database CSV export
View pdb-export-image-paths.php
<?php
/**
* Plugin Name: PDB Export Absolute Image Paths
* Description: Shows how to include the absolute path to image files in a CSV export
*
*/
class PDb_Image_Paths_Export {
/**
@xnau
xnau / pdb-log_list-edit-link.php
Last active Jun 29, 2021
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_alternate_id_field.php
Created Jun 22, 2021
Shows how to set up an alternate record ID scheme in Participants Database
View pdb_alternate_id_field.php
<?php
/*
* Plugin Name: Participants Database Alternate ID Field
* Version: 0.1
* Description: allows the use of a custom field for the general ID that is used to show a record
* Author: xnau webdesign
*/
class PDb_alternate_id_field {
/**
@xnau
xnau / delete-orphan-columns.txt
Last active Jun 18, 2021
Removing Unused Columns from Participants Database
View delete-orphan-columns.txt
on any administrative page, add ?pdb-remove-orphan-columns to the URL, then hit return to execute it.
This will delete the columns that do not have a corresponding field definition from the main Participants Database table.
WARNING: THIS WILL DELETE DATA
Always work with a backup for operations like this.
for example:
https://xnau.com/wp-admin/admin/php?pdb-remove-orphan-columns
@xnau
xnau / pdb-email-cron.php
Last active Jun 9, 2021
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-custom_summary.php
Last active May 20, 2021
Demonstrates how to show a custom summary value for a Participants Database Participant Log
View pdb-custom_summary.php
<?php
/**
* Plugin Name: PDB Custom Summary
* Description: provides a customized sum value for the "Work Log" log
* Version: 1.0
*
*/
class pdb_work_log_summary {
@xnau
xnau / pdb-check-signup-submission.php
Last active Apr 25, 2021
Shows how to check a Participants Database signup submission for a valid email address
View pdb-check-signup-submission.php
<?php
/**
* checks a signup submission for a valid email
*
* @return bool true to accept the submission, false to reject it
*/
add_filter( 'pdb-check_submission', function() {
// this check is only applied to signups
if ( filter_input( INPUT_POST, 'action', FILTER_SANITIZE_STRING ) === 'signup' ) {
@xnau
xnau / pdb-record_page_title.php
Last active Apr 24, 2021
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 {