Skip to content

Instantly share code, notes, and snippets.

View KZeni's full-sized avatar

Kurt Zenisek KZeni

View GitHub Profile
@KZeni
KZeni / freemius-killer.php
Last active May 18, 2024 14:34 — forked from thefrosty/freemius.php
Freemius Killer: A WordPress plugin that keeps your site lightweight by preventing the Freemius middleware from ever coming into play. Best when running Freemius' own "Freemius Fixer" plugin while this is enabled to purge existing Freemius data while this keeps it away. *NOTE:* This plugin manually specifies the plugins that use Freemius to then…
<?php
// REQUIRED: Make sure to edit the last few lines to assign the global variable that any particular Freemius/FS-enabled plugin wants to use to have this intercept it (if not already included below.)
// Please, any revisions for **adding more plugin to be supported by default** and/or better accommodating things are welcome at: https://gist.github.com/KZeni/7afbd8b9a94c23aa0a9133d4ce767d0b
// One would like to think this could grow to automatically intercept all plugins trying to use Freemius, but manual editing & updating a gist (maybe eventually getting to the point of being a plugin with automatic updates [be it via a WP.org plugin listing, its own built-in updater like PUM, GitHub repo where sites have plugins check a repo for new releases, etc.])
// Based on: https://gist.github.com/thefrosty/d9bb001c05a407ba1aaa60c8b75aeb43 (via https://austin.passy.co/2024/disable-freemius-in-wordpress-plugins/)
declare(strict_types=1);
/**
* Create an override function, as to bypass Freemius in plugins that in
@thefrosty
thefrosty / freemius.php
Created January 12, 2024 17:39
Create an override function, as to bypass Freemius in some less than smart plugins.
<?php
declare(strict_types=1);
/**
* Create an override function, as to bypass Freemius in stupid plugins.
* @wordpress-muplugin
* Plugin Name: Freemius Killer
* Description: Global override for Freemius' "loader".
* Version: 1.0.0
@lukecav
lukecav / Queries
Created June 30, 2023 20:52
Delete Action Scheduler actions with a status of failed and canceled and truncate the Action Scheduler logs database table
DELETE FROMwp_actionscheduler_actions WHERE status IN ('failed','canceled')
TRUNCATE wp_actionscheduler_logs
@KZeni
KZeni / functions.php
Last active June 27, 2022 16:57
Add start date from The Events Calendar to Display Posts plugin's output
<?php
/**
* Add custom fields to Display Posts Shortcode
* @author Bill Erickson
* @link http://wordpress.org/extend/plugins/display-posts-shortcode/
* @link http://www.billerickson.net/shortcode-to-display-posts/comment-page-1/#comment-4565
*
* @param $output string, the original markup for an individual post
* @param $atts array, all the attributes passed to the shortcode
* @param $image string, the image part of the output
@KZeni
KZeni / rpwe-add-author.php
Created March 29, 2022 06:11
Add Post Author to Recent Post Widgets Extended (RPWE) WordPress plugin output (uses Simple HTML DOM PHP [1.9.1 here] to aid in the HTML traversing & insertion])
<?php
// Add Simple HTML DOM for PHP-based HTML/DOM Traversal
if(!function_exists('str_get_html')){
include 'include/simple_html_dom.php';
}
// Add Author info to Recent Post Widgets Extended output (add before date)
function add_author_to_rpwe_markup($html,$args){
$html = str_get_html($html);
foreach($html->find('.rpwe-title a') as $title_link){
@Yukaii
Yukaii / READMD.md
Last active March 10, 2023 05:38
A Tampermonkey script to make YouTube dislike count back

(Deprecated) Make YouTube dislike count BACK!

Deprecated Attention

This script is no longer working. Please use https://chrome.google.com/webstore/detail/return-youtube-dislike/gebbhagfogifgggkldgodflihgfeippi instead, which is open sourced at https://github.com/Anarios/return-youtube-dislike.

Developers: If you’re using the YouTube API for dislikes, you will no longer have access to public dislike data beginning on December 13th ref: https://support.google.com/youtube/thread/134791097/update-to-youtube-dislike-counts?hl=en

@ryelle
ryelle / admin-bar-items.php
Created March 25, 2021 18:27
Add extra items to the top level of the WordPress admin bar
<?php
/**
* Plugin Name: Admin Bar Items
*/
add_action(
'admin_bar_menu',
function( $admin_bar ) {
$admin_bar->add_menu( array(
'id' => 'ryelle-demo-1',
@jetsloth
jetsloth / gppa_input_image_choices.php
Created October 27, 2020 22:34
Filter Gravity Wiz Populate Anything to add Image Choices from post featured image
<?php
add_filter( "gppa_input_choices", "gppa_populate_featured_image_choices", 100, 3 );
function gppa_populate_featured_image_choices( $choices, $field, $objects ) {
if ( ! property_exists($field, 'imageChoices_enableImages') || ! $field->imageChoices_enableImages ) {
return $choices;
}
$i = 0;
@KZeni
KZeni / gf-auto-populate-save-continue-email.php
Last active September 11, 2020 20:14
Gravity Forms auto-populate Save and Continue Later email field with the current user's email address Based on https://docs.gravityforms.com/gform_pre_process/#4-use-a-form-field-as-email-for-the-save-and-continue-confirmation via https://www.gravityforms.com/gravity-forms-v1-9-save-continue/#comment-23296. Call via functions.php or include inline.
<?php
// Auto-populate Save and Continue Later email field with the current user's email address (on all forms per `gform_pre_process`. Otherwise `gform_pre_process_2`, etc. can be used for specific forms by specifying the ID at the end of the action name. Based on https://docs.gravityforms.com/gform_pre_process/#4-use-a-form-field-as-email-for-the-save-and-continue-confirmation via https://www.gravityforms.com/gravity-forms-v1-9-save-continue/#comment-23296)
// See https://gist.github.com/KZeni/180b2d7378bc6f9fc96da4fa29334709 for latest snippet
add_action( 'gform_pre_process', function ( $form ) {
if ( rgpost( 'gform_save' ) ) {
global $current_user;
get_currentuserinfo();
$current_user_email = $current_user->user_email;
$resume_email = isset( $_POST['gform_resume_email'] ) ? $_POST['gform_resume_email'] : $current_user_email; // Use the supplied resume email if one was specified; otherwise, use the current user's email address as the fallback.
$_POST['gform_resume_email'] = $resume_email;
@KZeni
KZeni / How to create a polygon in WP Google Maps from existing region or boundary data.md
Last active June 17, 2022 21:05
How to create a polygon in WP Google Maps from existing region/boundary data (countries, states, provinces, counties, regions, etc.) Ex. https://gist.github.com/KZeni/348b6e0a8298a91ed75fd5ec409a49c9 is US States created using this exact process.

If it shows up as a region when searching via https://nominatim.openstreetmap.org then this process will work. This includes countries, states, counties, cities, parks, and more. OpenStreetMap can be a very valuable tool for map data (the Wikipedia of maps, in a way.)

Free-handing the polygons via the WP Google Maps polygon editor is an option (click to place/remove points, etc. when adding/editing a polygon on a map), but below gets officially detailed & accurate data that prevents overlapping, gaps, and can save time depending on how accurate you want the polygon(s) to be. Below involves a fair number of steps, but this should be the entire process & each step should be rather quick.

https://gis.stackexchange.com/a/192298/151627 and https://gis.stackexchange.com/a/284305/151627 kinda outline the start of things, but here’s the full set of steps.

  1. Do a search for the