Skip to content

Instantly share code, notes, and snippets.

Avatar

Daniel L. Iser danieliser

View GitHub Profile
@danieliser
danieliser / rename-plugins-after-update.php
Last active Nov 28, 2022
This code works to update addon/extension plugin slugs during update from a premapped list. Code likely needs to be run in separate plugin/theme/mu-plugin/drop-in.
View rename-plugins-after-update.php
<?php
/**
* This code works to update addon/extension plugin slugs during update from a premapped list.
*
* Code likely needs to be run in separate plugin/theme/mu-plugin/drop-in.
*
* Tested Working On:
* - Single Site: Updates Page - Singe Plugin.
@danieliser
danieliser / functions.php
Created Nov 3, 2022
EDD Subscription Cancellation UX using Gravity Forms & WP Fusion
View functions.php
<?php
/**
* Assumptions:
* - Form ID is #28
* - Page ID is 406200
* - Fields include radio for reason & extra details where needed.
*/
@danieliser
danieliser / class-edd-sl-api-endpoint.php
Created Oct 24, 2022
EDD Software Licensing Optimized Endpoint
View class-edd-sl-api-endpoint.php
<?php
/**
* Plugin Name: EDD Software Licensing Endpoint
* Plugin URI: https://github.com/Frosty-Media/edd-sl-api-endpoint
* Description: Endpoint for Easy Digital Downloads Software Licensing add-on.
* Version: 1.0.1
* License: GPL version 2 or any later version
* Author: Danny van Kooten
* Author URI: https://github.com/dannyvankooten/
*/
@danieliser
danieliser / custom-email-template.php
Created Oct 22, 2022
Allow overloading WP email templates with custom wrappers and dynamic data
View custom-email-template.php
<?php
function get_custom_email_template() {
ob_start();
include __DIR__ . '/index.php';
$content = ob_get_clean();
ob_end_clean();
return $content;
}
@danieliser
danieliser / index.js
Last active Aug 25, 2022
broken @wordpress/core-data
View index.js
import domReady from '@wordpress/dom-ready';
import { render } from '@wordpress/element';
import {
createRegistry,
RegistryProvider,
useSelect
} from '@wordpress/data';
import { store as coreStore } from '@wordpress/core-data';
@danieliser
danieliser / edd_perpetual_discounts.php
Created Feb 18, 2022 — forked from polevaultweb/edd_perpetual_discounts.php
EDD - Allow discounts to be set to apply to all renewals
View edd_perpetual_discounts.php
<?php
add_filter( 'edd_update_discount', 'edd_perpetual_discounts_add_meta' );
add_filter( 'edd_insert_discount', 'edd_perpetual_discounts_add_meta' );
add_action( 'edd_edit_discount_form_before_use_once', 'edd_perpetual_discounts_setting', 10, 2 );
add_filter( 'edd_get_option_recurring_one_time_discounts', 'edd_perpetual_discounts_discounts' );
function edd_perpetual_discounts_add_meta( $meta ) {
$meta['use_renewals'] = 0;
@danieliser
danieliser / SyncGamesToNAS.ps1
Last active Feb 14, 2022
Sync Steam Library to NAS / Secondary Drive using PowerShell & Robocopy
View SyncGamesToNAS.ps1
<# Source game library #>
$dir = dir "D:\Game Libraries\Steam Library\steamapps\common\" | ?{$_.PSISContainer};
<# Mapped network drive / destination path. #>
$nasPath = "G:\Steam Library\steamapps\common";
$log = "E:\gamecopy.log";
Remove-Item $log;
$dir | ForEach-Object {
@danieliser
danieliser / helpers.php
Created Nov 22, 2020
Extracting shortcodes & attributes from content in WordPress. These helper functions can help extracting shortcodes and their attributes from WordPress content.
View helpers.php
<?php
/**
* Extract shortcodes from content.
*
* @param string $content Content containing shortcodes.
*
* @return array Array of shortcodes found.
*/
function get_shortcodes_from_content( $content ) {
@danieliser
danieliser / eddsl-auto-activate.php
Created Oct 21, 2020 — forked from zackkatz/eddsl-auto-activate.php
Auto-activate sites on Easy Digital Downloads Software Licensing
View eddsl-auto-activate.php
<?php
add_filter( 'edd_sl_is_site_active', 'your_namespace_is_site_active_auto_activate_site', 10, 3 );
/**
* Allow active licenses to get updates if they're not at the limit, no matter what.
*
* @param false $is_active
* @param int $license_id
* @param string $passed_site_url
@danieliser
danieliser / force-pm-asset-caching-on.php
Created Jun 23, 2020
Force Popup Maker asset caching on.
View force-pm-asset-caching-on.php
<?php
add_action( 'wp_enqueue_scripts', 'custom_force_pm_asset_caching', 11 );
function custom_force_pm_asset_caching() {
wp_deregister_script( 'popup-maker-site' );
$cached = get_option( 'pum-has-cached-js' );
if ( ! $cached ) {
PUM_AssetCache::cache_js();
$cached = get_option( 'pum-has-cached-js' );