Skip to content

Instantly share code, notes, and snippets.

View BrianHenryIE's full-sized avatar
🇮🇪

Brian Henry BrianHenryIE

🇮🇪
View GitHub Profile
@BrianHenryIE
BrianHenryIE / woo_rest_authorisation.php
Created July 1, 2017 21:24
Allow users to read their orders through WooCommerce REST API
add_filter( 'woocommerce_rest_check_permissions', 'rest_check_permissions', 10, 4 );
public function rest_check_permissions( $permission, $context, $object_id, $post_type ) {
$auth_customer = wp_get_current_user();
$auth_customer_id = $auth_customer->ID;
// Bad/no authentication
if ( $auth_customer_id == 0 ) {
return $permission;
diff --git a/class/dashboard_report.php b/class/dashboard_report.php
index 608c265..a59c6c9 100755
--- a/class/dashboard_report.php
+++ b/class/dashboard_report.php
@@ -6,7 +6,7 @@
$order_date="SELECT pw_posts.ID AS order_id, pw_posts.post_date AS order_date, pw_posts.post_status AS order_status FROM {$wpdb->prefix}posts as pw_posts WHERE pw_posts.post_type='shop_order' AND pw_posts.post_status IN ('wc-completed', 'wc-on-hold', 'wc-processing') AND pw_posts.post_status NOT IN ('trash') GROUP BY pw_posts.ID Order By pw_posts.post_date ASC LIMIT 5";
$results= $wpdb->get_results($order_date);
- $first_date='';
+ $first_date = array();
diff --git a/3.0/automation-recipes/triggers/IW_OrderCreation_Trigger.class.php b/3.0/automation-recipes/triggers/IW_OrderCreation_Trigger.class.php
index ebc1110..a00e105 100644
--- a/3.0/automation-recipes/triggers/IW_OrderCreation_Trigger.class.php
+++ b/3.0/automation-recipes/triggers/IW_OrderCreation_Trigger.class.php
@@ -60,7 +60,7 @@ class IW_OrderCreation_Trigger extends IW_Automation_Trigger {
if(!is_admin() && empty($cookie)) {
$wc_order = new WC_Order($order_id);
- $this->user_email = $wc_order->get_billing_email();
+ $this->user_email = $wc_order->billing_email;
diff --git a/sb-woocommerce-email-verification.php b/sb-woocommerce-email-verification.php
index acf3844..b741676 100755
--- a/sb-woocommerce-email-verification.php
+++ b/sb-woocommerce-email-verification.php
@@ -3,7 +3,7 @@
Plugin Name: SB WooCommerce Email Verification
Description: Force customers to verify account before login. Reduce spam users.
Plugin URI: http://codecanyon.net/user/sbthemes/portfolio?ref=sbthemes
- Version: 1.3
+ Version: 1.4.1
diff --git a/sb-woocommerce-email-verification.php b/sb-woocommerce-email-verification.php
index c4e504c..7fca8ac 100755
--- a/sb-woocommerce-email-verification.php
+++ b/sb-woocommerce-email-verification.php
@@ -3,7 +3,7 @@
Plugin Name: SB WooCommerce Email Verification
Description: Force customers to verify account before login. Reduce spam users.
Plugin URI: http://codecanyon.net/user/sbthemes/portfolio?ref=sbthemes
- Version: 1.4.1
+ Version: 1.5
@BrianHenryIE
BrianHenryIE / bh_expected_delivery_time.php
Last active February 18, 2018 12:35
Adds Expected Delivery Time meta box in WooCommerce Product page Shipping options
<?php
// Save in your child theme and add in your functions.php:
// require_once('bh_expected_delivery_time.php');
add_action( 'woocommerce_product_options_shipping', 'bh_expected_delivery_time_field' );
function bh_expected_delivery_time_field() {
// Print a custom text field
woocommerce_wp_text_input( array(
diff --git a/utils/class.WpdiscuzEmailHelper.php b/utils/class.WpdiscuzEmailHelper.php
index c11833c..5cc8da1 100644
--- a/utils/class.WpdiscuzEmailHelper.php
+++ b/utils/class.WpdiscuzEmailHelper.php
@@ -7,6 +7,10 @@ if (!defined('ABSPATH')) {
class WpdiscuzEmailHelper {
private $optionsSerialized;
+
+ /**
diff --git a/includes/class-wp-user-avatar-functions.php b/includes/class-wp-user-avatar-functions.php
index 2a89f4d..fd694e1 100644
--- a/includes/class-wp-user-avatar-functions.php
+++ b/includes/class-wp-user-avatar-functions.php
@@ -409,7 +409,8 @@ class WP_User_Avatar_Functions {
if(!$wpua_functions->wpua_has_gravatar($id_or_email) && $avatar_default == 'wp_user_avatar') {
// Show custom Default Avatar
if(!empty($wpua_avatar_default) && $wpua_functions->wpua_attachment_is_image($wpua_avatar_default)) {
- $wpua_avatar_default_image = $wpua_functions->wpua_get_attachment_image_src($wpua_avatar_default, array($size,$size));
+ $size_numeric_w_x_h = array( get_option( $size . '_size_w' ), get_option( $size . '_size_h' ) );
diff --git a/includes/callback.php b/includes/callback.php
index 81ca282..abe992f 100644
--- a/includes/callback.php
+++ b/includes/callback.php
@@ -74,13 +74,20 @@ if ( isset( $_GET['code'] ) && ! empty( $_GET['code'] ) ) {
$user_info = json_decode( $response['body'] );
$user_id = username_exists( $user_info->user_login );
if ( ! $user_id && email_exists( $user_info->user_email ) == false ) {
-
+
diff --git a/includes/callback.php b/includes/callback.php
index 81ca282..39b15db 100644
--- a/includes/callback.php
+++ b/includes/callback.php
@@ -74,13 +74,22 @@ if ( isset( $_GET['code'] ) && ! empty( $_GET['code'] ) ) {
$user_info = json_decode( $response['body'] );
$user_id = username_exists( $user_info->user_login );
if ( ! $user_id && email_exists( $user_info->user_email ) == false ) {
-
+