WC Vendors - Version 2.1.7

Version Description

Download this release

Release Info

Developer digitalchild
Plugin Icon 128x128 WC Vendors
Version 2.1.7
Comparing to
See all releases

Code changes from version 2.1.6 to 2.1.7

changelog.txt CHANGED
@@ -1,5 +1,23 @@
1
  Changelog for WC Vendors Marketplace
2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  Version 2.1.6
4
 
5
  * Added: newsletter signup in setup wizard
1
  Changelog for WC Vendors Marketplace
2
 
3
+ Version 2.1.7
4
+
5
+ * Added: sold_by shortcode #542
6
+ * Updated: Made approval link in admin product emails clickable
7
+ * Updated: WooCommerce tested to
8
+ * Updated: Email Admin notify template to include clickable link
9
+ * Fixed: Vendor application email firing when Pro is activated
10
+ * Fixed: Email details incorrect when Manually approved unchecked. #520
11
+ * Fixed: is_pending check when using multiple roles
12
+ * Fixed: Vendor Notify Approved / Denied not working #543
13
+ * Fixed: Commission notice when pro is active
14
+ * Fixed: Update notice not completing
15
+
16
+ Templates Updated:
17
+ templates/emails/admin-notify-application.php
18
+ templates/emails/admin-notify-product.php
19
+
20
+
21
  Version 2.1.6
22
 
23
  * Added: newsletter signup in setup wizard
class-wc-vendors.php CHANGED
@@ -7,11 +7,11 @@
7
  * Author URI: https://www.wcvendors.com
8
  * GitHub Plugin URI: https://github.com/wcvendors/wcvendors
9
  *
10
- * Version: 2.1.6
11
  * Requires at least: 4.4.0
12
  * Tested up to: 5.1
13
  * WC requires at least: 3.3.0
14
- * WC tested up to: 3.5.6
15
  *
16
  * Text Domain: wc-vendors
17
  * Domain Path: /languages/
@@ -97,7 +97,7 @@ if ( wcv_is_woocommerce_activated() ) {
97
  */
98
  class WC_Vendors {
99
 
100
- public $version = '2.1.6';
101
 
102
  /**
103
  * @var
7
  * Author URI: https://www.wcvendors.com
8
  * GitHub Plugin URI: https://github.com/wcvendors/wcvendors
9
  *
10
+ * Version: 2.1.7
11
  * Requires at least: 4.4.0
12
  * Tested up to: 5.1
13
  * WC requires at least: 3.3.0
14
+ * WC tested up to: 3.5.7
15
  *
16
  * Text Domain: wc-vendors
17
  * Domain Path: /languages/
97
  */
98
  class WC_Vendors {
99
 
100
+ public $version = '2.1.7';
101
 
102
  /**
103
  * @var
classes/admin/class-admin-users.php CHANGED
@@ -401,7 +401,11 @@ class WCV_Admin_Users {
401
 
402
  update_user_meta( $vendor_id, 'pv_paypal', $_POST['pv_paypal'] );
403
  update_user_meta( $vendor_id, 'pv_shop_html_enabled', isset( $_POST['pv_shop_html_enabled'] ) );
404
- update_user_meta( $vendor_id, 'pv_custom_commission_rate', $_POST['pv_custom_commission_rate'] );
 
 
 
 
405
  update_user_meta( $vendor_id, 'pv_shop_description', $_POST['pv_shop_description'] );
406
  update_user_meta( $vendor_id, 'pv_seller_info', $_POST['pv_seller_info'] );
407
  update_user_meta( $vendor_id, 'wcv_give_vendor_tax', isset( $_POST['wcv_give_vendor_tax'] ) );
401
 
402
  update_user_meta( $vendor_id, 'pv_paypal', $_POST['pv_paypal'] );
403
  update_user_meta( $vendor_id, 'pv_shop_html_enabled', isset( $_POST['pv_shop_html_enabled'] ) );
404
+
405
+ if ( apply_filters( 'wcvendors_admin_user_meta_commission_rate_enable', true ) ){
406
+ update_user_meta( $vendor_id, 'pv_custom_commission_rate', $_POST['pv_custom_commission_rate'] );
407
+ }
408
+
409
  update_user_meta( $vendor_id, 'pv_shop_description', $_POST['pv_shop_description'] );
410
  update_user_meta( $vendor_id, 'pv_seller_info', $_POST['pv_seller_info'] );
411
  update_user_meta( $vendor_id, 'wcv_give_vendor_tax', isset( $_POST['wcv_give_vendor_tax'] ) );
classes/admin/emails/class-emails.php CHANGED
@@ -38,9 +38,14 @@ class WCV_Emails {
38
  add_action( 'wcvendors_email_customer_details', array( $this, 'vendor_customer_details' ), 10, 4 );
39
 
40
  if ( is_wcv_pro_active() ) {
41
- add_action( 'wcv_pro_store_settings_saved', array( $this, 'vendor_application' ), 10, 1 );
 
 
 
 
 
42
  } else {
43
- add_action( 'set_user_role', array( $this, 'vendor_application' ), 10, 2 );
44
  }
45
 
46
  // WooCommerce Product Enquiry Compatibility
@@ -193,8 +198,10 @@ class WCV_Emails {
193
  * Trigger the vendor application emails
194
  *
195
  * @since 2.0.0
 
196
  */
197
  public function vendor_application( $user_id, $role = '' ) {
 
198
  /**
199
  * If the role is not given, set it according to the vendor approval option in admin
200
  */
@@ -203,24 +210,16 @@ class WCV_Emails {
203
  $role = apply_filters( 'wcvendors_pending_role', ( $manual ? 'pending_vendor' : 'vendor' ) );
204
  }
205
 
206
- if ( ! empty( $_POST['apply_for_vendor'] ) || ( ! empty( $_GET['action'] ) && ( $_GET['action'] == 'approve_vendor' || $_GET['action'] == 'deny_vendor' ) ) ) {
207
-
208
- $role = ( $role != 'pending_vendor' && $role != 'vendor' ) ? 'pending_vendor' : $role;
209
- if ( ! empty( $_GET['action'] ) && $_GET['action'] == 'deny_vendor' ) {
210
- $reason = isset( $_GET['reason'] ) ? $_GET['reason'] : '';
211
- WC()->mailer()->emails['WCVendors_Vendor_Notify_Denied']->trigger( $user_id, $reason );
212
- $status = __( 'denied', 'wc-vendors' );
213
- } elseif ( $role == 'pending_vendor' ) {
214
- WC()->mailer()->emails['WCVendors_Vendor_Notify_Application']->trigger( $user_id, __( 'pending', 'wc-vendors' ) );
215
- $status = __( 'pending', 'wc-vendors' );
216
- } elseif ( $role == 'vendor' ) {
217
- WC()->mailer()->emails['WCVendors_Vendor_Notify_Approved']->trigger( $user_id );
218
- $status = __( 'approved', 'wc-vendors' );
219
- }
220
-
221
  WC()->mailer()->emails['WCVendors_Admin_Notify_Application']->trigger( $user_id, $status );
222
-
223
  }
 
224
  }
225
 
226
  /*
38
  add_action( 'wcvendors_email_customer_details', array( $this, 'vendor_customer_details' ), 10, 4 );
39
 
40
  if ( is_wcv_pro_active() ) {
41
+ $manual = wc_string_to_bool( get_option( 'wcvendors_vendor_approve_registration', 'no' ) );
42
+ if ( $manual ){
43
+ add_action( 'wcv_pro_store_settings_saved', array( $this, 'vendor_application' ), 10, 2 );
44
+ } else {
45
+ add_action( 'add_user_role', array( $this, 'vendor_application' ), 10, 2 );
46
+ }
47
  } else {
48
+ add_action( 'add_user_role', array( $this, 'vendor_application' ), 10, 2 );
49
  }
50
 
51
  // WooCommerce Product Enquiry Compatibility
198
  * Trigger the vendor application emails
199
  *
200
  * @since 2.0.0
201
+ * @version 2.1.7
202
  */
203
  public function vendor_application( $user_id, $role = '' ) {
204
+
205
  /**
206
  * If the role is not given, set it according to the vendor approval option in admin
207
  */
210
  $role = apply_filters( 'wcvendors_pending_role', ( $manual ? 'pending_vendor' : 'vendor' ) );
211
  }
212
 
213
+ if ( $role == 'pending_vendor' ) {
214
+ $status = __( 'pending', 'wc-vendors' );
215
+ WC()->mailer()->emails['WCVendors_Vendor_Notify_Application']->trigger( $user_id, $status );
216
+ WC()->mailer()->emails['WCVendors_Admin_Notify_Application']->trigger( $user_id, $status );
217
+ } elseif ( $role == 'vendor' ) {
218
+ $status = __( 'approved', 'wc-vendors' );
219
+ WC()->mailer()->emails['WCVendors_Vendor_Notify_Approved']->trigger( $user_id, $status );
 
 
 
 
 
 
 
 
220
  WC()->mailer()->emails['WCVendors_Admin_Notify_Application']->trigger( $user_id, $status );
 
221
  }
222
+
223
  }
224
 
225
  /*
classes/class-vendors.php CHANGED
@@ -454,11 +454,14 @@ class WCV_Vendors {
454
  */
455
  public static function is_pending( $user_id ) {
456
 
457
- $user = get_userdata( $user_id );
458
-
459
- $role = ! empty( $user->roles ) ? array_shift( $user->roles ) : false;
460
- $is_pending = ( 'pending_vendor' == $role );
461
 
 
 
 
 
 
462
  return $is_pending;
463
  }
464
 
454
  */
455
  public static function is_pending( $user_id ) {
456
 
457
+ $user = get_userdata( $user_id );
458
+ $roles = $user->roles;
 
 
459
 
460
+ if ( is_array( $roles ) ){
461
+ $is_pending = in_array( 'pending_vendor', $roles );
462
+ } else {
463
+ $is_pending = ( 'pending_vendor' == $role );
464
+ }
465
  return $is_pending;
466
  }
467
 
classes/includes/class-wcv-shortcodes.php CHANGED
@@ -33,6 +33,8 @@ class WCV_Shortcodes {
33
  add_shortcode( 'wcv_product_category', array( $this, 'product_category' ) );
34
  // List of paginated vendors
35
  add_shortcode( 'wcv_vendorslist', array( $this, 'wcv_vendorslist' ) );
 
 
36
 
37
  }
38
 
@@ -729,4 +731,24 @@ class WCV_Shortcodes {
729
  return $html;
730
  }
731
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
732
  }
33
  add_shortcode( 'wcv_product_category', array( $this, 'product_category' ) );
34
  // List of paginated vendors
35
  add_shortcode( 'wcv_vendorslist', array( $this, 'wcv_vendorslist' ) );
36
+ // Show the sold by label based on the product page
37
+ add_shortcode( 'wcv_sold_by', array( $this, 'wcv_sold_by' ) );
38
 
39
  }
40
 
731
  return $html;
732
  }
733
 
734
+
735
+ /**
736
+ * Output a sold by link
737
+ */
738
+ public function wcv_sold_by( $atts ){
739
+
740
+ if ( ! is_product() ) return;
741
+
742
+ $vendor_id = get_the_author_meta( 'ID' );
743
+ $sold_by_label = get_option( 'wcvendors_label_sold_by' );
744
+ $sold_by_separator = get_option( 'wcvendors_label_sold_by_separator' );
745
+ $sold_by = WCV_Vendors::is_vendor( $vendor_id )
746
+ ? sprintf( '<a href="%s" class="wcvendors_cart_sold_by_meta">%s</a>', WCV_Vendors::get_vendor_shop_page( $vendor_id ), WCV_Vendors::get_vendor_sold_by( $vendor_id ) )
747
+ : get_bloginfo( 'name' );
748
+
749
+ echo apply_filters( 'wcvendors_cart_sold_by_meta', $sold_by_label, get_the_ID(), $vendor_id ) . '&nbsp;' . apply_filters( 'wcvendors_cart_sold_by_meta_separator', $sold_by_separator, get_the_ID(), $vendor_id ) . '&nbsp;' . $sold_by . '<br/>';
750
+
751
+
752
+ }
753
+
754
  }
classes/includes/wcv-update-functions.php CHANGED
@@ -178,5 +178,5 @@ function wcv_can_view_customer_shipping_name_option() {
178
  * @version 2.1.6
179
  */
180
  function wcv_add_vendor_caps(){
181
- WCVendors_Install::create_capbailities();
182
  }
178
  * @version 2.1.6
179
  */
180
  function wcv_add_vendor_caps(){
181
+ WCVendors_Install::create_capabilities();
182
  }
languages/wc-vendors.pot CHANGED
@@ -264,11 +264,11 @@ msgstr ""
264
  msgid "%s Orders"
265
  msgstr ""
266
 
267
- #: classes/class-vendors.php:616
268
  msgid "%1$s Order &ndash; %2$s"
269
  msgstr ""
270
 
271
- #: classes/class-vendors.php:616
272
  msgctxt "Order date parsed by strftime"
273
  msgid "%1$b %2$d, %Y @ %I:%M %p"
274
  msgstr ""
@@ -954,8 +954,8 @@ msgstr ""
954
  msgid "Applicant username: %s"
955
  msgstr ""
956
 
957
- #: templates/emails/admin-notify-application.php:25, templates/emails/plain/admin-notify-application.php:22
958
- msgid "You can approve or deny the application at the following link %s"
959
  msgstr ""
960
 
961
  #: templates/emails/admin-notify-product.php:18, templates/emails/plain/admin-notify-product.php:20
@@ -970,8 +970,8 @@ msgstr ""
970
  msgid "Submitted by: %s"
971
  msgstr ""
972
 
973
- #: templates/emails/admin-notify-product.php:23, templates/emails/new-product.php:14, templates/emails/plain/admin-notify-product.php:24
974
- msgid "Edit product: %s"
975
  msgstr ""
976
 
977
  #: templates/emails/application-status.php:12
@@ -982,6 +982,10 @@ msgstr ""
982
  msgid "Hi there. This is a notification about a new product on %s."
983
  msgstr ""
984
 
 
 
 
 
985
  #: templates/emails/notify-vendor-shipped.php:19
986
  msgid "A %s has marked part of your order as shipped. The items that are shipped are as follows:"
987
  msgstr ""
@@ -1051,19 +1055,19 @@ msgstr ""
1051
  msgid "Quantity: %d"
1052
  msgstr ""
1053
 
1054
- #: classes/admin/emails/class-emails.php:76, classes/admin/emails/class-emails.php:214, classes/admin/emails/class-emails.php:215, classes/admin/emails/class-wc-approve-vendor.php:72
1055
  msgid "pending"
1056
  msgstr ""
1057
 
1058
- #: classes/admin/emails/class-emails.php:78, classes/admin/emails/class-emails.php:218
1059
  msgid "approved"
1060
  msgstr ""
1061
 
1062
- #: classes/admin/emails/class-emails.php:80, classes/admin/emails/class-emails.php:212
1063
  msgid "denied"
1064
  msgstr ""
1065
 
1066
- #: classes/admin/emails/class-emails.php:161
1067
  msgid "Resend %s new order notification"
1068
  msgstr ""
1069
 
@@ -2533,6 +2537,10 @@ msgstr ""
2533
  msgid "Save"
2534
  msgstr ""
2535
 
 
 
 
 
2536
  #: templates/emails/plain/vendor-notify-cancelled-order.php:19
2537
  msgid "Your order has been cancelled."
2538
  msgstr ""
264
  msgid "%s Orders"
265
  msgstr ""
266
 
267
+ #: classes/class-vendors.php:619
268
  msgid "%1$s Order &ndash; %2$s"
269
  msgstr ""
270
 
271
+ #: classes/class-vendors.php:619
272
  msgctxt "Order date parsed by strftime"
273
  msgid "%1$b %2$d, %Y @ %I:%M %p"
274
  msgstr ""
954
  msgid "Applicant username: %s"
955
  msgstr ""
956
 
957
+ #: templates/emails/admin-notify-application.php:25
958
+ msgid "You can approve or deny the application at the following link <a href=\"%1$s\">%1$s</a>"
959
  msgstr ""
960
 
961
  #: templates/emails/admin-notify-product.php:18, templates/emails/plain/admin-notify-product.php:20
970
  msgid "Submitted by: %s"
971
  msgstr ""
972
 
973
+ #: templates/emails/admin-notify-product.php:23
974
+ msgid "Edit product: <a href=\"%1$s\">%1$s</a>"
975
  msgstr ""
976
 
977
  #: templates/emails/application-status.php:12
982
  msgid "Hi there. This is a notification about a new product on %s."
983
  msgstr ""
984
 
985
+ #: templates/emails/new-product.php:14, templates/emails/plain/admin-notify-product.php:24
986
+ msgid "Edit product: %s"
987
+ msgstr ""
988
+
989
  #: templates/emails/notify-vendor-shipped.php:19
990
  msgid "A %s has marked part of your order as shipped. The items that are shipped are as follows:"
991
  msgstr ""
1055
  msgid "Quantity: %d"
1056
  msgstr ""
1057
 
1058
+ #: classes/admin/emails/class-emails.php:81, classes/admin/emails/class-emails.php:214, classes/admin/emails/class-wc-approve-vendor.php:72
1059
  msgid "pending"
1060
  msgstr ""
1061
 
1062
+ #: classes/admin/emails/class-emails.php:83, classes/admin/emails/class-emails.php:218
1063
  msgid "approved"
1064
  msgstr ""
1065
 
1066
+ #: classes/admin/emails/class-emails.php:85
1067
  msgid "denied"
1068
  msgstr ""
1069
 
1070
+ #: classes/admin/emails/class-emails.php:166
1071
  msgid "Resend %s new order notification"
1072
  msgstr ""
1073
 
2537
  msgid "Save"
2538
  msgstr ""
2539
 
2540
+ #: templates/emails/plain/admin-notify-application.php:22
2541
+ msgid "You can approve or deny the application at the following link %s"
2542
+ msgstr ""
2543
+
2544
  #: templates/emails/plain/vendor-notify-cancelled-order.php:19
2545
  msgid "Your order has been cancelled."
2546
  msgstr ""
package.json CHANGED
@@ -1,6 +1,6 @@
1
  {
2
  "name": "wc-vendors",
3
- "version": "2.1.6",
4
  "private": true,
5
  "dependencies": {},
6
  "devDependencies": {
1
  {
2
  "name": "wc-vendors",
3
+ "version": "2.1.7",
4
  "private": true,
5
  "dependencies": {},
6
  "devDependencies": {
readme.txt CHANGED
@@ -7,7 +7,7 @@ Plugin URI: https://www.wcvendors.com/
7
  Requires at least: 4.4.0
8
  Requires PHP: 5.6
9
  Tested up to: 5.1
10
- Stable tag: 2.1.6
11
  License: GPLv2 or later
12
 
13
  The number one most downloaded marketplace plugin for WooCommerce. Now you can allow anyone to open a store on your WooCommerce site!
@@ -157,6 +157,24 @@ WC Vendors Marketplace does not work with multisite WordPress. There are no plan
157
 
158
  == Changelog ==
159
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
160
  = Version 2.1.6 - 18th March 2019 =
161
 
162
  * Added: newsletter signup in setup wizard
7
  Requires at least: 4.4.0
8
  Requires PHP: 5.6
9
  Tested up to: 5.1
10
+ Stable tag: 2.1.7
11
  License: GPLv2 or later
12
 
13
  The number one most downloaded marketplace plugin for WooCommerce. Now you can allow anyone to open a store on your WooCommerce site!
157
 
158
  == Changelog ==
159
 
160
+ = Version 2.1.7 - 20th March 2019 =
161
+
162
+ * Added: sold_by shortcode #542
163
+ * Updated: Made approval link in admin product emails clickable
164
+ * Updated: WooCommerce tested to
165
+ * Updated: Email Admin notify template to include clickable link
166
+ * Fixed: Vendor application email firing when Pro is activated
167
+ * Fixed: Email details incorrect when Manually approved unchecked. #520
168
+ * Fixed: is_pending check when using multiple roles
169
+ * Fixed: Vendor Notify Approved / Denied not working #543
170
+ * Fixed: Commission notice when pro is active
171
+ * Fixed: Update notice not completing
172
+
173
+ Templates Updated:
174
+ templates/emails/admin-notify-application.php
175
+ templates/emails/admin-notify-product.php
176
+
177
+
178
  = Version 2.1.6 - 18th March 2019 =
179
 
180
  * Added: newsletter signup in setup wizard
templates/emails/admin-notify-application.php CHANGED
@@ -6,7 +6,7 @@
6
  *
7
  * @author Jamie Madden, WC Vendors
8
  * @package WCVendors/Templates/Emails/HTML
9
- * @version 2.0.0
10
  */
11
 
12
  if ( ! defined( 'ABSPATH' ) ) {
@@ -22,7 +22,7 @@ do_action( 'woocommerce_email_header', $email_heading, $email ); ?>
22
 
23
  <?php if ( 'pending' === $status ) : ?>
24
  <p>
25
- <?php printf( __( 'You can approve or deny the application at the following link %s', 'wc-vendors' ), admin_url( 'users.php?role=pending_vendor' ) ); ?>
26
  </p>
27
  <?php endif; ?>
28
 
6
  *
7
  * @author Jamie Madden, WC Vendors
8
  * @package WCVendors/Templates/Emails/HTML
9
+ * @version 2.1.7
10
  */
11
 
12
  if ( ! defined( 'ABSPATH' ) ) {
22
 
23
  <?php if ( 'pending' === $status ) : ?>
24
  <p>
25
+ <?php printf( __( 'You can approve or deny the application at the following link <a href="%1$s">%1$s</a>', 'wc-vendors' ), admin_url( 'users.php?role=pending_vendor' ) ); ?>
26
  </p>
27
  <?php endif; ?>
28
 
templates/emails/admin-notify-product.php CHANGED
@@ -6,7 +6,7 @@
6
  *
7
  * @author Jamie Madden, WC Vendors
8
  * @package WCVendors/Templates/Emails/HTML
9
- * @version 2.0.0
10
  */
11
 
12
  if ( ! defined( 'ABSPATH' ) ) {
@@ -20,7 +20,7 @@ do_action( 'woocommerce_email_header', $email_heading, $email ); ?>
20
  <p>
21
  <?php printf( __( 'Product title: %s', 'wc-vendors' ), $product->get_title() ); ?><br/>
22
  <?php printf( __( 'Submitted by: %s', 'wc-vendors' ), $vendor_name ); ?><br/>
23
- <?php printf( __( 'Edit product: %s', 'wc-vendors' ), admin_url( 'post.php?post=' . $post_id . '&action=edit' ) ); ?>
24
  </p>
25
 
26
  <?php
6
  *
7
  * @author Jamie Madden, WC Vendors
8
  * @package WCVendors/Templates/Emails/HTML
9
+ * @version 2.1.7
10
  */
11
 
12
  if ( ! defined( 'ABSPATH' ) ) {
20
  <p>
21
  <?php printf( __( 'Product title: %s', 'wc-vendors' ), $product->get_title() ); ?><br/>
22
  <?php printf( __( 'Submitted by: %s', 'wc-vendors' ), $vendor_name ); ?><br/>
23
+ <?php printf( __( 'Edit product: <a href="%1$s">%1$s</a>', 'wc-vendors' ), admin_url( 'post.php?post=' . $post_id . '&action=edit' ) ); ?>
24
  </p>
25
 
26
  <?php