AfterShip – WooCommerce Tracking - Version 1.11.1

Version Description

  • Fix issue for generate API key
Download this release

Release Info

Developer aftership
Plugin Icon 128x128 AfterShip – WooCommerce Tracking
Version 1.11.1
Comparing to
See all releases

Code changes from version 1.11.0 to 1.11.1

aftership-woocommerce-tracking.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Ecommerce Order Tracking and Shipment Notifications - AfterShip
4
  Plugin URI: http://aftership.com/
5
  Description: Effortless order tracking synced from all shipping providers for your ecommerce customers. Include a branded tracking page and automated delivery notifications.
6
- Version: 1.11.0
7
  Author: AfterShip
8
  Author URI: http://aftership.com
9
 
@@ -20,7 +20,7 @@ if ( ! defined( 'ABSPATH' ) ) {
20
 
21
  require_once( 'woo-includes/woo-functions.php' );
22
 
23
- define( 'AFTERSHIP_VERSION', '1.11.0' );
24
 
25
  if ( is_woocommerce_active() ) {
26
 
@@ -155,6 +155,26 @@ if ( is_woocommerce_active() ) {
155
  add_action( 'edit_user_profile', array( $this->actions, 'add_api_key_field' ) );
156
  add_action( 'personal_options_update', array( $this->actions, 'generate_api_key' ) );
157
  add_action( 'edit_user_profile_update', array( $this->actions, 'generate_api_key' ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
158
  }
159
 
160
 
3
  Plugin Name: Ecommerce Order Tracking and Shipment Notifications - AfterShip
4
  Plugin URI: http://aftership.com/
5
  Description: Effortless order tracking synced from all shipping providers for your ecommerce customers. Include a branded tracking page and automated delivery notifications.
6
+ Version: 1.11.1
7
  Author: AfterShip
8
  Author URI: http://aftership.com
9
 
20
 
21
  require_once( 'woo-includes/woo-functions.php' );
22
 
23
+ define( 'AFTERSHIP_VERSION', '1.11.1' );
24
 
25
  if ( is_woocommerce_active() ) {
26
 
155
  add_action( 'edit_user_profile', array( $this->actions, 'add_api_key_field' ) );
156
  add_action( 'personal_options_update', array( $this->actions, 'generate_api_key' ) );
157
  add_action( 'edit_user_profile_update', array( $this->actions, 'generate_api_key' ) );
158
+
159
+ register_activation_hook( __FILE__, array( $this, 'install' ) );
160
+ }
161
+
162
+ /**
163
+ * Add manage_aftership cap for administrator
164
+ * Add this to allow customers to more finely configure the permissions of the aftership plugin.
165
+ */
166
+ public function install() {
167
+ global $wp_roles;
168
+
169
+ if ( class_exists( 'WP_Roles' ) ) {
170
+ if ( ! isset( $wp_roles ) ) {
171
+ $wp_roles = new WP_Roles();
172
+ }
173
+ }
174
+
175
+ if ( is_object( $wp_roles ) ) {
176
+ $wp_roles->add_cap( 'administrator', 'manage_aftership' );
177
+ }
178
  }
179
 
180
 
includes/class-aftership-actions.php CHANGED
@@ -80,23 +80,23 @@ class AfterShip_Actions {
80
  $courier = $this->get_courier_by_slug( $item['slug'] );
81
  $link = $this->generate_tracking_page_link( $item );
82
  ?>
83
- <div
84
- class="tracking-item"
85
- data-tracking="<?php echo esc_html( $item['tracking_number'] ); ?>"
86
- data-slug="<?php echo esc_html( $item['slug'] ); ?>"
87
  id="tracking-item-<?php echo esc_attr( $item['tracking_id'] ); ?>"
88
  >
89
  <div class="tracking-item-title">
90
  <div>Shipment <?php echo esc_html( $index ); ?></div>
91
  <div>
92
- <a
93
- href="#"
94
  class="edit-tracking"
95
  rel="<?php echo esc_attr( $item['tracking_id'] ); ?>"
96
  >
97
  <?php _e( 'Edit', 'aftership' ); ?>
98
  </a>
99
- <a
100
  href="#" class="delete-tracking"
101
  rel="<?php echo esc_attr( $item['tracking_id'] ); ?>"
102
  >
@@ -772,12 +772,33 @@ class AfterShip_Actions {
772
  return $tracking_number;
773
  }
774
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
775
  /**
776
  * Display the API key info for a user
777
  *
778
  * @param WP_User $user
779
  */
780
  public function add_api_key_field( $user ) {
 
 
 
781
  if ( ! current_user_can( 'manage_aftership' ) ) {
782
  return;
783
  }
80
  $courier = $this->get_courier_by_slug( $item['slug'] );
81
  $link = $this->generate_tracking_page_link( $item );
82
  ?>
83
+ <div
84
+ class="tracking-item"
85
+ data-tracking="<?php echo esc_html( $item['tracking_number'] ); ?>"
86
+ data-slug="<?php echo esc_html( $item['slug'] ); ?>"
87
  id="tracking-item-<?php echo esc_attr( $item['tracking_id'] ); ?>"
88
  >
89
  <div class="tracking-item-title">
90
  <div>Shipment <?php echo esc_html( $index ); ?></div>
91
  <div>
92
+ <a
93
+ href="#"
94
  class="edit-tracking"
95
  rel="<?php echo esc_attr( $item['tracking_id'] ); ?>"
96
  >
97
  <?php _e( 'Edit', 'aftership' ); ?>
98
  </a>
99
+ <a
100
  href="#" class="delete-tracking"
101
  rel="<?php echo esc_attr( $item['tracking_id'] ); ?>"
102
  >
772
  return $tracking_number;
773
  }
774
 
775
+ /**
776
+ * Add manage_aftership cap for administrator
777
+ * Add this to allow customers to more finely configure the permissions of the aftership plugin.
778
+ */
779
+ public function add_permission_cap() {
780
+ global $wp_roles;
781
+
782
+ if ( class_exists( 'WP_Roles' ) ) {
783
+ if ( ! isset( $wp_roles ) ) {
784
+ $wp_roles = new WP_Roles();
785
+ }
786
+ }
787
+
788
+ if ( is_object( $wp_roles ) ) {
789
+ $wp_roles->add_cap( 'administrator', 'manage_aftership' );
790
+ }
791
+ }
792
+
793
  /**
794
  * Display the API key info for a user
795
  *
796
  * @param WP_User $user
797
  */
798
  public function add_api_key_field( $user ) {
799
+
800
+ $this->add_permission_cap();
801
+
802
  if ( ! current_user_can( 'manage_aftership' ) ) {
803
  return;
804
  }
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.aftership.com/
4
  Tags: ecommerce, shipping, shipment, order, ups, usps, fedex, dhl, tnt, dpd, post, carrier, courier, woocommerce, tracking number, aftership, package tracking, woo commerce, woocommerce shipment tracking, shipping details plugin, widget, shipstation, track, package
5
  Requires at least: 2.9
6
  Tested up to: 5.6
7
- Stable tag: 1.11.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -95,6 +95,9 @@ You'll find the FAQ on [AfterShip.com](https://aftership.uservoice.com/knowledge
95
 
96
  == Changelog ==
97
 
 
 
 
98
  = 1.11.0 =
99
  * Support Multiple Tracking Number
100
 
4
  Tags: ecommerce, shipping, shipment, order, ups, usps, fedex, dhl, tnt, dpd, post, carrier, courier, woocommerce, tracking number, aftership, package tracking, woo commerce, woocommerce shipment tracking, shipping details plugin, widget, shipstation, track, package
5
  Requires at least: 2.9
6
  Tested up to: 5.6
7
+ Stable tag: 1.11.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
95
 
96
  == Changelog ==
97
 
98
+ = 1.11.1 =
99
+ * Fix issue for generate API key
100
+
101
  = 1.11.0 =
102
  * Support Multiple Tracking Number
103