Skip to content

Instantly share code, notes, and snippets.

Roland Barker xnau

View GitHub Profile
@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' );
/**
@xnau
xnau / pdb-single-dual.php
Created Sep 25, 2018
Shows how to use a value in the record to determine which fields to show in the Participants Database single record display.
View pdb-single-dual.php
<?php
/*
* shows a single record display based on a value in the record
*/
if ( $this->participant_id ) : ?>
<?php
switch ( $this->participant_values['type'] ) {
case 'player':
@xnau
xnau / pdb-list-multisearch-map.php
Last active Sep 26, 2018
Shows how to set up a list template for adding a locations map when using the Participants Database Combo Multisearch plugin
View pdb-list-multisearch-map.php
<?php
/*
*
* template for showing a Participants Database list with combo multisearch and a dynamic map
*/
$listmap = new pdbgmap\listmap($this);
global $PDb_Combo_Multi_Search;
$PDb_Combo_Multi_Search->enable();
$combo_search = $PDb_Combo_Multi_Search->get_text_search_value();
@xnau
xnau / pdb-record-delete-switch.php
Last active Aug 25, 2018
Shows how to set up a switch where a user can delete their own record
View pdb-record-delete-switch.php
<?php
/**
* Plugin Name: PDB Record Delete Switch
* Description: Gives users the ability to delete their own record
*/
class PDb_Record_Delete_Switch {
/**
* @var string name of the delete field
@xnau
xnau / pdb-list-grid.css
Last active Jun 27, 2018
CSS for setting up a grid layout using the Participants Database responsive list display
View pdb-list-grid.css
/*
Stylesheet for setting up a CSS grid layout for the
Participants Database responsive list display
*/
/* this is to hide unneeded elements */
.pdb-list-grid .pdb-field-title,
.pdb-list-grid h5 {
@xnau
xnau / pdb-auto-unapprove.php
Created Jun 25, 2018
Demonstrates how to automatically "unapprove" a record in Participants Database when the user makes changes.
View pdb-auto-unapprove.php
<?php
/**
* Plugin Name: PDB Auto Unapprove
* Description: sets the record approval field to "no" when the user edites their record
*/
add_action( 'pdb-after_submit_update', 'xnau_auto_unapprove' );
/**
* sets the approval field to "no" when a user updates their record
*
* @param array $post the posted data
@xnau
xnau / pdb-single-opengraph.php
Last active Jul 18, 2018
Shows how to set up a template for including meta tags in a Participants Database singe record page when using the Image Expansion add-on
View pdb-single-opengraph.php
<?php
/**
* @name pdb single opengraph template
* @version 0.1
*
* template for printing opengraph meta tags
*
* this variant is for use with the Participants Database Image Expansion add-on
*
* simplified information on using social media meta tags can be found here:
You can’t perform that action at this time.