Skip to content

Commit 23ad005

Browse files
authored
fix: admin enqueue order and bumpversion to 2.0.7 (#102)
* fix: wp_register_script called incorrectly * fix: wp_enqueue_style called incorrectly * fix: options is a required parameter * docs(bumpversion): v2.0.6 → v2.0.7
1 parent 5429bff commit 23ad005

File tree

5 files changed

+31
-27
lines changed

5 files changed

+31
-27
lines changed

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
## v2.0.7 - 2024-11-05
2+
3+
### [2.0.7](https://github.com/openedx/openedx-wordpress-ecommerce/compare/v2.0.6...v2.0.7) (2024-11-05)
4+
5+
#### Bug Fixes
6+
7+
* fix: admin enqueue order (#102)
8+
9+
### Documentation
10+
11+
* docs: add info about tutor-contrib-wordpress plugin (#84)
12+
113
## v2.0.6 - 2024-10-03
214

315
### [2.0.6](https://github.com/openedx/openedx-wordpress-ecommerce/compare/v2.0.5...v2.0.6) (2024-10-03)

README.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Tags: openedx, open edx, ecommerce, lms, courses
44
Requires at least: 6.3
55
Tested up to: 6.6
66
Requires PHP: 8.0
7-
Stable tag: 2.0.6
7+
Stable tag: 2.0.7
88
License: GPLv2 or later
99
License URI: http://www.gnu.org/licenses/gpl-2.0.html
1010

admin/class-openedx-commerce-admin.php

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,14 @@ public function enqueue_styles() {
111111
* between the defined hooks and the functions defined in this
112112
* class.
113113
*/
114+
115+
wp_enqueue_style(
116+
$this->plugin_name,
117+
plugin_dir_url( __FILE__ ) . '../admin/css/class-openedx-commerce-admin.css',
118+
array(),
119+
$this->version,
120+
'all'
121+
);
114122
}
115123

116124
/**
@@ -133,6 +141,12 @@ public function enqueue_scripts() {
133141
* between the defined hooks and the functions defined in this
134142
* class.
135143
*/
144+
145+
wp_register_script( 'product-type-script', plugin_dir_url( __FILE__ ) . '../admin/js/product-type.js', array(), $this->version, true );
146+
wp_enqueue_script( 'product-type-script' );
147+
148+
wp_register_script( 'course-id-restriction-script', plugin_dir_url( __FILE__ ) . '../admin/js/course-id-restriction.js', array(), $this->version, true );
149+
wp_enqueue_script( 'course-id-restriction-script' );
136150
}
137151

138152
/**
@@ -165,7 +179,7 @@ public function render_enrollment_info_form( $post ) {
165179
*
166180
* @return object Post type class object
167181
*/
168-
public function register_post_type( $post_type = '', $plural = '', $single = '', $description = '', array $options ) {
182+
public function register_post_type( $post_type = '', $plural = '', $single = '', $description = '', array $options = array() ) {
169183

170184
if ( ! $post_type || ! $plural || ! $single ) {
171185
return;
@@ -191,7 +205,7 @@ public function create_post_type(
191205
$plural = '',
192206
$single = '',
193207
$description = '',
194-
array $options
208+
array $options = array()
195209
) {
196210
return new Openedx_Commerce_Post_Type( $post_type, $plural, $single, $description, $options );
197211
}

includes/class-openedx-commerce.php

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ public function __construct() {
7676
$this->define_admin_hooks();
7777
$this->define_public_hooks();
7878
$this->define_plugin_settings_hooks();
79-
$this->define_enqueue_scripts();
8079
}
8180

8281
/**
@@ -217,13 +216,6 @@ private function define_admin_hooks() {
217216
$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
218217
$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' );
219218
$this->loader->add_filter( 'gettext', $this, 'openedx_plugin_custom_post_message', 10, 3 );
220-
$this->loader->wp_enqueue_style(
221-
$this->plugin_name,
222-
plugin_dir_url( __FILE__ ) . '../admin/css/class-openedx-commerce-admin.css',
223-
array(),
224-
$this->version,
225-
'all'
226-
);
227219

228220
// Redirection from enrollment to order and enrollment to order.
229221
$this->loader->add_filter( 'woocommerce_admin_order_item_headers', $plugin_admin, 'add_custom_column_order_items' );
@@ -264,20 +256,6 @@ private function define_public_hooks() {
264256
$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
265257
}
266258

267-
/**
268-
* Register all the hooks related to custom scripts for specific functionalities.
269-
*
270-
* @since 1.11.0
271-
* @access private
272-
*/
273-
private function define_enqueue_scripts() {
274-
wp_register_script( 'product-type-script', plugin_dir_url( __FILE__ ) . '../admin/js/product-type.js', array(), $this->get_version(), true );
275-
wp_enqueue_script( 'product-type-script' );
276-
277-
wp_register_script( 'course-id-restriction-script', plugin_dir_url( __FILE__ ) . '../admin/js/course-id-restriction.js', array(), $this->get_version(), true );
278-
wp_enqueue_script( 'course-id-restriction-script' );
279-
}
280-
281259
/**
282260
* Define the plugin settings hooks.
283261
*

openedx-commerce.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Plugin Name: Open edX Commerce
44
* Plugin URI: https://github.com/openedx/openedx-wordpress-ecommerce
55
* Description: Easily connect your WooCommerce store to Open edX.
6-
* Version: 2.0.6
6+
* Version: 2.0.7
77
* Author: Open edX Community
88
* Author URI: https://github.com/openedx/openedx-wordpress-ecommerce
99
* License: GPL-2.0+
@@ -32,7 +32,7 @@
3232
* Start at version 1.0.0 and use SemVer - https://semver.org
3333
* Rename this for your plugin and update it as you release new versions.
3434
*/
35-
define( 'OPENEDX_COMMERCE_VERSION', '2.0.6' );
35+
define( 'OPENEDX_COMMERCE_VERSION', '2.0.7' );
3636

3737
/**
3838
* The code that runs during plugin activation.

0 commit comments

Comments
 (0)