Skip to content

Instantly share code, notes, and snippets.

View toddlahman's full-sized avatar

Todd Lahman toddlahman

View GitHub Profile
@toddlahman
toddlahman / gist:6302114
Last active January 18, 2020 09:40
Prevent Duplicate Form Submissions with jQuery
jQuery(function() {
$("form").submit(function() {
// submit more than once return false
$(this).submit(function() {
return false;
});
// submit once return true
return true;
});
});
@toddlahman
toddlahman / gist:6302252
Last active December 21, 2015 11:58
Wordpress Delete All Spam Comments
/* This SQL statement will remove all the unapproved comments at once: */
DELETE FROM wp_comments WHERE comment_approved = '0';
/* This SQL statement will remove all the spam comments at once: */
DELETE FROM wp_comments WHERE comment_approved = 'spam';
/* This SQL statement will remove all pingbacks and trackbacks: */
@toddlahman
toddlahman / gist:6302280
Created August 22, 2013 01:35
Save Plugin Error Messages in the database for The Plugin Generated x Characters of Unexpected Output During Activation errors
<?php
function tl_save_error() {
update_option( 'plugin_error', ob_get_contents() );
}
add_action( 'activated_plugin', 'tl_save_error' );
/* Then to display the error message: */
@toddlahman
toddlahman / gist:8703556
Last active August 29, 2015 13:55
API Manager Software Activation URL Query Example
http://localhost/toddlahman/?wc-api=am-software-api&email=toddlahman%40todds-macbook-pro.local&licence_key=wc_order_52ac24ebed6b0_am_HxntrDLPdYsM&request=activation&product_id=API+Manager+Example&instance=gueGHcbrkdBQ&platform=localhost%2Ftoddlahman&software_version=1.3
@toddlahman
toddlahman / gist:8705314
Last active August 29, 2015 13:55
API Manager Software Deactivation URL Query Example
http://localhost/toddlahman/?wc-api=am-software-api&email=toddlahman%40todds-macbook-pro.local&licence_key=wc_order_52ac24ebed6b0_am_HxntrDLPdYsM&request=deactivation&product_id=API+Manager+Example&instance=gueGHcbrkdBQ&platform=localhost%2Ftoddlahman
@toddlahman
toddlahman / gist:8706318
Last active August 29, 2015 13:55
API Manager Software Update Query URL Example
http://localhost/toddlahman/?wc-api=upgrade-api&request=plugininformation&plugin_name=api-manager-plugin-example%2Fapi-manager-example.php&version=1.3&product_id=API+Manager+Example&api_key=wc_order_52ac24ebed6b0_am_HxntrDLPdYsM&activation_email=toddlahman%40todds-macbook-pro.local&instance=gueGHcbrkdBQ&domain=localhost%2Ftoddlahman&software_version=1.3&extra=
@toddlahman
toddlahman / gist:8706464
Created January 30, 2014 11:05
API Manager Lost API Page Shortcode
[woocommerce_api_manager_lost_api_key]
define(‘DISABLE_WP_CRON’, true);
crontab -e
0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58 * * * * wget -q -O - http://www.mydomainname.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1