This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Fail2Ban action configuration file for CloudFlare REST API V4 using Authorization Bearer Token | |
# | |
# Author: Dale Rider | |
# | |
# This action depends on curl, python, jq, and xargs. | |
# | |
# To get your CloudFlare Authorization Bearer Token: https://dash.cloudflare.com/profile/api-tokens | |
# Your Authorization Bearer Token must have read-write-delete access to your firewall rules. | |
# | |
# CloudFlare API firewall rules documentation: https://developers.cloudflare.com/api/operations/ip-access-rules-for-a-zone-create-an-ip-access-rule |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Change payment status straight to on-hold after successful payment | |
* | |
* By using this hook instead of 'woocommerce_thankyou' you intercept the order status change before emails are sent. | |
* By doing it this way the only email that will be sent to the customer is the one for an on-hold order. | |
*/ | |
add_filter('woocommerce_payment_complete_order_status', 'semper_woocommerce_payment_complete_order_status', 10, 2 ); | |
function semper_woocommerce_payment_complete_order_status( $order_status, $order_id ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Redirect Wordpress uploads folder to a different domain. | |
# (Very useful on local dev environment to avoid having to download the entire uploads folder) | |
RewriteEngine on | |
RewriteCond %{REQUEST_URI} ^/wp-content/uploads/[^\/]*/.*$ | |
RewriteRule ^(.*)$ http://domain.com/$1 [QSA,L] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Hide normal add-to-cart buttonsfor logged-out users, filtering by category, and change add-to-cart buttons to login redirect. | |
*/ | |
add_filter('woocommerce_is_purchasable', 'semper_modify_purchasable'); | |
function semper_modify_purchasable( $is_purchasable ) { | |
if ((has_term('hoodies', 'product_cat') && !is_user_logged_in())) { | |
if (is_singular()) { | |
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function semper_load_recaptcha_badge() { | |
if ( !is_page( array( 'checkout', 'login' ) ) ) { | |
wp_dequeue_script('google-recaptcha'); | |
} | |
} | |
add_action( 'wp_enqueue_scripts', 'semper_load_recaptcha_badge', 100 ); |