Discount Rules for WooCommerce - Version 1.4.34

Version Description

  • 22/12/17 =
  • Feature - Option to choose Guest in user role
Download this release

Release Info

Developer flycart
Plugin Icon 128x128 Discount Rules for WooCommerce
Version 1.4.34
Comparing to
See all releases

Code changes from version 1.4.33 to 1.4.34

helper/general-helper.php CHANGED
@@ -36,7 +36,9 @@ if ( ! class_exists( 'FlycartWooDiscountRulesGeneralHelper' ) ) {
36
  $category = $this->getCategoryList();
37
  $users = $this->getUserList();
38
  $userRoles = $this->getUserRoles();
 
39
  $countries = $this->getAllCountries();
 
40
  if (!isset($config)) return false;
41
  if (!isset($path) or is_null($config)) return false;
42
  include($path);
@@ -202,7 +204,11 @@ if ( ! class_exists( 'FlycartWooDiscountRulesGeneralHelper' ) ) {
202
  public static function getCurrentUserRoles()
203
  {
204
  $current_user = wp_get_current_user();
205
- return $current_user->roles;
 
 
 
 
206
  }
207
 
208
  /**
36
  $category = $this->getCategoryList();
37
  $users = $this->getUserList();
38
  $userRoles = $this->getUserRoles();
39
+ $userRoles['woo_discount_rules_guest'] = esc_html__('Guest', 'woo-discount-rules');
40
  $countries = $this->getAllCountries();
41
+
42
  if (!isset($config)) return false;
43
  if (!isset($path) or is_null($config)) return false;
44
  include($path);
204
  public static function getCurrentUserRoles()
205
  {
206
  $current_user = wp_get_current_user();
207
+ $userRoles = $current_user->roles;
208
+ if(get_current_user_id() == 0){
209
+ $userRoles[] = 'woo_discount_rules_guest';
210
+ }
211
+ return $userRoles;
212
  }
213
 
214
  /**
includes/cart-rules.php CHANGED
@@ -734,7 +734,7 @@ if (!class_exists('FlycartWooDiscountRulesCartRules')) {
734
  return true;
735
  break;
736
  case 'roles_in':
737
- if (get_current_user_id() == 0 || count(array_intersect(FlycartWooDiscountRulesGeneralHelper::getCurrentUserRoles(), $rule)) == 0) {
738
  return false;
739
  }
740
  return true;
734
  return true;
735
  break;
736
  case 'roles_in':
737
+ if (count(array_intersect(FlycartWooDiscountRulesGeneralHelper::getCurrentUserRoles(), $rule)) == 0) {
738
  return false;
739
  }
740
  return true;
includes/pricing-rules.php CHANGED
@@ -627,7 +627,7 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
627
  public function checkWithUserRoles($rule){
628
  $user_roles_to_apply = json_decode($rule->user_roles_to_apply, true);
629
  if(!empty($user_roles_to_apply)){
630
- if (get_current_user_id() == 0 || count(array_intersect(FlycartWooDiscountRulesGeneralHelper::getCurrentUserRoles(), $user_roles_to_apply)) == 0) {
631
  return false;
632
  }
633
  }
627
  public function checkWithUserRoles($rule){
628
  $user_roles_to_apply = json_decode($rule->user_roles_to_apply, true);
629
  if(!empty($user_roles_to_apply)){
630
+ if (count(array_intersect(FlycartWooDiscountRulesGeneralHelper::getCurrentUserRoles(), $user_roles_to_apply)) == 0) {
631
  return false;
632
  }
633
  }
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://flycart.org/
4
  Tags: woocommerce, ecommerce, discounts, coupons, promotion, campaigns, sales, price rules, advanced coupons, advanced discounts
5
  Requires at least: 4.4.1
6
  Tested up to: 4.9
7
- Stable tag: 1.4.33
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -238,6 +238,9 @@ Discount - Enter minimum & Maximum quantity -> Adjustment Type -> Product Discou
238
 
239
  == Changelog ==
240
 
 
 
 
241
  = 1.4.33 - 19/12/17 =
242
  * Fix - error message while update check
243
  * Fix - Product category based, not worked for variant product
4
  Tags: woocommerce, ecommerce, discounts, coupons, promotion, campaigns, sales, price rules, advanced coupons, advanced discounts
5
  Requires at least: 4.4.1
6
  Tested up to: 4.9
7
+ Stable tag: 1.4.34
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
238
 
239
  == Changelog ==
240
 
241
+ = 1.4.34 - 22/12/17 =
242
+ * Feature - Option to choose Guest in user role
243
+
244
  = 1.4.33 - 19/12/17 =
245
  * Fix - error message while update check
246
  * Fix - Product category based, not worked for variant product
woo-discount-rules.php CHANGED
@@ -5,7 +5,7 @@
5
  * Description: Simple Discount Rules for WooCommerce.
6
  * Author: Flycart Technologies LLP
7
  * Author URI: https://www.flycart.org
8
- * Version: 1.4.33
9
  * Slug: woo-discount-rules
10
  * Text Domain: woo-discount-rules
11
  * Requires at least: 4.6.1
5
  * Description: Simple Discount Rules for WooCommerce.
6
  * Author: Flycart Technologies LLP
7
  * Author URI: https://www.flycart.org
8
+ * Version: 1.4.34
9
  * Slug: woo-discount-rules
10
  * Text Domain: woo-discount-rules
11
  * Requires at least: 4.6.1