From 5e755a02fbd6b43db7ed60f4d96b52e31fe0452e Mon Sep 17 00:00:00 2001 From: Julian Ramirez Date: Fri, 21 Jul 2023 16:00:26 -0500 Subject: [PATCH 01/18] style: modify form design to enhance ergonomics --- ...oocommerce_Plugin_Enrollment_Info_Form.php | 57 ++++++++++++------- 1 file changed, 37 insertions(+), 20 deletions(-) diff --git a/admin/views/Openedx_Woocommerce_Plugin_Enrollment_Info_Form.php b/admin/views/Openedx_Woocommerce_Plugin_Enrollment_Info_Form.php index 8f65071..4fb96ca 100644 --- a/admin/views/Openedx_Woocommerce_Plugin_Enrollment_Info_Form.php +++ b/admin/views/Openedx_Woocommerce_Plugin_Enrollment_Info_Form.php @@ -183,6 +183,27 @@ public function render_enrollment_info_form( $post ) {

Last edited:

+ + + + + + + + + + + + + + @@ -190,32 +211,28 @@ public function render_enrollment_info_form( $post ) { get_logs(); ?> - +
+

+
+
post_type, 'side' ); - add_meta_box( 'openedx_enrollment_request_actions', sprintf( __( '%s actions', '' ), 'Open edX Enrollment Requests' ), array( $this, 'render_actions_box' ), $this->post_type, 'side', 'high' ); + add_meta_box( 'openedx_enrollment_request_actions', 'Enrollment Operation Logs', array( $this, 'render_actions_box' ), $this->post_type, 'side', 'high' ); } } From ccb08d1679983e5f49806111e9f46816cce3ac99 Mon Sep 17 00:00:00 2001 From: Julian Ramirez Date: Fri, 21 Jul 2023 16:02:10 -0500 Subject: [PATCH 02/18] fix: added comments to test function for logs --- ...Openedx_Woocommerce_Plugin_Enrollment_Info_Form.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/admin/views/Openedx_Woocommerce_Plugin_Enrollment_Info_Form.php b/admin/views/Openedx_Woocommerce_Plugin_Enrollment_Info_Form.php index 4fb96ca..07dc6c8 100644 --- a/admin/views/Openedx_Woocommerce_Plugin_Enrollment_Info_Form.php +++ b/admin/views/Openedx_Woocommerce_Plugin_Enrollment_Info_Form.php @@ -211,7 +211,9 @@ public function render_enrollment_info_form( $post ) { get_logs(); ?>
@@ -244,7 +246,7 @@ public function render_actions_box() { public function replace_admin_meta_boxes() { remove_meta_box( 'submitdiv', $this->post_type, 'side' ); - add_meta_box( 'openedx_enrollment_request_actions', 'Enrollment Operation Logs', array( $this, 'render_actions_box' ), $this->post_type, 'side', 'high' ); + add_meta_box( 'openedx_enrollment_request_actions', 'Enrollment Operation Logs', array( $this, 'render_logs_box' ), $this->post_type, 'side', 'high' ); } } From 5ef035e5a6355e614ebc5f28c939616751255e05 Mon Sep 17 00:00:00 2001 From: Julian Ramirez Date: Fri, 21 Jul 2023 16:22:46 -0500 Subject: [PATCH 03/18] fix: deleted unnecessary comment in logs test function --- admin/views/Openedx_Woocommerce_Plugin_Enrollment_Info_Form.php | 1 - 1 file changed, 1 deletion(-) diff --git a/admin/views/Openedx_Woocommerce_Plugin_Enrollment_Info_Form.php b/admin/views/Openedx_Woocommerce_Plugin_Enrollment_Info_Form.php index 07dc6c8..8f62a77 100644 --- a/admin/views/Openedx_Woocommerce_Plugin_Enrollment_Info_Form.php +++ b/admin/views/Openedx_Woocommerce_Plugin_Enrollment_Info_Form.php @@ -218,7 +218,6 @@ public function get_logs() { $logs = "Log 1\n"; $logs .= "Log 2\n"; $logs .= "Log 3\n"; - // Puedes agregar más logs o obtenerlos de donde sea necesario return $logs; } From 709ecc607b57ab7a6db5bc602d262958b7e9cacc Mon Sep 17 00:00:00 2001 From: Julian Ramirez Date: Fri, 21 Jul 2023 16:34:22 -0500 Subject: [PATCH 04/18] refactor: improve enrollment action message --- includes/Openedx_Woocommerce_Plugin.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/includes/Openedx_Woocommerce_Plugin.php b/includes/Openedx_Woocommerce_Plugin.php index e32e898..4d3e1ee 100644 --- a/includes/Openedx_Woocommerce_Plugin.php +++ b/includes/Openedx_Woocommerce_Plugin.php @@ -181,6 +181,7 @@ 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 ); } @@ -200,6 +201,22 @@ private function define_public_hooks() { } + /** + * Modify the message displayed when a custom-post-type is updated + * + * @param string $translated_text translation text + * @param string $text text to be translated + * @param string $domain text domain + * @return string $translated_text post updated message + */ + function openedx_plugin_custom_post_message( $translated_text, $text, $domain ) { + // Reemplazar el mensaje solo si el dominio es el que utiliza WordPress para los mensajes de "Post" + if ( $domain === 'default' && $text === 'Post updated.' ) { + $translated_text = 'Enrollment action executed'; // Reemplaza con el mensaje deseado + } + return $translated_text; + } + /** * Run the loader to execute all of the hooks with WordPress. * From 6735e7ca739a8d68f64c6cf9f4a791b6ee35a404 Mon Sep 17 00:00:00 2001 From: Julian Ramirez Date: Fri, 21 Jul 2023 16:36:31 -0500 Subject: [PATCH 05/18] fix: adjusted function comment based on phpcs --- admin/views/Openedx_Woocommerce_Plugin_Enrollment_Info_Form.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/admin/views/Openedx_Woocommerce_Plugin_Enrollment_Info_Form.php b/admin/views/Openedx_Woocommerce_Plugin_Enrollment_Info_Form.php index 8f62a77..adc2af4 100644 --- a/admin/views/Openedx_Woocommerce_Plugin_Enrollment_Info_Form.php +++ b/admin/views/Openedx_Woocommerce_Plugin_Enrollment_Info_Form.php @@ -213,6 +213,8 @@ public function render_enrollment_info_form( $post ) { /** * Temporary function to get test logs for the logs box + * + * @return string Test logs */ public function get_logs() { $logs = "Log 1\n"; From 4c5f2f1958314bea896223baa45af3b8b64b81fe Mon Sep 17 00:00:00 2001 From: Julian Ramirez Date: Fri, 21 Jul 2023 16:39:41 -0500 Subject: [PATCH 06/18] style: deleted logs field from form --- ...x_Woocommerce_Plugin_Enrollment_Info_Form.php | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/admin/views/Openedx_Woocommerce_Plugin_Enrollment_Info_Form.php b/admin/views/Openedx_Woocommerce_Plugin_Enrollment_Info_Form.php index adc2af4..5ff1126 100644 --- a/admin/views/Openedx_Woocommerce_Plugin_Enrollment_Info_Form.php +++ b/admin/views/Openedx_Woocommerce_Plugin_Enrollment_Info_Form.php @@ -153,21 +153,6 @@ public function render_enrollment_info_form( $post ) { - - - - - -

- - - - - -

No errors ocurred processing this request

- - - @@ -220,6 +205,7 @@ public function get_logs() { $logs = "Log 1\n"; $logs .= "Log 2\n"; $logs .= "Log 3\n"; + $logs .= "No errors ocurred\n"; return $logs; } From 79bb6a914813a0d1ba45a4a7547185fee25da6c5 Mon Sep 17 00:00:00 2001 From: Julian Ramirez Date: Fri, 21 Jul 2023 16:40:21 -0500 Subject: [PATCH 07/18] fix: deleted spanish comments into custom message function --- includes/Openedx_Woocommerce_Plugin.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/Openedx_Woocommerce_Plugin.php b/includes/Openedx_Woocommerce_Plugin.php index 4d3e1ee..d7e9f6f 100644 --- a/includes/Openedx_Woocommerce_Plugin.php +++ b/includes/Openedx_Woocommerce_Plugin.php @@ -210,9 +210,9 @@ private function define_public_hooks() { * @return string $translated_text post updated message */ function openedx_plugin_custom_post_message( $translated_text, $text, $domain ) { - // Reemplazar el mensaje solo si el dominio es el que utiliza WordPress para los mensajes de "Post" + if ( $domain === 'default' && $text === 'Post updated.' ) { - $translated_text = 'Enrollment action executed'; // Reemplaza con el mensaje deseado + $translated_text = 'Enrollment action executed'; } return $translated_text; } From 05590b1d176251109572fd9b185bcfc6e4c00bc2 Mon Sep 17 00:00:00 2001 From: Julian Ramirez Date: Fri, 21 Jul 2023 16:53:47 -0500 Subject: [PATCH 08/18] fix: phpcs corrections in form and plugin files --- ...edx_Woocommerce_Plugin_Enrollment_Info_Form.php | 2 +- includes/Openedx_Woocommerce_Plugin.php | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/admin/views/Openedx_Woocommerce_Plugin_Enrollment_Info_Form.php b/admin/views/Openedx_Woocommerce_Plugin_Enrollment_Info_Form.php index 5ff1126..71b2ef2 100644 --- a/admin/views/Openedx_Woocommerce_Plugin_Enrollment_Info_Form.php +++ b/admin/views/Openedx_Woocommerce_Plugin_Enrollment_Info_Form.php @@ -48,7 +48,7 @@ public function render_enrollment_info_form( $post ) { $order_id = get_post_meta( $post_id, 'order_id', true ); $new_enrollment = false; - if ( ! $course_id && ! $email ) { + if (! $course_id && ! $email) { $new_enrollment = true; } ?> diff --git a/includes/Openedx_Woocommerce_Plugin.php b/includes/Openedx_Woocommerce_Plugin.php index d7e9f6f..119e7a9 100644 --- a/includes/Openedx_Woocommerce_Plugin.php +++ b/includes/Openedx_Woocommerce_Plugin.php @@ -107,41 +107,41 @@ private function load_dependencies() { * The class responsible for orchestrating the actions and filters of the * core plugin. */ - include_once plugin_dir_path( dirname( __FILE__ )) . 'includes/Openedx_Woocommerce_Plugin_Loader.php'; + include_once plugin_dir_path( dirname(__FILE__)) . 'includes/Openedx_Woocommerce_Plugin_Loader.php'; /** * The class responsible for defining internationalization functionality * of the plugin. */ - include_once plugin_dir_path( dirname( __FILE__ )) . 'includes/Openedx_Woocommerce_Plugin_i18n.php'; + include_once plugin_dir_path( dirname(__FILE__)) . 'includes/Openedx_Woocommerce_Plugin_i18n.php'; /** * The class responsible for defining all actions that occur in the admin area. */ - include_once plugin_dir_path( dirname( __FILE__ )) . 'admin/Openedx_Woocommerce_Plugin_Admin.php'; + include_once plugin_dir_path( dirname(__FILE__)) . 'admin/Openedx_Woocommerce_Plugin_Admin.php'; /** * The class responsible for defining all actions that occur in the public-facing * side of the site. */ - include_once plugin_dir_path( dirname( __FILE__ )) . 'public/Openedx_Woocommerce_Plugin_Public.php'; + include_once plugin_dir_path( dirname(__FILE__)) . 'public/Openedx_Woocommerce_Plugin_Public.php'; $this->loader = new Openedx_Woocommerce_Plugin_Loader(); /** * The class responsible for defining the enrollment object */ - include_once plugin_dir_path( dirname( __FILE__ )) . 'includes/model/Openedx_Woocommerce_Plugin_Enrollment.php'; + include_once plugin_dir_path( dirname(__FILE__)) . 'includes/model/Openedx_Woocommerce_Plugin_Enrollment.php'; /** * The class responsible for defining the custom-post-type object */ - include_once plugin_dir_path( dirname( __FILE__ )) . 'includes/model/Openedx_Woocommerce_Plugin_Post_Type.php'; + include_once plugin_dir_path( dirname(__FILE__)) . 'includes/model/Openedx_Woocommerce_Plugin_Post_Type.php'; /** * The class responsible for rendering the enrollment info form */ - include_once plugin_dir_path( dirname( __FILE__ )) . 'admin/views/Openedx_Woocommerce_Plugin_Enrollment_Info_Form.php'; + include_once plugin_dir_path( dirname(__FILE__)) . 'admin/views/Openedx_Woocommerce_Plugin_Enrollment_Info_Form.php'; } From 4c99388e8107916ae46688df5fc63b0e228bdc9e Mon Sep 17 00:00:00 2001 From: Julian Ramirez Date: Fri, 21 Jul 2023 16:55:04 -0500 Subject: [PATCH 09/18] fix: phpcs corrections with identation --- ...edx_Woocommerce_Plugin_Enrollment_Info_Form.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/admin/views/Openedx_Woocommerce_Plugin_Enrollment_Info_Form.php b/admin/views/Openedx_Woocommerce_Plugin_Enrollment_Info_Form.php index 71b2ef2..a3e490d 100644 --- a/admin/views/Openedx_Woocommerce_Plugin_Enrollment_Info_Form.php +++ b/admin/views/Openedx_Woocommerce_Plugin_Enrollment_Info_Form.php @@ -68,12 +68,14 @@ public function render_enrollment_info_form( $post ) { -
- - -
+
+ + +
From 31d0875ed525b585c137e9010db78d6f4584e586 Mon Sep 17 00:00:00 2001 From: Julian Ramirez Date: Mon, 24 Jul 2023 13:04:11 -0500 Subject: [PATCH 10/18] fix: corrected plugin name and submenu title --- includes/model/Openedx_Woocommerce_Plugin_Enrollment.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/includes/model/Openedx_Woocommerce_Plugin_Enrollment.php b/includes/model/Openedx_Woocommerce_Plugin_Enrollment.php index 21cc719..9d43321 100644 --- a/includes/model/Openedx_Woocommerce_Plugin_Enrollment.php +++ b/includes/model/Openedx_Woocommerce_Plugin_Enrollment.php @@ -58,10 +58,17 @@ public function register_enrollment_custom_post_type(){ 'show_in_nav_menus' => true, 'supports' => array( '' ), 'menu_icon' => 'dashicons-admin-post', + 'labels' => array( + 'name' => 'Open edX Enrollment Requests', + 'singular_name' => 'Open edX Enrollment Request', + 'menu_name' => 'Open edX Sync', + 'all_items' => 'Enrollments Manager', + 'add_new_item' => 'Add New Enrollment Request', + ), ); // Register post-type using wrapper custom-post-type function - $this->parent->register_post_type( 'openedx_enrollment', 'Open edX Enrollment Requests', 'Open edX Enrollment Request', '', $enrollment_cpt_options ); + $this->parent->register_post_type( 'openedx_enrollment', ' ', ' ', '', $enrollment_cpt_options ); } public function unregister_save_hook() { From 4677205f05ca0e9cc034d24723e7b27cb819df7b Mon Sep 17 00:00:00 2001 From: Julian Ramirez Date: Mon, 24 Jul 2023 13:09:05 -0500 Subject: [PATCH 11/18] fix: phpcs corrections --- .../Openedx_Woocommerce_Plugin_Enrollment.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/includes/model/Openedx_Woocommerce_Plugin_Enrollment.php b/includes/model/Openedx_Woocommerce_Plugin_Enrollment.php index 9d43321..fc3fd33 100644 --- a/includes/model/Openedx_Woocommerce_Plugin_Enrollment.php +++ b/includes/model/Openedx_Woocommerce_Plugin_Enrollment.php @@ -71,12 +71,22 @@ public function register_enrollment_custom_post_type(){ $this->parent->register_post_type( 'openedx_enrollment', ' ', ' ', '', $enrollment_cpt_options ); } + /** + * Unregister the save hook to prevent an infinite cycle of hook recursion + * + * @return void + */ public function unregister_save_hook() { - remove_action( 'save_post', array( $this, 'save_action' ), 10, 3 ); + remove_action( 'save_post', array($this, 'save_action'), 10, 3 ); } - + + /** + * Register the save hook to prevent an infinite cycle of hook recursion + * + * @return void + */ public function register_save_hook() { - add_action( 'save_post', array( $this, 'save_action' ), 10, 3 ); + add_action( 'save_post', array($this, 'save_action'), 10, 3 ); } /** From 1de0c21882b5e6121b148744f1a1f892497d9e50 Mon Sep 17 00:00:00 2001 From: Julian Ramirez Date: Mon, 24 Jul 2023 13:13:23 -0500 Subject: [PATCH 12/18] fix: phpcs code fix --- .../model/Openedx_Woocommerce_Plugin_Enrollment.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/includes/model/Openedx_Woocommerce_Plugin_Enrollment.php b/includes/model/Openedx_Woocommerce_Plugin_Enrollment.php index fc3fd33..1900b1e 100644 --- a/includes/model/Openedx_Woocommerce_Plugin_Enrollment.php +++ b/includes/model/Openedx_Woocommerce_Plugin_Enrollment.php @@ -76,7 +76,7 @@ public function register_enrollment_custom_post_type(){ * * @return void */ - public function unregister_save_hook() { + public function unregisterSaveHook() { remove_action( 'save_post', array($this, 'save_action'), 10, 3 ); } @@ -85,7 +85,7 @@ public function unregister_save_hook() { * * @return void */ - public function register_save_hook() { + public function registerSaveHook() { add_action( 'save_post', array($this, 'save_action'), 10, 3 ); } @@ -170,7 +170,7 @@ public function save_action( $post_id, $post, $update ) { 'enrollment_order_id' => sanitize_text_field($_POST['enrollment_order_id'] ?? ''), ); - $enrollment_action = sanitize_text_field( $_POST['enrollment_action'] ?? '' ); + $enrollment_action = sanitize_text_field($_POST['enrollment_action'] ?? ''); $this->save_enrollment( $post, $enrollment_arr, $enrollment_action ); } @@ -245,8 +245,8 @@ public function save_enrollment( $post, $enrollment_arr, $enrollment_action ) { } // Only update the post status if it has no custom status yet. - if ( $post->post_status !== 'enrollment-success' && $post->post_status !== 'enrollment-pending' && $post->post_status !== 'enrollment-error' ) { - $this->update_post( $post_id, 'enrollment-pending' ); + if ($post->post_status !== 'enrollment-success' && $post->post_status !== 'enrollment-pending' && $post->post_status !== 'enrollment-error') { + $this->update_post($post_id, 'enrollment-pending'); } } @@ -256,7 +256,7 @@ public function save_enrollment( $post, $enrollment_arr, $enrollment_action ) { * @param string $status The status of the request. * @param int $post_id The post ID. */ - public function update_post( $post_id, $status = null ) { + public function updatePost( $post_id, $status = null ) { $enrollment_course_id = get_post_meta( $post_id, 'course_id', true ); $enrollment_email = get_post_meta( $post_id, 'email', true ); From c5535a192c036247328e229f3b33e7fba2279f2d Mon Sep 17 00:00:00 2001 From: Julian Ramirez Date: Mon, 24 Jul 2023 13:16:02 -0500 Subject: [PATCH 13/18] fix: phpcs spaces correction --- .../Openedx_Woocommerce_Plugin_Enrollment.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/includes/model/Openedx_Woocommerce_Plugin_Enrollment.php b/includes/model/Openedx_Woocommerce_Plugin_Enrollment.php index 1900b1e..61b9719 100644 --- a/includes/model/Openedx_Woocommerce_Plugin_Enrollment.php +++ b/includes/model/Openedx_Woocommerce_Plugin_Enrollment.php @@ -163,11 +163,11 @@ public function save_action( $post_id, $post, $update ) { } $enrollment_arr = array( - 'enrollment_course_id' => sanitize_text_field($_POST['enrollment_course_id'] ?? ''), - 'enrollment_email' => sanitize_text_field($_POST['enrollment_email'] ?? ''), - 'enrollment_mode' => sanitize_text_field($_POST['enrollment_mode'] ?? ''), + 'enrollment_course_id' => sanitize_text_field( $_POST['enrollment_course_id'] ?? '' ), + 'enrollment_email' => sanitize_text_field($_POST['enrollment_email'] ?? ''), + 'enrollment_mode' => sanitize_text_field($_POST['enrollment_mode'] ?? ''), 'enrollment_request_type' => sanitize_text_field($_POST['enrollment_request_type'] ?? ''), - 'enrollment_order_id' => sanitize_text_field($_POST['enrollment_order_id'] ?? ''), + 'enrollment_order_id' => sanitize_text_field($_POST['enrollment_order_id'] ?? ''), ); $enrollment_action = sanitize_text_field($_POST['enrollment_action'] ?? ''); @@ -258,9 +258,9 @@ public function save_enrollment( $post, $enrollment_arr, $enrollment_action ) { */ public function updatePost( $post_id, $status = null ) { - $enrollment_course_id = get_post_meta( $post_id, 'course_id', true ); - $enrollment_email = get_post_meta( $post_id, 'email', true ); - $enrollment_mode = get_post_meta( $post_id, 'mode', true ); + $enrollment_course_id = get_post_meta($post_id, 'course_id', true); + $enrollment_email = get_post_meta($post_id, 'email', true); + $enrollment_mode = get_post_meta($post_id, 'mode', true); $post_update = array( 'ID' => $post_id, @@ -271,6 +271,6 @@ public function updatePost( $post_id, $status = null ) { $post_update['post_status'] = $status; } - $this->wp_update_post( $post_update ); + $this->wp_update_post($post_update); } } From 733bbd06731ce20d9f0e0f032c468e30742e9bb9 Mon Sep 17 00:00:00 2001 From: Julian Ramirez Date: Mon, 24 Jul 2023 13:20:57 -0500 Subject: [PATCH 14/18] fix: phpcs spaces correction --- includes/model/Openedx_Woocommerce_Plugin_Enrollment.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/includes/model/Openedx_Woocommerce_Plugin_Enrollment.php b/includes/model/Openedx_Woocommerce_Plugin_Enrollment.php index 61b9719..d424db8 100644 --- a/includes/model/Openedx_Woocommerce_Plugin_Enrollment.php +++ b/includes/model/Openedx_Woocommerce_Plugin_Enrollment.php @@ -166,7 +166,9 @@ public function save_action( $post_id, $post, $update ) { 'enrollment_course_id' => sanitize_text_field( $_POST['enrollment_course_id'] ?? '' ), 'enrollment_email' => sanitize_text_field($_POST['enrollment_email'] ?? ''), 'enrollment_mode' => sanitize_text_field($_POST['enrollment_mode'] ?? ''), - 'enrollment_request_type' => sanitize_text_field($_POST['enrollment_request_type'] ?? ''), + 'enrollment_request_type' => sanitize_text_field( + $_POST['enrollment_request_type'] ?? '' + ), 'enrollment_order_id' => sanitize_text_field($_POST['enrollment_order_id'] ?? ''), ); From 5b311dbcfd6d9235ca24aed805da54e0569092a8 Mon Sep 17 00:00:00 2001 From: Julian Ramirez Date: Mon, 24 Jul 2023 13:23:40 -0500 Subject: [PATCH 15/18] fix: phpcs if statement correction --- includes/model/Openedx_Woocommerce_Plugin_Enrollment.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/includes/model/Openedx_Woocommerce_Plugin_Enrollment.php b/includes/model/Openedx_Woocommerce_Plugin_Enrollment.php index d424db8..5a87498 100644 --- a/includes/model/Openedx_Woocommerce_Plugin_Enrollment.php +++ b/includes/model/Openedx_Woocommerce_Plugin_Enrollment.php @@ -242,7 +242,9 @@ public function save_enrollment( $post, $enrollment_arr, $enrollment_action ) { // Check if old post_meta tags are different from the new ones. - if ($old_course_id !== $enrollment_course_id || $old_email !== $enrollment_email || $old_mode !== $enrollment_mode) { + if ($old_course_id !== $enrollment_course_id || + $old_email !== $enrollment_email || + $old_mode !== $enrollment_mode) { $this->update_post($post_id); } From b47cfa546aac7a5fd268e07cd50c89da08b05106 Mon Sep 17 00:00:00 2001 From: Julian Ramirez Date: Mon, 24 Jul 2023 13:25:27 -0500 Subject: [PATCH 16/18] fix: phpcs long line fix --- includes/model/Openedx_Woocommerce_Plugin_Enrollment.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/includes/model/Openedx_Woocommerce_Plugin_Enrollment.php b/includes/model/Openedx_Woocommerce_Plugin_Enrollment.php index 5a87498..6890f31 100644 --- a/includes/model/Openedx_Woocommerce_Plugin_Enrollment.php +++ b/includes/model/Openedx_Woocommerce_Plugin_Enrollment.php @@ -267,8 +267,9 @@ public function updatePost( $post_id, $status = null ) { $enrollment_mode = get_post_meta($post_id, 'mode', true); $post_update = array( - 'ID' => $post_id, - 'post_title' => $enrollment_course_id . ' | ' . $enrollment_email . ' | Mode: ' . $enrollment_mode, + 'ID' => $post_id, + 'post_title' + => $enrollment_course_id .' | '. $enrollment_email .' | Mode: '.$enrollment_mode, ); if ($status) { From 7ad507518e1aa75603e2e7a6ab54bb80ec0c2b88 Mon Sep 17 00:00:00 2001 From: Julian Ramirez Date: Mon, 24 Jul 2023 15:36:19 -0500 Subject: [PATCH 17/18] fix: minor design adjustments for labels and titles --- ...Openedx_Woocommerce_Plugin_Enrollment_Info_Form.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/admin/views/Openedx_Woocommerce_Plugin_Enrollment_Info_Form.php b/admin/views/Openedx_Woocommerce_Plugin_Enrollment_Info_Form.php index a3e490d..9752e21 100644 --- a/admin/views/Openedx_Woocommerce_Plugin_Enrollment_Info_Form.php +++ b/admin/views/Openedx_Woocommerce_Plugin_Enrollment_Info_Form.php @@ -66,10 +66,9 @@ public function render_enrollment_info_form( $post ) { - +
- - + @@ -221,7 +220,6 @@ public function render_logs_box() { $logs = $this->get_logs(); ?>
-

Date: Mon, 24 Jul 2023 15:38:22 -0500 Subject: [PATCH 18/18] fix: fixed edit post item title --- includes/model/Openedx_Woocommerce_Plugin_Enrollment.php | 1 + 1 file changed, 1 insertion(+) diff --git a/includes/model/Openedx_Woocommerce_Plugin_Enrollment.php b/includes/model/Openedx_Woocommerce_Plugin_Enrollment.php index 6890f31..eaaa242 100644 --- a/includes/model/Openedx_Woocommerce_Plugin_Enrollment.php +++ b/includes/model/Openedx_Woocommerce_Plugin_Enrollment.php @@ -64,6 +64,7 @@ public function register_enrollment_custom_post_type(){ 'menu_name' => 'Open edX Sync', 'all_items' => 'Enrollments Manager', 'add_new_item' => 'Add New Enrollment Request', + 'edit_item' => 'Edit Enrollment Request', ), );