Version Description
Download this release
Release Info
Developer | digitalchild |
Plugin | WC Vendors |
Version | 2.2.1 |
Comparing to | |
See all releases |
Code changes from version 2.2.0 to 2.2.1
- assets/js/admin/wcv-vendor-select.js +3 -1
- changelog.txt +10 -0
- class-wc-vendors.php +3 -3
- classes/admin/class-product-meta.php +1 -1
- classes/admin/class-wcv-admin-import-export.php +61 -1
- classes/front/dashboard/class-vendor-dashboard.php +20 -13
- readme.txt +12 -2
- templates/dashboard/denied.php +2 -2
assets/js/admin/wcv-vendor-select.js
CHANGED
@@ -1,7 +1,9 @@
|
|
1 |
(function ($) {
|
2 |
var debouncedInit = debounce(initSelect2, 100);
|
3 |
|
4 |
-
$(document).
|
|
|
|
|
5 |
$('button.editinline').on('click', debouncedInit);
|
6 |
$('#doaction').on('click', function () {
|
7 |
if ($('#bulk-action-selector-top').val() === 'edit')
|
1 |
(function ($) {
|
2 |
var debouncedInit = debounce(initSelect2, 100);
|
3 |
|
4 |
+
$( 'document' ).ready( function () {
|
5 |
+
initSelect2();
|
6 |
+
});
|
7 |
$('button.editinline').on('click', debouncedInit);
|
8 |
$('#doaction').on('click', function () {
|
9 |
if ($('#bulk-action-selector-top').val() === 'edit')
|
changelog.txt
CHANGED
@@ -1,5 +1,15 @@
|
|
1 |
Changelog for WC Vendors Marketplace
|
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
Version 2.2.0 - 13th August 2020
|
4 |
|
5 |
* Added: Support for WC4.4 and WP5.5 (#674)
|
1 |
Changelog for WC Vendors Marketplace
|
2 |
|
3 |
+
Version 2.2.1 - 28th August 2020
|
4 |
+
|
5 |
+
* Fixed: Permission check for product imports (#685)
|
6 |
+
* Fixed: Depreciated JS in WP 5.5 #680 (#684)
|
7 |
+
* Fixed: Product and category search not working on Products Page (#679)
|
8 |
+
* Fixed: Solve error on Gutenberg save
|
9 |
+
|
10 |
+
Templates Updated:
|
11 |
+
templates/dashboard/denied.php
|
12 |
+
|
13 |
Version 2.2.0 - 13th August 2020
|
14 |
|
15 |
* Added: Support for WC4.4 and WP5.5 (#674)
|
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.2.
|
11 |
* Requires at least: 5.3.0
|
12 |
* Tested up to: 5.5
|
13 |
* WC requires at least: 4.0
|
14 |
-
* WC tested up to: 4.
|
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.2.
|
101 |
|
102 |
/**
|
103 |
* @var
|
7 |
* Author URI: https://www.wcvendors.com
|
8 |
* GitHub Plugin URI: https://github.com/wcvendors/wcvendors
|
9 |
*
|
10 |
+
* Version: 2.2.1
|
11 |
* Requires at least: 5.3.0
|
12 |
* Tested up to: 5.5
|
13 |
* WC requires at least: 4.0
|
14 |
+
* WC tested up to: 4.4.1
|
15 |
*
|
16 |
* Text Domain: wc-vendors
|
17 |
* Domain Path: /languages/
|
97 |
*/
|
98 |
class WC_Vendors {
|
99 |
|
100 |
+
public $version = '2.2.1';
|
101 |
|
102 |
/**
|
103 |
* @var
|
classes/admin/class-product-meta.php
CHANGED
@@ -179,7 +179,7 @@ class WCV_Product_Meta {
|
|
179 |
$users = get_users( $user_args );
|
180 |
|
181 |
$output = "<select style='width:200px;' name='$id' id='$id' class='wcv-vendor-select $class'>\n";
|
182 |
-
$output .= "\t<option value='
|
183 |
foreach ( (array) $users as $user ) {
|
184 |
$select = selected( $user->ID, $selected, false );
|
185 |
$output .= "<option value='$user->ID' $select>$user->display_name</option>";
|
179 |
$users = get_users( $user_args );
|
180 |
|
181 |
$output = "<select style='width:200px;' name='$id' id='$id' class='wcv-vendor-select $class'>\n";
|
182 |
+
$output .= "\t<option value=''>$placeholder</option>\n";
|
183 |
foreach ( (array) $users as $user ) {
|
184 |
$select = selected( $user->ID, $selected, false );
|
185 |
$output .= "<option value='$user->ID' $select>$user->display_name</option>";
|
classes/admin/class-wcv-admin-import-export.php
CHANGED
@@ -54,6 +54,8 @@ class WCV_Admin_Import_Export {
|
|
54 |
add_filter( 'woocommerce_product_export_product_default_columns', array( $this, 'add_export_column' ));
|
55 |
add_filter( 'woocommerce_product_export_product_column_vendor_id', array( $this, 'add_export_data'), 10, 2 );
|
56 |
add_filter( 'woocommerce_product_import_inserted_product_object', array( $this, 'process_import'), 10, 2 );
|
|
|
|
|
57 |
}
|
58 |
|
59 |
/**
|
@@ -98,11 +100,15 @@ class WCV_Admin_Import_Export {
|
|
98 |
*/
|
99 |
function process_import( $object, $data ) {
|
100 |
|
|
|
|
|
|
|
|
|
101 |
if ( is_a( $object, 'WC_Product' ) || is_a( $object, 'WC_Product_Variation' ) ) {
|
102 |
|
103 |
$post = array(
|
104 |
'ID' => $object->get_id(),
|
105 |
-
'post_author' => $data['vendor_id'],
|
106 |
);
|
107 |
|
108 |
$update = wp_update_post( $post );
|
@@ -112,6 +118,60 @@ class WCV_Admin_Import_Export {
|
|
112 |
return $object;
|
113 |
}
|
114 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
115 |
/**
|
116 |
* Add the custom column to the exporter and the exporter column menu.
|
117 |
*
|
54 |
add_filter( 'woocommerce_product_export_product_default_columns', array( $this, 'add_export_column' ));
|
55 |
add_filter( 'woocommerce_product_export_product_column_vendor_id', array( $this, 'add_export_data'), 10, 2 );
|
56 |
add_filter( 'woocommerce_product_import_inserted_product_object', array( $this, 'process_import'), 10, 2 );
|
57 |
+
add_filter( 'woocommerce_product_import_process_item_data', array( $this, 'check_product_owner' ) );
|
58 |
+
add_filter( 'woocommerce_new_product_data', array( $this, 'avoid_empty_product' ) );
|
59 |
}
|
60 |
|
61 |
/**
|
100 |
*/
|
101 |
function process_import( $object, $data ) {
|
102 |
|
103 |
+
if ( ! $this->is_product_author( $data ) ) {
|
104 |
+
return $object;
|
105 |
+
}
|
106 |
+
|
107 |
if ( is_a( $object, 'WC_Product' ) || is_a( $object, 'WC_Product_Variation' ) ) {
|
108 |
|
109 |
$post = array(
|
110 |
'ID' => $object->get_id(),
|
111 |
+
'post_author' => isset( $data['vendor_id'] ) ? $data['vendor_id'] : get_current_user_id(),
|
112 |
);
|
113 |
|
114 |
$update = wp_update_post( $post );
|
118 |
return $object;
|
119 |
}
|
120 |
|
121 |
+
/**
|
122 |
+
* Check product owner
|
123 |
+
*
|
124 |
+
* Check who owns the product. If the current user is not the owner of the product,
|
125 |
+
* create a new product for the current user, or do nothing.
|
126 |
+
*
|
127 |
+
* @param data $data The product raw data.
|
128 |
+
* @return object
|
129 |
+
* @version 2.2.1
|
130 |
+
* @since 2.2.1
|
131 |
+
*/
|
132 |
+
public function check_product_owner( $data ) {
|
133 |
+
|
134 |
+
if ( ! $this->is_product_author( $data ) ) {
|
135 |
+
return array();
|
136 |
+
}
|
137 |
+
|
138 |
+
return $data;
|
139 |
+
}
|
140 |
+
|
141 |
+
/**
|
142 |
+
* Avoid creating an empty product
|
143 |
+
*
|
144 |
+
* @param bool $data Product args.
|
145 |
+
* @return bool
|
146 |
+
* @version 2.2.1
|
147 |
+
* @since 2.2.1
|
148 |
+
*/
|
149 |
+
public function avoid_empty_product( $data ) {
|
150 |
+
if ( ! $this->is_product_author( $data ) && isset( $data['post_title'] ) && __( 'Product', 'woocommerce' ) === $data['post_title'] ) {
|
151 |
+
return array();
|
152 |
+
}
|
153 |
+
|
154 |
+
return $data;
|
155 |
+
}
|
156 |
+
|
157 |
+
/**
|
158 |
+
* Check if the current user is the product vendor
|
159 |
+
*
|
160 |
+
* @param array $data The product data.
|
161 |
+
* @return boolean
|
162 |
+
* @version 2.2.1
|
163 |
+
* @since 2.2.1
|
164 |
+
*/
|
165 |
+
public function is_product_author( $data ) {
|
166 |
+
$vendor_id = get_current_user_id();
|
167 |
+
|
168 |
+
if ( isset( $data['vendor_id'] ) && $vendor_id == $data['vendor_id'] ) {
|
169 |
+
return true;
|
170 |
+
}
|
171 |
+
|
172 |
+
return false;
|
173 |
+
}
|
174 |
+
|
175 |
/**
|
176 |
* Add the custom column to the exporter and the exporter column menu.
|
177 |
*
|
classes/front/dashboard/class-vendor-dashboard.php
CHANGED
@@ -232,16 +232,29 @@ class WCV_Vendor_Dashboard {
|
|
232 |
* @return unknown
|
233 |
*/
|
234 |
public function display_vendor_products( $atts ) {
|
|
|
235 |
ob_start();
|
236 |
|
237 |
global $start_date, $end_date;
|
238 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
239 |
$start_date = WC()->session->get( 'wcv_order_start_date', strtotime( current_time( 'Y-M' ) . '-01' ) );
|
240 |
$end_date = WC()->session->get( 'wcv_order_end_date', current_time( 'timestamp' ) );
|
241 |
|
242 |
$can_view_orders = wc_string_to_bool( get_option( 'wcvendors_capability_orders_enabled', 'no' ) );
|
243 |
|
244 |
if ( ! $this->can_view_vendor_page() ) {
|
|
|
245 |
return ob_get_clean();
|
246 |
}
|
247 |
|
@@ -444,24 +457,18 @@ class WCV_Vendor_Dashboard {
|
|
444 |
}
|
445 |
|
446 |
/**
|
|
|
447 |
*
|
448 |
-
*
|
449 |
-
*
|
|
|
450 |
*/
|
451 |
public static function can_view_vendor_page() {
|
452 |
-
if ( ! is_user_logged_in() ) {
|
453 |
-
|
454 |
return false;
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
wc_get_template( 'denied.php', array(), 'wc-vendors/dashboard/', wcv_plugin_dir . 'templates/dashboard/' );
|
459 |
-
|
460 |
-
return false;
|
461 |
-
|
462 |
}
|
463 |
-
|
464 |
-
return true;
|
465 |
}
|
466 |
|
467 |
/**
|
232 |
* @return unknown
|
233 |
*/
|
234 |
public function display_vendor_products( $atts ) {
|
235 |
+
|
236 |
ob_start();
|
237 |
|
238 |
global $start_date, $end_date;
|
239 |
|
240 |
+
// Need to check if the session exists and if it doesn't create it
|
241 |
+
if ( null === WC()->session ) {
|
242 |
+
$session_class = apply_filters( 'woocommerce_session_handler', 'WC_Session_Handler' );
|
243 |
+
// Prefix session class with global namespace if not already namespaced
|
244 |
+
if ( false === strpos( $session_class, '\\' ) ) {
|
245 |
+
$session_class = '\\' . $session_class;
|
246 |
+
}
|
247 |
+
WC()->session = new $session_class();
|
248 |
+
WC()->session->init();
|
249 |
+
}
|
250 |
+
|
251 |
$start_date = WC()->session->get( 'wcv_order_start_date', strtotime( current_time( 'Y-M' ) . '-01' ) );
|
252 |
$end_date = WC()->session->get( 'wcv_order_end_date', current_time( 'timestamp' ) );
|
253 |
|
254 |
$can_view_orders = wc_string_to_bool( get_option( 'wcvendors_capability_orders_enabled', 'no' ) );
|
255 |
|
256 |
if ( ! $this->can_view_vendor_page() ) {
|
257 |
+
wc_get_template( 'denied.php', array(), 'wc-vendors/dashboard/', wcv_plugin_dir . 'templates/dashboard/' );
|
258 |
return ob_get_clean();
|
259 |
}
|
260 |
|
457 |
}
|
458 |
|
459 |
/**
|
460 |
+
* Can the user view this page.
|
461 |
*
|
462 |
+
* @version 2.2.1
|
463 |
+
*
|
464 |
+
* @return bool
|
465 |
*/
|
466 |
public static function can_view_vendor_page() {
|
467 |
+
if ( ! is_user_logged_in() || ! WCV_Vendors::is_vendor( get_current_user_id() ) ) {
|
|
|
468 |
return false;
|
469 |
+
} else {
|
470 |
+
return true;
|
|
|
|
|
|
|
|
|
|
|
471 |
}
|
|
|
|
|
472 |
}
|
473 |
|
474 |
/**
|
readme.txt
CHANGED
@@ -8,8 +8,8 @@ Requires at least: 5.0.0
|
|
8 |
Requires PHP: 7.2
|
9 |
Tested up to: 5.5
|
10 |
WC requires at least: 4.0.0
|
11 |
-
WC tested up to: 4.
|
12 |
-
Stable tag: 2.2.
|
13 |
License: GPLv2 or later
|
14 |
|
15 |
The number one most downloaded marketplace plugin for WooCommerce. Now you can allow anyone to open a store on your WooCommerce site!
|
@@ -254,6 +254,16 @@ WC Vendors Marketplace does not work with multisite WordPress. There are no plan
|
|
254 |
|
255 |
== Changelog ==
|
256 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
257 |
= Version 2.2.0 - 13th August 2020 =
|
258 |
|
259 |
* Added: Support for WC4.4 and WP5.5 (#674)
|
8 |
Requires PHP: 7.2
|
9 |
Tested up to: 5.5
|
10 |
WC requires at least: 4.0.0
|
11 |
+
WC tested up to: 4.4.1
|
12 |
+
Stable tag: 2.2.1
|
13 |
License: GPLv2 or later
|
14 |
|
15 |
The number one most downloaded marketplace plugin for WooCommerce. Now you can allow anyone to open a store on your WooCommerce site!
|
254 |
|
255 |
== Changelog ==
|
256 |
|
257 |
+
= Version 2.2.1 - 28th August 2020 =
|
258 |
+
|
259 |
+
* Fixed: Permission check for product imports (#685)
|
260 |
+
* Fixed: Depreciated JS in WP 5.5 #680 (#684)
|
261 |
+
* Fixed: Product and category search not working on Products Page (#679)
|
262 |
+
* Fixed: Solve error on Gutenberg save
|
263 |
+
|
264 |
+
Templates Updated:
|
265 |
+
templates/dashboard/denied.php
|
266 |
+
|
267 |
= Version 2.2.0 - 13th August 2020 =
|
268 |
|
269 |
* Added: Support for WC4.4 and WP5.5 (#674)
|
templates/dashboard/denied.php
CHANGED
@@ -6,7 +6,7 @@
|
|
6 |
*
|
7 |
* @author Jamie Madden, WC Vendors
|
8 |
* @package WCVendors/Templates/dashboard
|
9 |
-
* @version 2.
|
10 |
*/
|
11 |
|
12 |
if ( ! defined( 'ABSPATH' ) ) {
|
@@ -14,7 +14,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
14 |
}
|
15 |
?>
|
16 |
|
17 |
-
<?php wc_print_notices(); ?>
|
18 |
|
19 |
<?php if ( WCV_Vendors::is_pending( get_current_user_id() ) ) { ?>
|
20 |
|
6 |
*
|
7 |
* @author Jamie Madden, WC Vendors
|
8 |
* @package WCVendors/Templates/dashboard
|
9 |
+
* @version 2.2.1
|
10 |
*/
|
11 |
|
12 |
if ( ! defined( 'ABSPATH' ) ) {
|
14 |
}
|
15 |
?>
|
16 |
|
17 |
+
<?php if ( function_exists( 'wc_print_notices' ) ) { wc_print_notices(); } ?>
|
18 |
|
19 |
<?php if ( WCV_Vendors::is_pending( get_current_user_id() ) ) { ?>
|
20 |
|