WC Vendors - Version 2.1.1

Version Description

Download this release

Release Info

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

Code changes from version 2.1.0 to 2.1.1

changelog.txt CHANGED
@@ -1,5 +1,23 @@
1
  Changelog for WC Vendors Marketplace
2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  Version 2.1.0
4
 
5
  * Added Option to remove "Become a Vendor" tab on the my-account page
@@ -64,7 +82,7 @@ Version 2.0.7
64
  * Updated: Wording for settings
65
 
66
  Templates Updated:
67
- templates/dashboard/dashboard/denied.php
68
 
69
  Version 2.0.6
70
 
1
  Changelog for WC Vendors Marketplace
2
 
3
+ Version 2.1.1
4
+
5
+ * Added: Export Commission Order ID #460
6
+ * Added: Export Commission Totals use filters #459
7
+ * Added: Remove Ability to Register from the WP Login screen. #489
8
+ * Fixed: Invalid variable reference
9
+ * Fixed: Uninistall loading order to ensure table still exists when getting settings fields
10
+ * Fixed: Incorrect capabilities set on initial install and via setup wizard
11
+ * Fixed: Handle PayPal Adaptive Payments IPN status inconsistencies (#495)
12
+ * Fixed: Incorrect javascript method name
13
+ * Fixed: No terms and conditions warning (#494)
14
+ * Fixed: Replace vendor with function call (#493)
15
+ * Fixed: Update methods in the wrong location
16
+ * Fixed: Line item id's incorrectly set
17
+
18
+ Templates Updated:
19
+ templates/dashboard/denied.php
20
+
21
  Version 2.1.0
22
 
23
  * Added Option to remove "Become a Vendor" tab on the my-account page
82
  * Updated: Wording for settings
83
 
84
  Templates Updated:
85
+ templates/dashboard/denied.php
86
 
87
  Version 2.0.6
88
 
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.0
11
  * Requires at least: 4.4.0
12
- * Tested up to: 4.9.5
13
  * WC requires at least: 3.3.0
14
- * WC tested up to: 3.4.4
15
  *
16
  * Text Domain: wc-vendors
17
  * Domain Path: /languages/
@@ -92,7 +92,7 @@ if ( wcv_is_woocommerce_activated() ) {
92
  class WC_Vendors
93
  {
94
 
95
- public $version = '2.0.10';
96
 
97
  /**
98
  * @var
7
  * Author URI: https://www.wcvendors.com
8
  * GitHub Plugin URI: https://github.com/wcvendors/wcvendors
9
  *
10
+ * Version: 2.1.1
11
  * Requires at least: 4.4.0
12
+ * Tested up to: 4.9.8
13
  * WC requires at least: 3.3.0
14
+ * WC tested up to: 3.4.5
15
  *
16
  * Text Domain: wc-vendors
17
  * Domain Path: /languages/
92
  class WC_Vendors
93
  {
94
 
95
+ public $version = '2.1.1';
96
 
97
  /**
98
  * @var
classes/admin/class-admin-reports.php CHANGED
@@ -47,7 +47,7 @@ class WCV_Admin_Reports
47
  'function' => array( $this, 'sales' ),
48
  ),
49
  array(
50
- 'title' => __( 'Commission by vendor', 'wc-vendors' ),
51
  'description' => '',
52
  'hide_title' => true,
53
  'function' => array( $this, 'commission' ),
47
  'function' => array( $this, 'sales' ),
48
  ),
49
  array(
50
+ 'title' => sprintf( __( 'Commission by %s', 'wc-vendors' ), wcv_get_vendor_name( true, false ) ),
51
  'description' => '',
52
  'hide_title' => true,
53
  'function' => array( $this, 'commission' ),
classes/admin/class-setup-wizard.php CHANGED
@@ -279,6 +279,27 @@ class WCVendors_Admin_Setup_Wizard {
279
  update_option( 'wcvendors_capability_order_read_notes', $view_order_notes );
280
  update_option( 'wcvendors_capability_order_update_notes', $add_order_notes );
281
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
282
  wp_redirect( esc_url_raw( $this->get_next_step_link() ) );
283
  exit;
284
  }
279
  update_option( 'wcvendors_capability_order_read_notes', $view_order_notes );
280
  update_option( 'wcvendors_capability_order_update_notes', $add_order_notes );
281
 
282
+ // Update actual role
283
+ $args = array(
284
+ 'assign_product_terms' => $products_enabled,
285
+ 'edit_products' => $products_enabled || $live_products,
286
+ 'edit_product' => $products_enabled || $live_products,
287
+ 'edit_published_products' => $live_products,
288
+ 'delete_published_products' => $live_products,
289
+ 'delete_products' => $live_products,
290
+ 'manage_product' => $products_enabled,
291
+ 'publish_products' => $products_approval,
292
+ 'delete_posts' => true,
293
+ 'read' => true,
294
+ 'read_products' => $live_products || $products_enabled,
295
+ 'upload_files' => true,
296
+ 'import' => true,
297
+ 'view_woocommerce_reports' => false,
298
+ );
299
+
300
+ remove_role( 'vendor' );
301
+ add_role( 'vendor', sprintf( __('%s', 'wc-vendors'), wcv_get_vendor_name() ), $args );
302
+
303
  wp_redirect( esc_url_raw( $this->get_next_step_link() ) );
304
  exit;
305
  }
classes/admin/emails/class-wc-approve-vendor.php CHANGED
@@ -29,7 +29,7 @@ class WC_Email_Approve_Vendor extends WC_Email
29
  $this->description = sprintf( __( '%s application will either be approved, denied, or pending. <strong>This email has been deprecated.</strong>', 'wc-vendors' ), wcv_get_vendor_name() );
30
 
31
  $this->heading = __( 'Application {status}', 'wc-vendors' );
32
- $this->subject = __( '[{blogname}] Your vendor application has been {status}', 'wc-vendors' );
33
 
34
  $this->template_base = dirname( dirname( dirname( dirname( __FILE__ ) ) ) ) . '/templates/emails/';
35
  $this->template_html = 'application-status.php';
29
  $this->description = sprintf( __( '%s application will either be approved, denied, or pending. <strong>This email has been deprecated.</strong>', 'wc-vendors' ), wcv_get_vendor_name() );
30
 
31
  $this->heading = __( 'Application {status}', 'wc-vendors' );
32
+ $this->subject = sprintf( __( '[{blogname}] Your %s application has been {status}', 'wc-vendors' ), wcv_get_vendor_name( true, false ) );
33
 
34
  $this->template_base = dirname( dirname( dirname( dirname( __FILE__ ) ) ) ) . '/templates/emails/';
35
  $this->template_html = 'application-status.php';
classes/admin/emails/class-wc-notify-admin.php CHANGED
@@ -26,7 +26,7 @@ class WC_Email_Notify_Admin extends WC_Email
26
  {
27
  $this->id = 'admin_new_vendor_product';
28
  $this->title = sprintf( __( 'New %s Product - deprecated', 'wc-vendors' ), wcv_get_vendor_name() );
29
- $this->description = __( 'New order emails are sent when a new product is submitted by a vendor. <strong>This email has been depreciated.</strong>', 'wc-vendors' );
30
 
31
  $this->heading = __( 'New product submitted: {product_name}', 'wc-vendors' );
32
  $this->subject = __( '[{blogname}] New product submitted by {vendor_name} - {product_name}', 'wc-vendors' );
26
  {
27
  $this->id = 'admin_new_vendor_product';
28
  $this->title = sprintf( __( 'New %s Product - deprecated', 'wc-vendors' ), wcv_get_vendor_name() );
29
+ $this->description = sprintf( __( 'New order emails are sent when a new product is submitted by a %s. <strong>This email has been depreciated.</strong>', 'wc-vendors' ), wcv_get_vendor_name( true, false ) );
30
 
31
  $this->heading = __( 'New product submitted: {product_name}', 'wc-vendors' );
32
  $this->subject = __( '[{blogname}] New product submitted by {vendor_name} - {product_name}', 'wc-vendors' );
classes/admin/emails/class-wc-notify-shipped.php CHANGED
@@ -26,7 +26,7 @@ class WC_Email_Notify_Shipped extends WC_Email
26
  {
27
  $this->id = 'vendor_notify_shipped';
28
  $this->title = sprintf( __( '%s has shipped - deprecated', 'wc-vendors' ), wcv_get_vendor_name() );
29
- $this->description = __( 'An email is sent when a vendor has marked one of their orders as shipped. <strong>This email has been deprecated.</strong>', 'wc-vendors' );
30
 
31
  $this->heading = __( 'Your order has been shipped', 'wc-vendors' );
32
  $this->subject = __( '[{blogname}] Your order has been shipped ({order_number}) - {order_date}', 'wc-vendors' );
26
  {
27
  $this->id = 'vendor_notify_shipped';
28
  $this->title = sprintf( __( '%s has shipped - deprecated', 'wc-vendors' ), wcv_get_vendor_name() );
29
+ $this->description = sprintf( __( 'An email is sent when a %s has marked one of their orders as shipped. <strong>This email has been deprecated.</strong>', 'wc-vendors' ), wcv_get_vendor_name( true, false ) );
30
 
31
  $this->heading = __( 'Your order has been shipped', 'wc-vendors' );
32
  $this->subject = __( '[{blogname}] Your order has been shipped ({order_number}) - {order_date}', 'wc-vendors' );
classes/admin/settings/class-wcv-settings-display.php CHANGED
@@ -75,6 +75,13 @@ class WCVendors_Settings_Display extends WCVendors_Settings_Page {
75
  'default' => '',
76
  'type' => 'textarea',
77
  ),
 
 
 
 
 
 
 
78
 
79
 
80
  array( 'type' => 'sectionend', 'id' => 'advanced_options' ),
75
  'default' => '',
76
  'type' => 'textarea',
77
  ),
78
+ array(
79
+ 'title' => __( 'Use WooCommerce Registration', 'wc-vendors' ),
80
+ 'type' => 'checkbox',
81
+ 'default' => 'no',
82
+ 'id' => 'wcvendors_redirect_wp_registration_to_woocommerce_myaccount',
83
+ 'desc' => __( 'This will redirect the WordPress registration to WooCommerce my-account page for registration.', 'wc-vendors' ),
84
+ ),
85
 
86
 
87
  array( 'type' => 'sectionend', 'id' => 'advanced_options' ),
classes/admin/views/html-vendor-meta.php CHANGED
@@ -102,7 +102,7 @@
102
  <td>
103
  <label for="wcv_give_vendor_tax">
104
  <input name="wcv_give_vendor_tax" type="checkbox" id="wcv_give_vendor_tax" <?php checked( true, get_user_meta( $user->ID, 'wcv_give_vendor_tax', true ), $echo = true ) ?>/>
105
- <?php _e( 'Tax override for vendor', 'wc-vendors' ); ?>
106
  </label>
107
  </td>
108
  </tr>
@@ -118,7 +118,7 @@
118
  <td>
119
  <label for="wcv_give_vendor_shipping">
120
  <input name="wcv_give_vendor_shipping" type="checkbox" id="wcv_give_vendor_shipping" <?php checked( true, get_user_meta( $user->ID, 'wcv_give_vendor_shipping', true ), $echo = true ) ?>/>
121
- <?php _e( 'Shipping override for vendor', 'wc-vendors' ); ?>
122
  </label>
123
  </td>
124
  </tr>
102
  <td>
103
  <label for="wcv_give_vendor_tax">
104
  <input name="wcv_give_vendor_tax" type="checkbox" id="wcv_give_vendor_tax" <?php checked( true, get_user_meta( $user->ID, 'wcv_give_vendor_tax', true ), $echo = true ) ?>/>
105
+ <?php printf( __( 'Tax override for %s', 'wc-vendors' ), wcv_get_vendor_name( true, false ) ); ?>
106
  </label>
107
  </td>
108
  </tr>
118
  <td>
119
  <label for="wcv_give_vendor_shipping">
120
  <input name="wcv_give_vendor_shipping" type="checkbox" id="wcv_give_vendor_shipping" <?php checked( true, get_user_meta( $user->ID, 'wcv_give_vendor_shipping', true ), $echo = true ) ?>/>
121
+ <?php printf( __( 'Shipping override for %s', 'wc-vendors' ), wcv_get_vendor_name( true, false ) ); ?>
122
  </label>
123
  </td>
124
  </tr>
classes/class-commission.php CHANGED
@@ -587,6 +587,56 @@ class WCV_Commission
587
  $query = "SELECT `id`, `total_due`, `total_shipping`, `tax`, `vendor_id`, `status`
588
  FROM `{$table_name}`";
589
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
590
  $results = $wpdb->get_results( $query );
591
 
592
  foreach ( $results as $commission ) {
587
  $query = "SELECT `id`, `total_due`, `total_shipping`, `tax`, `vendor_id`, `status`
588
  FROM `{$table_name}`";
589
 
590
+ $orderby = ! empty( $_REQUEST[ 'orderby' ] ) ? esc_attr( $_REQUEST[ 'orderby' ] ) : 'time';
591
+ $order = ( ! empty( $_REQUEST[ 'order' ] ) && $_REQUEST[ 'order' ] == 'asc' ) ? 'ASC' : 'DESC';
592
+ $com_status = ! empty( $_REQUEST[ 'com_status' ] ) ? esc_attr( $_REQUEST[ 'com_status' ] ) : '';
593
+ $vendor_id = ! empty( $_REQUEST[ 'vendor_id' ] ) ? esc_attr( $_REQUEST[ 'vendor_id' ] ) : '';
594
+ $status_sql = '';
595
+ $time_sql = '';
596
+
597
+ if ( !empty( $_GET[ 'm' ] ) ) {
598
+
599
+ $year = substr( $_GET[ 'm' ], 0, 4 );
600
+ $month = substr( $_GET[ 'm' ], 4, 2 );
601
+
602
+ $time_sql = "
603
+ WHERE MONTH(`time`) = '$month'
604
+ AND YEAR(`time`) = '$year'
605
+ ";
606
+
607
+ $query .= $time_sql;
608
+ }
609
+
610
+ if ( !empty( $_GET[ 'com_status' ] ) ) {
611
+
612
+ if ( $time_sql == '' ) {
613
+ $status_sql = "
614
+ WHERE status = '$com_status'
615
+ ";
616
+ } else {
617
+ $status_sql = "
618
+ AND status = '$com_status'
619
+ ";
620
+ }
621
+
622
+ $query .= $status_sql;
623
+ }
624
+
625
+ if ( !empty( $_GET[ 'vendor_id' ] ) ) {
626
+
627
+ if ( $time_sql == '' && $status_sql == '' ) {
628
+ $vendor_sql = "
629
+ WHERE vendor_id = '$vendor_id'
630
+ ";
631
+ } else {
632
+ $vendor_sql = "
633
+ AND vendor_id = '$vendor_id'
634
+ ";
635
+ }
636
+
637
+ $query .= $vendor_sql;
638
+ }
639
+
640
  $results = $wpdb->get_results( $query );
641
 
642
  foreach ( $results as $commission ) {
classes/class-install.php CHANGED
@@ -17,8 +17,11 @@ class WCVendors_Install {
17
  'wcv_update_200_db_version',
18
  ),
19
  '2.0.11' => array(
20
- 'add_hide_become_a_vendor_link_option',
21
- 'add_terms_and_conditions_visibility_option'
 
 
 
22
  )
23
  );
24
 
@@ -152,9 +155,9 @@ class WCVendors_Install {
152
  );
153
 
154
  remove_role( 'vendor' );
155
- $can_add = wc_string_to_bool( get_option( 'wcvendors_capability_products_enabled', 'no' ) );
156
- $can_edit = wc_string_to_bool( get_option( 'wcvendors_capability_products_edit', 'no' ) );
157
- $can_submit_live = wc_string_to_bool( get_option( 'wcvendors_capability_products_live', 'no' ) );
158
  add_role(
159
  'vendor',
160
  sprintf( __( '%s', 'wc-vendors'), wcv_get_vendor_name() ) ,
@@ -464,25 +467,7 @@ class WCVendors_Install {
464
  }
465
  }
466
 
467
- /**
468
- * Add option to hide the Become a Vendor link on my-account page
469
- *
470
- * @return void
471
- * @since 2.0.11
472
- */
473
- public static function add_hide_become_a_vendor_link_option(){
474
- add_option( 'wcvendors_become_a_vendor_my_account_link_visibility', 'yes' );
475
- }
476
 
477
- /**
478
- * Add the terms and conditions visibility option default
479
- *
480
- * @return void
481
- * @since 2.0.11
482
- */
483
- public static function add_terms_and_conditions_visibility_option(){
484
- add_option( 'wcvendors_terms_and_conditions_visibility', 'yes' );
485
- }
486
 
487
  }
488
 
17
  'wcv_update_200_db_version',
18
  ),
19
  '2.0.11' => array(
20
+ 'wcv_add_hide_become_a_vendor_link_option',
21
+ 'wcv_add_terms_and_conditions_visibility_option'
22
+ ),
23
+ '2.1.1' => array(
24
+ 'wcv_redirect_wp_registration_to_woocommerce_myaccount',
25
  )
26
  );
27
 
155
  );
156
 
157
  remove_role( 'vendor' );
158
+ $can_add = wc_string_to_bool( get_option( 'wcvendors_capability_products_enabled', 'yes' ) );
159
+ $can_edit = wc_string_to_bool( get_option( 'wcvendors_capability_products_edit', 'yes' ) );
160
+ $can_submit_live = wc_string_to_bool( get_option( 'wcvendors_capability_products_live', 'yes' ) );
161
  add_role(
162
  'vendor',
163
  sprintf( __( '%s', 'wc-vendors'), wcv_get_vendor_name() ) ,
467
  }
468
  }
469
 
 
 
 
 
 
 
 
 
 
470
 
 
 
 
 
 
 
 
 
 
471
 
472
  }
473
 
classes/class-uninstall.php CHANGED
@@ -12,7 +12,7 @@ if ( ! defined( 'ABSPATH' ) ) {
12
  */
13
  class WCVendors_Uninstall{
14
  /**
15
- * Check the uninstall options and delete the data
16
  *
17
  * @return void
18
  * @package
@@ -24,21 +24,21 @@ class WCVendors_Uninstall{
24
  }else{
25
  if ( get_option( 'wcvendors_uninstall_delete_custom_table') == 'yes' ) {
26
  self::delete_table();
27
- }
28
 
29
  if ( get_option( 'wcvendors_uninstall_delete_custom_pages') == 'yes' ) {
30
  self::delete_pages();
31
- }
32
 
33
  if ( get_option( 'wcvendors_uninstall_delete_settings_options') == 'yes' ) {
34
  self::delete_options();
35
- }
36
 
37
  if ( get_option( 'wcvendors_uninstall_delete_vendor_roles') == 'yes' ) {
38
  self::remove_roles();
39
  }
40
  }
41
-
42
  self::flush_rewrite_rules();
43
  }
44
 
@@ -51,11 +51,11 @@ class WCVendors_Uninstall{
51
  public static function delete_all(){
52
  self::remove_roles();
53
  self::delete_pages();
54
- self::delete_table();
55
  self::delete_options();
 
56
  WCV_Cron::remove_cron_schedule();
57
  }
58
-
59
  /**
60
  * Remove custom roles
61
  *
@@ -117,12 +117,12 @@ class WCVendors_Uninstall{
117
  }
118
  }
119
  }
120
-
121
  delete_option( 'wcvendors_version' );
122
  delete_option( 'wcvendors_db_version' );
123
  delete_option( 'wcvendors_admin_notices' );
124
  delete_option( 'wcvendors_queue_flush_rewrite_rules' );
125
- delete_option( 'wcvendors_admin_notice_email_updates' );
126
  }
127
 
128
  /**
@@ -134,4 +134,4 @@ class WCVendors_Uninstall{
134
  public static function flush_rewrite_rules(){
135
  flush_rewrite_rules();
136
  }
137
- }
12
  */
13
  class WCVendors_Uninstall{
14
  /**
15
+ * Check the uninstall options and delete the data
16
  *
17
  * @return void
18
  * @package
24
  }else{
25
  if ( get_option( 'wcvendors_uninstall_delete_custom_table') == 'yes' ) {
26
  self::delete_table();
27
+ }
28
 
29
  if ( get_option( 'wcvendors_uninstall_delete_custom_pages') == 'yes' ) {
30
  self::delete_pages();
31
+ }
32
 
33
  if ( get_option( 'wcvendors_uninstall_delete_settings_options') == 'yes' ) {
34
  self::delete_options();
35
+ }
36
 
37
  if ( get_option( 'wcvendors_uninstall_delete_vendor_roles') == 'yes' ) {
38
  self::remove_roles();
39
  }
40
  }
41
+
42
  self::flush_rewrite_rules();
43
  }
44
 
51
  public static function delete_all(){
52
  self::remove_roles();
53
  self::delete_pages();
 
54
  self::delete_options();
55
+ self::delete_table();
56
  WCV_Cron::remove_cron_schedule();
57
  }
58
+
59
  /**
60
  * Remove custom roles
61
  *
117
  }
118
  }
119
  }
120
+
121
  delete_option( 'wcvendors_version' );
122
  delete_option( 'wcvendors_db_version' );
123
  delete_option( 'wcvendors_admin_notices' );
124
  delete_option( 'wcvendors_queue_flush_rewrite_rules' );
125
+ delete_option( 'wcvendors_admin_notice_email_updates' );
126
  }
127
 
128
  /**
134
  public static function flush_rewrite_rules(){
135
  flush_rewrite_rules();
136
  }
137
+ }
classes/class-vendors.php CHANGED
@@ -73,9 +73,9 @@ class WCV_Vendors
73
  if ( ! self::is_vendor( $vendor_id ) ) continue;
74
 
75
  if ( array_key_exists( $vendor_id, $vendors ) ){
76
- $vendors[ $vendor_id ][ 'line_items' ][] = $order_item;
77
  } else {
78
- $vendor_details = array( 'vendor' => get_userdata( $vendor_id ), 'line_items' => array( $order_item ) );
79
  $vendors[ $vendor_id ] = $vendor_details;
80
  }
81
  }
73
  if ( ! self::is_vendor( $vendor_id ) ) continue;
74
 
75
  if ( array_key_exists( $vendor_id, $vendors ) ){
76
+ $vendors[ $vendor_id ][ 'line_items' ][ $order_item->get_id() ] = $order_item;
77
  } else {
78
+ $vendor_details = array( 'vendor' => get_userdata( $vendor_id ), 'line_items' => array( $order_item->get_id() => $order_item ) );
79
  $vendors[ $vendor_id ] = $vendor_details;
80
  }
81
  }
classes/front/class-vendor-shop.php CHANGED
@@ -44,6 +44,14 @@ class WCV_Vendor_Shop
44
 
45
  add_filter( 'document_title_parts', array( $this, 'vendor_page_title' ) );
46
 
 
 
 
 
 
 
 
 
47
  }
48
 
49
  public static function change_archive_link( $link )
@@ -337,5 +345,72 @@ class WCV_Vendor_Shop
337
 
338
  } // vendor_page_title
339
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
340
 
341
  }
44
 
45
  add_filter( 'document_title_parts', array( $this, 'vendor_page_title' ) );
46
 
47
+ // Change login and registration url to WooCommerce my-account page
48
+ if ( apply_filters( 'wcvendors_redirect_wp_registration_to_woocommerce_myaccount', wc_string_to_bool( get_option( 'wcvendors_redirect_wp_registration_to_woocommerce_myaccount', 'no') ) ) ) {
49
+ add_filter( 'login_url', array( $this, 'change_login_url' ), 1, 3 );
50
+ add_filter( 'register_url', array( $this, 'change_register_url' ), 10, 1 );
51
+ add_action( 'wp_logout', array( $this, 'redirect_after_logout' ),10 );
52
+ add_filter( 'login_redirect', array( $this, 'change_login_redirect' ),10, 3 );
53
+ }
54
+
55
  }
56
 
57
  public static function change_archive_link( $link )
345
 
346
  } // vendor_page_title
347
 
348
+ /**
349
+ * Change the url users will be redirected to for login
350
+ *
351
+ * @param string $login_url The current login url
352
+ * @param string $request
353
+ * @param string $user
354
+ * @return string The url users will be redirected to for login
355
+ * @since 2.1.1
356
+ */
357
+ public function change_login_url( $login_url, $redirect, $force_reauth ){
358
+
359
+ $login_url = get_permalink( wc_get_page_id( 'myaccount' ) );
360
+
361
+ if ( ! empty( $redirect ) ) {
362
+ $login_url = add_query_arg( 'redirect_to', urlencode( $redirect ), $login_url );
363
+ }
364
+
365
+ if ( $force_reauth ) {
366
+ $login_url = add_query_arg( 'reauth', '1', $login_url );
367
+ }
368
+
369
+ return $login_url;
370
+ } // change_login_url()
371
+
372
+ /**
373
+ * Change the registration url to avoid registration in default WordPress registration page
374
+ *
375
+ * @param string $register_url The current WordPress registration url
376
+ * @return string $register_url The new registration url
377
+ * @since 2.1.1
378
+ */
379
+ public function change_register_url( $register_url ) {
380
+ return get_permalink( wc_get_page_id( 'myaccount' ) );
381
+ } // change_register_url()
382
+
383
+ /**
384
+ * Redirect users to mu-account page after logout
385
+ *
386
+ * @return void
387
+ * @since 2.1.1
388
+ */
389
+ public function redirec_after_logout(){
390
+ wp_redirect( get_permalink( wc_get_page_id( 'myaccount' ) ) );
391
+ exit();
392
+ } // redirec_after_logout()
393
+
394
+ /**
395
+ * Redirect user after successful login.
396
+ *
397
+ * @param string $redirect_to The url to redirect to.
398
+ * @param string $request The url the user is coming from.
399
+ * @param object $user Logged in user's data.
400
+ * @return string The url to redirect to
401
+ * @since 2.1.1
402
+ */
403
+ function change_login_redirect( $redirect_to, $request, $user ) {
404
+ if ( isset( $user->roles ) && is_array( $user->roles ) ) {
405
+ if ( in_array( 'administrator', $user->roles ) ) {
406
+ // redirect them to the default place
407
+ return $redirect_to;
408
+ } else {
409
+ return get_permalink( wc_get_page_id( 'myaccount' ) );
410
+ }
411
+ } else {
412
+ return $redirect_to;
413
+ }
414
+ } // change_login_redirect()
415
 
416
  }
classes/front/orders/class-orders.php CHANGED
@@ -263,7 +263,7 @@ class WCV_Orders
263
  $billing_email = $order->get_billing_email();
264
  $customer_note = $order->get_customer_note();
265
 
266
- $body[ $i ] = array(
267
  'order_number' => $order->get_order_number(),
268
  'product' => $product,
269
  'name' => $shipping_first_name . ' ' . $shipping_last_name,
263
  $billing_email = $order->get_billing_email();
264
  $customer_note = $order->get_customer_note();
265
 
266
+ $body[ $order->get_order_number() ] = array(
267
  'order_number' => $order->get_order_number(),
268
  'product' => $product,
269
  'name' => $shipping_first_name . ' ' . $shipping_last_name,
classes/front/signup/class-vendor-signup.php CHANGED
@@ -23,7 +23,6 @@ class WCV_Vendor_Signup
23
  $this->terms_page = get_option( 'wcvendors_vendor_terms_page_id' );
24
 
25
  add_action( 'woocommerce_register_form', array( $this, 'vendor_option' ) );
26
- add_action( 'register_form', array( $this, 'login_apply_vendor_option' ) );
27
 
28
  if ( ! class_exists( 'WCVendors_Pro' ) ) {
29
  add_action( 'woocommerce_created_customer', array( $this, 'save_pending' ), 10, 2 );
@@ -48,6 +47,8 @@ class WCV_Vendor_Signup
48
 
49
 
50
  /**
 
 
51
  * Show apply to be vendor on the wp-login screen
52
  *
53
  * @since 1.9.0
23
  $this->terms_page = get_option( 'wcvendors_vendor_terms_page_id' );
24
 
25
  add_action( 'woocommerce_register_form', array( $this, 'vendor_option' ) );
 
26
 
27
  if ( ! class_exists( 'WCVendors_Pro' ) ) {
28
  add_action( 'woocommerce_created_customer', array( $this, 'save_pending' ), 10, 2 );
47
 
48
 
49
  /**
50
+ * WILL BE COMPLETELY REMOVED
51
+ *
52
  * Show apply to be vendor on the wp-login screen
53
  *
54
  * @since 1.9.0
classes/front/signup/views/html-vendor-signup.php CHANGED
@@ -19,7 +19,7 @@
19
  <p>
20
  <label for="apply_for_vendor">
21
  <input class="input-checkbox" id="apply_for_vendor" <?php checked( isset( $_POST[ 'apply_for_vendor' ] ), true ) ?> type="checkbox" name="apply_for_vendor" value="1"/>
22
- <?php echo apply_filters('wcvendors_vendor_registration_checkbox', __( 'Apply to become a vendor? ', 'wc-vendors' )); ?>
23
  </label>
24
  <br />
25
  </p>
@@ -66,6 +66,7 @@
66
  $( 'form.register').on( 'submit', function ( e ){
67
  if ( jQuery('#agree_to_terms').is(':visible') && ! jQuery('#agree_to_terms').is(':checked') ) {
68
  e.preventDefault();
 
69
  }
70
  } );
71
 
19
  <p>
20
  <label for="apply_for_vendor">
21
  <input class="input-checkbox" id="apply_for_vendor" <?php checked( isset( $_POST[ 'apply_for_vendor' ] ), true ) ?> type="checkbox" name="apply_for_vendor" value="1"/>
22
+ <?php echo apply_filters('wcvendors_vendor_registration_checkbox', sprintf( __( 'Apply to become a %s? ', 'wc-vendors' ), wcv_get_vendor_name( true, false ) ) ); ?>
23
  </label>
24
  <br />
25
  </p>
66
  $( 'form.register').on( 'submit', function ( e ){
67
  if ( jQuery('#agree_to_terms').is(':visible') && ! jQuery('#agree_to_terms').is(':checked') ) {
68
  e.preventDefault();
69
+ alert( <?php _e( '"You must accept the terms and conditions to become a vendor."', 'wc-vendors' ); ?> );
70
  }
71
  } );
72
 
classes/gateways/PayPal_AdvPayments/paypal_ap.php CHANGED
@@ -115,7 +115,7 @@ class WC_PaypalAP extends WC_Payment_Gateway
115
  $order = wc_get_order( $order_id );
116
  if ( !$order ) return false;
117
 
118
- if ( $_POST[ 'status' ] !== 'COMPLETED' ) {
119
  $order->update_status( 'failed', sprintf( __( 'Something went wrong. Response from PayPal invalidated this order. Status: %s.', 'wc-vendors' ), $_POST[ 'status' ] ) );
120
  exit;
121
  }
115
  $order = wc_get_order( $order_id );
116
  if ( !$order ) return false;
117
 
118
+ if ( ! in_array( $_POST['status'], array( 'COMPLETED', 'Completed' ), true ) ) {
119
  $order->update_status( 'failed', sprintf( __( 'Something went wrong. Response from PayPal invalidated this order. Status: %s.', 'wc-vendors' ), $_POST[ 'status' ] ) );
120
  exit;
121
  }
classes/includes/wcv-update-functions.php CHANGED
@@ -120,3 +120,34 @@ function wcv_update_200_db_version(){
120
  function wcv_update_db_version(){
121
  WCVendors_Install::update_db_version();
122
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
120
  function wcv_update_db_version(){
121
  WCVendors_Install::update_db_version();
122
  }
123
+
124
+
125
+ /**
126
+ * Add option to hide the Become a Vendor link on my-account page
127
+ *
128
+ * @return void
129
+ * @since 2.0.11
130
+ */
131
+ function wcv_add_hide_become_a_vendor_link_option(){
132
+ add_option( 'wcvendors_become_a_vendor_my_account_link_visibility', 'yes' );
133
+ }
134
+
135
+ /**
136
+ * Add the terms and conditions visibility option default
137
+ *
138
+ * @return void
139
+ * @since 2.0.11
140
+ */
141
+ function wcv_add_terms_and_conditions_visibility_option(){
142
+ add_option( 'wcvendors_terms_and_conditions_visibility', 'yes' );
143
+ }
144
+
145
+ /**
146
+ * Add the option to redirect registration system to WooCommece my-account page
147
+ *
148
+ * @return void
149
+ * @since 2.1.1
150
+ */
151
+ function wcv_redirect_wp_registration_to_woocommerce_myaccount() {
152
+ add_option( 'wcvendors_redirect_wp_registration_to_woocommerce_myaccount', 'no' );
153
+ }
readme.txt CHANGED
@@ -6,8 +6,8 @@ Author URI: https://www.wcvendors.com/
6
  Plugin URI: https://www.wcvendors.com/
7
  Requires at least: 4.4.0
8
  Requires PHP: 5.6
9
- Tested up to: 4.9.5
10
- Stable tag: 2.1.0
11
  License: GPLv2 or later
12
 
13
  The number one marketplace plugin for WooCommerce. Now you can allow anyone to open a store on your WooCommerce site!
@@ -145,6 +145,24 @@ WC Vendors Marketplace does not work with multisite WordPress. There are no plan
145
 
146
  == Changelog ==
147
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
148
  = Version 2.1.0 6th August 2018 =
149
 
150
  * Added Option to remove "Become a Vendor" tab on the my-account page
6
  Plugin URI: https://www.wcvendors.com/
7
  Requires at least: 4.4.0
8
  Requires PHP: 5.6
9
+ Tested up to: 4.9.8
10
+ Stable tag: 2.1.1
11
  License: GPLv2 or later
12
 
13
  The number one marketplace plugin for WooCommerce. Now you can allow anyone to open a store on your WooCommerce site!
145
 
146
  == Changelog ==
147
 
148
+ = Version 2.1.1 15th September 2018 =
149
+
150
+ * Added: Export Commission Order ID #460
151
+ * Added: Export Commission Totals use filters #459
152
+ * Added: Remove Ability to Register from the WP Login screen. #489
153
+ * Fixed: Invalid variable reference
154
+ * Fixed: Uninistall loading order to ensure table still exists when getting settings fields
155
+ * Fixed: Incorrect capabilities set on initial install and via setup wizard
156
+ * Fixed: Handle PayPal Adaptive Payments IPN status inconsistencies (#495)
157
+ * Fixed: Incorrect javascript method name
158
+ * Fixed: No terms and conditions warning (#494)
159
+ * Fixed: Replace vendor with function call (#493)
160
+ * Fixed: Update methods in the wrong location
161
+ * Fixed: Line item id's incorrectly set
162
+
163
+ Templates Updated:
164
+ templates/dashboard/denied.php
165
+
166
  = Version 2.1.0 6th August 2018 =
167
 
168
  * Added Option to remove "Become a Vendor" tab on the my-account page
templates/dashboard/denied.php CHANGED
@@ -6,8 +6,8 @@
6
  *
7
  * @author Jamie Madden, WC Vendors
8
  * @package WCVendors/Templates/dashboard
9
- * @version 2.0.7
10
-
11
  */
12
 
13
  if ( ! defined( 'ABSPATH' ) ) {
@@ -19,11 +19,11 @@
19
 
20
  <?php if ( WCV_Vendors::is_pending( get_current_user_id() ) ) { ?>
21
 
22
- <p><?php _e( 'Your account has not yet been approved to become a vendor. When it is, you will receive an email telling you that your account is approved!', 'wc-vendors' ); ?></p>
23
 
24
  <?php } else { ?>
25
 
26
- <p><?php _e( 'Your account is not setup as a vendor.', 'wc-vendors' ); ?></p>
27
 
28
  <?php if ( 'yes' === get_option( 'wcvendors_vendor_allow_registration', 'no' ) ) { ?>
29
  <form method="POST" action="">
@@ -33,20 +33,20 @@
33
  id="apply_for_vendor" <?php checked( isset( $_POST[ 'apply_for_vendor' ] ), true ) ?>
34
  type="checkbox" name="apply_for_vendor" value="1"/>
35
  <label for="apply_for_vendor"
36
- class="checkbox"><?php echo apply_filters('wcvendors_vendor_registration_checkbox', __( 'Apply to become a vendor? ', 'wc-vendors' )); ?></label>
37
  </p>
38
 
39
  <div class="clear"></div>
40
 
41
  <?php
42
  $terms_page = get_option( 'wcvendors_vendor_terms_page_id' );
43
-
44
  if ( $terms_page ) {
45
 
46
  $terms_and_conditions_visibility = get_option( 'wcvendors_terms_and_conditions_visibility' );
47
 
48
  $display = apply_filters( 'wcvendors_terms_and_conditions_visibility', wc_string_to_bool( $terms_and_conditions_visibility ) ) ? 'block': 'none';
49
-
50
  ?>
51
  <input type="hidden" id="terms_and_conditions_visibility" value="<?php echo $terms_and_conditions_visibility; ?>" />
52
  <p class="form-row agree-to-terms-container" style="display:<?php echo $display; ?>">
@@ -56,10 +56,10 @@
56
  <label for="agree_to_terms"
57
  class="checkbox"><?php printf( __( 'I have read and accepted the <a href="%s">terms and conditions</a>', 'wc-vendors' ), get_permalink( $terms_page ) ); ?></label>
58
  </p>
59
-
60
  <script type="text/javascript">
61
  jQuery(function () {
62
- if ( $( '#terms_and_conditions_visibility' ).val() == 'no' ){
63
  if (jQuery('#apply_for_vendor').is(':checked')) {
64
  jQuery('.agree-to-terms-container').show();
65
  }
@@ -67,7 +67,7 @@
67
  jQuery('#apply_for_vendor').on('click', function () {
68
  jQuery('.agree-to-terms-container').slideToggle();
69
  });
70
- }
71
  })
72
  </script>
73
 
6
  *
7
  * @author Jamie Madden, WC Vendors
8
  * @package WCVendors/Templates/dashboard
9
+ * @version 2.1.1
10
+ *
11
  */
12
 
13
  if ( ! defined( 'ABSPATH' ) ) {
19
 
20
  <?php if ( WCV_Vendors::is_pending( get_current_user_id() ) ) { ?>
21
 
22
+ <p><?php printf( __( 'Your account has not yet been approved to become a %s. When it is, you will receive an email telling you that your account is approved!', 'wc-vendors' ), wcv_get_vendor_name( true, false ) ); ?></p>
23
 
24
  <?php } else { ?>
25
 
26
+ <p><?php printf( __( 'Your account is not setup as a %s.', 'wc-vendors' ), wcv_get_vendor_name( true, false ) ); ?></p>
27
 
28
  <?php if ( 'yes' === get_option( 'wcvendors_vendor_allow_registration', 'no' ) ) { ?>
29
  <form method="POST" action="">
33
  id="apply_for_vendor" <?php checked( isset( $_POST[ 'apply_for_vendor' ] ), true ) ?>
34
  type="checkbox" name="apply_for_vendor" value="1"/>
35
  <label for="apply_for_vendor"
36
+ class="checkbox"><?php echo apply_filters('wcvendors_vendor_registration_checkbox', sprintf( __( 'Apply to become a %s? ', 'wc-vendors' ), wcv_get_vendor_name( true, false ) ) ); ?></label>
37
  </p>
38
 
39
  <div class="clear"></div>
40
 
41
  <?php
42
  $terms_page = get_option( 'wcvendors_vendor_terms_page_id' );
43
+
44
  if ( $terms_page ) {
45
 
46
  $terms_and_conditions_visibility = get_option( 'wcvendors_terms_and_conditions_visibility' );
47
 
48
  $display = apply_filters( 'wcvendors_terms_and_conditions_visibility', wc_string_to_bool( $terms_and_conditions_visibility ) ) ? 'block': 'none';
49
+
50
  ?>
51
  <input type="hidden" id="terms_and_conditions_visibility" value="<?php echo $terms_and_conditions_visibility; ?>" />
52
  <p class="form-row agree-to-terms-container" style="display:<?php echo $display; ?>">
56
  <label for="agree_to_terms"
57
  class="checkbox"><?php printf( __( 'I have read and accepted the <a href="%s">terms and conditions</a>', 'wc-vendors' ), get_permalink( $terms_page ) ); ?></label>
58
  </p>
59
+
60
  <script type="text/javascript">
61
  jQuery(function () {
62
+ if ( jQuery( '#terms_and_conditions_visibility' ).val() == 'no' ){
63
  if (jQuery('#apply_for_vendor').is(':checked')) {
64
  jQuery('.agree-to-terms-container').show();
65
  }
67
  jQuery('#apply_for_vendor').on('click', function () {
68
  jQuery('.agree-to-terms-container').slideToggle();
69
  });
70
+ }
71
  })
72
  </script>
73
 
templates/emails/admin-notify-application.php CHANGED
@@ -16,7 +16,7 @@
16
 
17
  do_action( 'woocommerce_email_header', $email_heading, $email ); ?>
18
 
19
- <p><?php printf( __( 'Hi there. This is a notification about a vendor application on %s.', 'wc-vendors' ), get_option( 'blogname' ) ); ?></p>
20
 
21
  <p><?php printf( __( 'The application is currently: %s', 'wc-vendors' ), ucfirst( $status ) ); ?></p>
22
  <p><?php printf( __( 'Applicant username: %s', 'wc-vendors' ), $user->user_login ); ?></p>
16
 
17
  do_action( 'woocommerce_email_header', $email_heading, $email ); ?>
18
 
19
+ <p><?php printf( __( 'Hi there. This is a notification about a %s application on %s.', 'wc-vendors' ), wcv_get_vendor_name( true, false ), get_option( 'blogname' ) ); ?></p>
20
 
21
  <p><?php printf( __( 'The application is currently: %s', 'wc-vendors' ), ucfirst( $status ) ); ?></p>
22
  <p><?php printf( __( 'Applicant username: %s', 'wc-vendors' ), $user->user_login ); ?></p>
templates/emails/application-status.php CHANGED
@@ -5,7 +5,7 @@
5
 
6
  <?php do_action( 'woocommerce_email_header', $email_heading ); ?>
7
 
8
- <p><?php printf( __( "Hi there. This is a notification about a vendor application on %s.", 'wc-vendors' ), get_option( 'blogname' ) ); ?></p>
9
 
10
  <p>
11
  <?php printf( __( "Application status: %s", 'wc-vendors' ), $status ); ?><br/>
5
 
6
  <?php do_action( 'woocommerce_email_header', $email_heading ); ?>
7
 
8
+ <p><?php printf( __( "Hi there. This is a notification about a %s application on %s.", 'wc-vendors' ), wcv_get_vendor_name( true, false ), get_option( 'blogname' ) ); ?></p>
9
 
10
  <p>
11
  <?php printf( __( "Application status: %s", 'wc-vendors' ), $status ); ?><br/>
templates/emails/notify-vendor-shipped.php CHANGED
@@ -15,7 +15,7 @@ $order_date = $order->get_date_created();
15
 
16
  <?php do_action( 'woocommerce_email_header', $email_heading ); ?>
17
 
18
- <p><?php _e( 'A vendor has marked part of your order as shipped. The items that are shipped are as follows:', 'wc-vendors' ); ?></p>
19
 
20
  <?php do_action( 'woocommerce_email_before_order_table', $order, true ); ?>
21
 
15
 
16
  <?php do_action( 'woocommerce_email_header', $email_heading ); ?>
17
 
18
+ <p><?php printf( __( 'A %s has marked part of your order as shipped. The items that are shipped are as follows:', 'wc-vendors' ), wcv_get_vendor_name( true, false ) ); ?></p>
19
 
20
  <?php do_action( 'woocommerce_email_before_order_table', $order, true ); ?>
21
 
templates/emails/plain/admin-notify-application.php CHANGED
@@ -16,7 +16,7 @@ if ( ! defined( 'ABSPATH' ) ) {
16
 
17
  echo "= " . $email_heading . " =\n\n";
18
 
19
- echo sprintf( __( 'Hi there. This is a notification about a vendor application on %s.', 'wc-vendors' ), get_option( 'blogname' ) ) . "\n\n";
20
  echo sprintf( __( 'Applicant username: %s', 'wc-vendors' ), $user->user_login ). "\n\n";
21
 
22
  if ( 'pending' === $status ){
16
 
17
  echo "= " . $email_heading . " =\n\n";
18
 
19
+ echo sprintf( __( 'Hi there. This is a notification about a %s application on %s.', 'wc-vendors' ), wcv_get_vendor_name( true, false ), get_option( 'blogname' ) ) . "\n\n";
20
  echo sprintf( __( 'Applicant username: %s', 'wc-vendors' ), $user->user_login ). "\n\n";
21
 
22
  if ( 'pending' === $status ){
templates/emails/plain/vendor-notify-application.php CHANGED
@@ -16,7 +16,7 @@ if ( ! defined( 'ABSPATH' ) ) {
16
 
17
  echo "= " . $email_heading . " =\n\n";
18
 
19
- echo sprintf( __( 'Hi there. This is a notification about a vendor application on %s.', 'wc-vendors' ), get_option( 'blogname' ) ) . "\n\n";
20
  echo sprintf( __( 'Your application is currently: %s', 'wc-vendors', $status ) ). "\n\n";
21
  echo sprintf( __( 'Applicant username: %s', 'wc-vendors' ), $user->user_login ). "\n\n";
22
 
16
 
17
  echo "= " . $email_heading . " =\n\n";
18
 
19
+ echo sprintf( __( 'Hi there. This is a notification about a %s application on %s.', 'wc-vendors' ), wcv_get_vendor_name( true, false ), get_option( 'blogname' ) ) . "\n\n";
20
  echo sprintf( __( 'Your application is currently: %s', 'wc-vendors', $status ) ). "\n\n";
21
  echo sprintf( __( 'Applicant username: %s', 'wc-vendors' ), $user->user_login ). "\n\n";
22
 
templates/emails/vendor-notify-application.php CHANGED
@@ -19,7 +19,7 @@
19
  */
20
  do_action( 'woocommerce_email_header', $email_heading, $email ); ?>
21
 
22
- <p><?php printf( __( 'Hi there. This is a notification about a vendor application on %s.', 'wc-vendors' ), get_option( 'blogname' ) ); ?></p>
23
  <p><?php printf( __( 'Your application is currently: %s', 'wc-vendors' ), $status ); ?></p>
24
  <p><?php printf( __( 'Applicant username: %s', 'wc-vendors' ), $user->user_login ); ?></p>
25
 
19
  */
20
  do_action( 'woocommerce_email_header', $email_heading, $email ); ?>
21
 
22
+ <p><?php printf( __( 'Hi there. This is a notification about a %s application on %s.', 'wc-vendors' ), wcv_get_vendor_name( true, false ), get_option( 'blogname' ) ); ?></p>
23
  <p><?php printf( __( 'Your application is currently: %s', 'wc-vendors' ), $status ); ?></p>
24
  <p><?php printf( __( 'Applicant username: %s', 'wc-vendors' ), $user->user_login ); ?></p>
25