From aec29b08ee1d94984a1d9d8bbf3bef825993116d Mon Sep 17 00:00:00 2001 From: Maria Fernanda Magallanes Zubillaga Date: Wed, 30 Oct 2024 22:18:21 -0500 Subject: [PATCH 1/4] fix: wp_register_script called incorrectly --- admin/class-openedx-commerce-admin.php | 6 ++++++ includes/class-openedx-commerce.php | 15 --------------- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/admin/class-openedx-commerce-admin.php b/admin/class-openedx-commerce-admin.php index a70e9ae..a93f581 100644 --- a/admin/class-openedx-commerce-admin.php +++ b/admin/class-openedx-commerce-admin.php @@ -133,6 +133,12 @@ public function enqueue_scripts() { * between the defined hooks and the functions defined in this * class. */ + + wp_register_script( 'product-type-script', plugin_dir_url( __FILE__ ) . '../admin/js/product-type.js', array(), $this->version, true ); + wp_enqueue_script( 'product-type-script' ); + + wp_register_script( 'course-id-restriction-script', plugin_dir_url( __FILE__ ) . '../admin/js/course-id-restriction.js', array(), $this->version, true ); + wp_enqueue_script( 'course-id-restriction-script' ); } /** diff --git a/includes/class-openedx-commerce.php b/includes/class-openedx-commerce.php index eb3de38..b8f56aa 100644 --- a/includes/class-openedx-commerce.php +++ b/includes/class-openedx-commerce.php @@ -76,7 +76,6 @@ public function __construct() { $this->define_admin_hooks(); $this->define_public_hooks(); $this->define_plugin_settings_hooks(); - $this->define_enqueue_scripts(); } /** @@ -264,20 +263,6 @@ private function define_public_hooks() { $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); } - /** - * Register all the hooks related to custom scripts for specific functionalities. - * - * @since 1.11.0 - * @access private - */ - private function define_enqueue_scripts() { - wp_register_script( 'product-type-script', plugin_dir_url( __FILE__ ) . '../admin/js/product-type.js', array(), $this->get_version(), true ); - wp_enqueue_script( 'product-type-script' ); - - wp_register_script( 'course-id-restriction-script', plugin_dir_url( __FILE__ ) . '../admin/js/course-id-restriction.js', array(), $this->get_version(), true ); - wp_enqueue_script( 'course-id-restriction-script' ); - } - /** * Define the plugin settings hooks. * From 91bd3aebdc25e14a60e86f128fda76a08b08d9ff Mon Sep 17 00:00:00 2001 From: Maria Fernanda Magallanes Zubillaga Date: Wed, 30 Oct 2024 22:19:07 -0500 Subject: [PATCH 2/4] fix: wp_enqueue_style called incorrectly --- admin/class-openedx-commerce-admin.php | 8 ++++++++ includes/class-openedx-commerce.php | 7 ------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/admin/class-openedx-commerce-admin.php b/admin/class-openedx-commerce-admin.php index a93f581..75ed249 100644 --- a/admin/class-openedx-commerce-admin.php +++ b/admin/class-openedx-commerce-admin.php @@ -111,6 +111,14 @@ public function enqueue_styles() { * between the defined hooks and the functions defined in this * class. */ + + wp_enqueue_style( + $this->plugin_name, + plugin_dir_url( __FILE__ ) . '../admin/css/class-openedx-commerce-admin.css', + array(), + $this->version, + 'all' + ); } /** diff --git a/includes/class-openedx-commerce.php b/includes/class-openedx-commerce.php index b8f56aa..09ac167 100644 --- a/includes/class-openedx-commerce.php +++ b/includes/class-openedx-commerce.php @@ -216,13 +216,6 @@ private function define_admin_hooks() { $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' ); $this->loader->add_filter( 'gettext', $this, 'openedx_plugin_custom_post_message', 10, 3 ); - $this->loader->wp_enqueue_style( - $this->plugin_name, - plugin_dir_url( __FILE__ ) . '../admin/css/class-openedx-commerce-admin.css', - array(), - $this->version, - 'all' - ); // Redirection from enrollment to order and enrollment to order. $this->loader->add_filter( 'woocommerce_admin_order_item_headers', $plugin_admin, 'add_custom_column_order_items' ); From ff449f4920ad3084b67d61c9dc7dfb6b5948f578 Mon Sep 17 00:00:00 2001 From: Maria Fernanda Magallanes Zubillaga Date: Wed, 30 Oct 2024 22:24:35 -0500 Subject: [PATCH 3/4] fix: options is a required parameter --- admin/class-openedx-commerce-admin.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/admin/class-openedx-commerce-admin.php b/admin/class-openedx-commerce-admin.php index 75ed249..80dc75b 100644 --- a/admin/class-openedx-commerce-admin.php +++ b/admin/class-openedx-commerce-admin.php @@ -179,7 +179,7 @@ public function render_enrollment_info_form( $post ) { * * @return object Post type class object */ - public function register_post_type( $post_type = '', $plural = '', $single = '', $description = '', array $options ) { + public function register_post_type( $post_type = '', $plural = '', $single = '', $description = '', array $options = array() ) { if ( ! $post_type || ! $plural || ! $single ) { return; @@ -205,7 +205,7 @@ public function create_post_type( $plural = '', $single = '', $description = '', - array $options + array $options = array() ) { return new Openedx_Commerce_Post_Type( $post_type, $plural, $single, $description, $options ); } From 3fc8f5aad1c1d3ee65f70c6f4aa20abe92237850 Mon Sep 17 00:00:00 2001 From: Maria Fernanda Magallanes Zubillaga Date: Tue, 5 Nov 2024 14:45:40 -0500 Subject: [PATCH 4/4] =?UTF-8?q?docs(bumpversion):=20v2.0.6=20=E2=86=92=20v?= =?UTF-8?q?2.0.7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 12 ++++++++++++ README.txt | 2 +- openedx-commerce.php | 4 ++-- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0555686..4900065 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,15 @@ +## v2.0.7 - 2024-11-05 + +### [2.0.7](https://github.com/openedx/openedx-wordpress-ecommerce/compare/v2.0.6...v2.0.7) (2024-11-05) + +#### Bug Fixes + +* fix: admin enqueue order (#102) + +### Documentation + +* docs: add info about tutor-contrib-wordpress plugin (#84) + ## v2.0.6 - 2024-10-03 ### [2.0.6](https://github.com/openedx/openedx-wordpress-ecommerce/compare/v2.0.5...v2.0.6) (2024-10-03) diff --git a/README.txt b/README.txt index 3228efd..86d8d56 100644 --- a/README.txt +++ b/README.txt @@ -4,7 +4,7 @@ Tags: openedx, open edx, ecommerce, lms, courses Requires at least: 6.3 Tested up to: 6.6 Requires PHP: 8.0 -Stable tag: 2.0.6 +Stable tag: 2.0.7 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html diff --git a/openedx-commerce.php b/openedx-commerce.php index e54e314..e80a667 100644 --- a/openedx-commerce.php +++ b/openedx-commerce.php @@ -3,7 +3,7 @@ * Plugin Name: Open edX Commerce * Plugin URI: https://github.com/openedx/openedx-wordpress-ecommerce * Description: Easily connect your WooCommerce store to Open edX. - * Version: 2.0.6 + * Version: 2.0.7 * Author: Open edX Community * Author URI: https://github.com/openedx/openedx-wordpress-ecommerce * License: GPL-2.0+ @@ -32,7 +32,7 @@ * Start at version 1.0.0 and use SemVer - https://semver.org * Rename this for your plugin and update it as you release new versions. */ -define( 'OPENEDX_COMMERCE_VERSION', '2.0.6' ); +define( 'OPENEDX_COMMERCE_VERSION', '2.0.7' ); /** * The code that runs during plugin activation.