Skip to content

Instantly share code, notes, and snippets.

View csaborio001's full-sized avatar

Christian Saborio csaborio001

View GitHub Profile
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Basic Page</title>
</head>
<body>
<p>basic</p>
</body>
</html>
#!/bin/bash
# Useful Extensions for Visual Studio
# https://marketplace.visualstudio.com/items?itemName=rogalmic.bash-debug
# https://marketplace.visualstudio.com/items?itemName=timonwong.shellcheck
# THESE VALUES ARE THE ONLY ONES YOU SHOULD CHANGE
WWW_DIR="/Users/csaborio/WebSites2"
BACKUP_DIR="/Users/csaborio/backups"
DB_USER="root"
@csaborio001
csaborio001 / add_attribute_for_script.php
Created July 24, 2019 02:04
Checks to see if a script declaration contains #asyncload or #deferload and inserts * the attribute in the script declaration if it is found. Based on this: https://tinyurl.com/y2obn9os
/**
* add_attribute_for_script - Checks to see if a script declaration contains #asyncload or #deferload and inserts
* the attribute in the script declaration if it is found. Based on this: https://tinyurl.com/y2obn9os
*
* @param string $url - the URL to check to see if it contains #asyncload or #deferload
*
* @return string - the modified string if any change was required.
*/
function add_attribute_for_script( $url )
{
@csaborio001
csaborio001 / gravity-profile-builder.php
Created November 18, 2019 23:21
Gravity Forms allows you to create a new WordPress user. Profile Builder Pro allows you to edit those fields in User Meta as long as they have the same name. If the field is multi-select, GF saves the values as ["Value1", "Value2"], Profile Builder does not like this. This snippet will intercept the user creation *AFTER* the meta has been writte…
/**
* When a new user is created it goes through the user meta to find entries that
* have the format ["Value","Value1"] and replaces it with Value,Value1. GravityForms
* writes multi-select form fields this way and the ProfileBuilder Pro does not understand it,
* so we need to replace the entry for PBP to gather what these values are.
*
* @param int @user_id - the ID if the user that was just created
*
* @return void
*/
if ( UserManagement::can_current_user_access_member_page() ) {
// Returns a WP_Query object.
$unmatched_volunteers = UserManagement::get_unmatched_volunteers( true );
}
$args = array(
'post_type' => 'volunteer',
'posts_per_page' => '10',
'button_label' => 'Show More Posts',
'button_loading_label' => 'Loading...',
'scroll' => 'false',
$filter_array = array(
"id" => "participant_filter",
"style" => "button",
"button_text" => "Filter Results",
"filters" => array(
array(
"key" => "meta",
"field_type" => "radio",
"meta_key" => "smoker",
"meta_operator" => "IN",
$filter_array = array(
"id" => "participant_filter",
"style" => "button",
"button_text" => "Filter Results",
"date_created" => 1)7)976446,
"date_modified" => 1)7)979494,
public static function set_max_year_for_birth_date( $max_year, $form, $field ) {
return 2011;
$target_forms = array( 10 );
$target_fields = array ( 38 );
if ( in_array( $form['id'], $target_forms ) ) {
if ( in_array( $field->id, $target_fields ) ) {
$sydney_date_time_zone = new \DateTimeZone( 'Australia/Sydney' );
$birth_year_18 = new \DateTime( 'now', $sydney_date_time_zone );
$birth_year_18->modify('-18 years');
$birth_year_18 = $birth_year_18->format('Y');
public function test_one_off_trigger_vol_police_report_five_days_prior_expiry_notify_area_coordinator() {
// Create the pending trigger.
$notifications = array(
'all_area_coordinators',
);
$trigger_id = $this->create_trigger_post( 'one_off', 'volunteer', '_police_report_expiry_date', 'ACTUALDATE', $notifications );
// Create the area_coordinator for notification, associate user.
$expected_email = 'area_coordinator_one@compeer.com';
$assigned_area_coordinator_user = $this->factory->user->create(
$args = array(
'post_type' => 'volunteer',
'posts_per_page' => '10',
'button_label' => 'Load More',
'button_loading_label' => 'Loading...',
'scroll' => 'false',
'post__in' => implode( ',', $unmatched_volunteers->posts ),
'repeater' => 'template_1',
'id' => 'participant_listing',
);