Skip to content

Instantly share code, notes, and snippets.

@MCKLtech
MCKLtech / hide-progress-bar-thinkific.html
Created July 23, 2024 17:02
Hide Progress Bar in Thinkific Course Player
<script>
// Wait for the document to be ready
$(document).ready(function () {
//Check for course player
if (typeof (CoursePlayerV2) !== 'undefined') {
CoursePlayerV2.on('hooks:contentDidChange', function (data) {
try {
// Select elements with classes that match the pattern
var elements = $('[class*="_course-progress__actions-container"]');
@MCKLtech
MCKLtech / woocommerce-groundhogg-blocker.php
Last active January 24, 2022 21:20
A basic blocker for WooCommerce that works on Groundhogg.io Tags
<?php
/*
* Plugin Name: WooCommerce Customer Blocker for Groundhogg
* Plugin URI:
* Description: Block customers at the checkout using tags in Groundhogg
* Version: 1.0
* Author: Colin Longworth
* Author URI: http://www.wooninja.io
* Developer: Colin Longworth
<?php
/*
* Plugin Name: Groundhogg - Loom Replacements
* Plugin URI:
* Description: Adds a replacement code to embed Loom videos in Groundhogg Emails
* Version: 1.0
* Author: Colin Longworth
* Author URI: http://www.wooninja.io
* Developer: Colin Longworth
<?php
namespace GroundhoggDisposable;
use Groundhogg\Contact;
/*
* Plugin Name: Groundhogg - Disposable Email Checker
* Plugin URI: https://www.wooninja.io/?utm_source=wp-plugins&utm_campaign=groundhogg-disposable&utm_medium=wp-dash
* Description: Remove disposable emails from your Groundhogg List
@MCKLtech
MCKLtech / create-order-square-php-sdk.php
Last active June 19, 2023 03:06
This gist gives a high level overview of how to create an order in Square using the PHP SDK. For an order to show in the Dashboard you must create, fulfill AND pay for the order.
$body = new \Square\Models\CreateOrderRequest;
//Add 5 of the same line items
//We are creating them dynamically
$qty = 5;
$lineItem = new \Square\Models\OrderLineItem($qty);
$lineItem->setName('Latte');
$money = new \Square\Models\Money;
$money->setCurrency('CAD');
//Amount in Cents e.g. $5.50
@MCKLtech
MCKLtech / wcs-functions.php
Created May 25, 2020 14:20
An overview of how to use Gravity Forms to cancel a WooCommerce Subscription programically
/* This code is NOT safe for production usage. Do not use in live systems */
/* Add to functions.php */
add_action( 'gform_after_submission', 'wc_demo_cancel_sub', 10, 2 );
function wc_demo_cancel_sub( $entry, $form ) {
//Get the subscription id from the form
//We assume the field wc_sub_id contains the subscription ID
<?php
/* An example of two methods to retrieve only WooCommerce Bookings Products */
use WC_Product_Booking_Data_Store_CPT;
$booking_products_ids = WC_Product_Booking_Data_Store_CPT::get_bookable_product_ids();
foreach($booking_products_ids as $id) {
@MCKLtech
MCKLtech / spark-new-user-team.php
Created September 13, 2019 14:52
This gist demonstrates a method of creating a Spark User and setting up their initial Team
<?php
use App\Team;
use Laravel\Spark\Spark;
use Laravel\Spark\Interactions\Settings\Teams\CreateTeam;
//Create a User
$sparkUser = Spark::user();
$sparkUser->forceFill([
@MCKLtech
MCKLtech / spark-add-team-member.php
Created September 13, 2019 14:50
This gist demonstrates a method of adding a Spark User to an existing Spark Team
<?php
use App\Team;
use Laravel\Spark\Spark;
use Laravel\Spark\Contracts\Interactions\Settings\Teams\AddTeamMember;
//Get a Spark User
$sparkUser = Spark::user()->where('email', '[email protected]')->first();
//TODO: Check user exists
@MCKLtech
MCKLtech / wordpress-ajax-endpoint.php
Created March 7, 2019 20:58
HOWTO: Create a WordPress AJAX Endpoint for a JSON Payload
<?php
/*
* In this GIST, we register a webhook that will be available for other applications to call e.g. JSON
* This code could be added to functions.php or your own plugin.
*/
//Register an end point for logged in users
add_action("wp_ajax_my_webhook", "my_webhook");
//Register an end point for logged out users