From f8d4fe46a149809cfa1a77326028cb9b17f0ce92 Mon Sep 17 00:00:00 2001 From: Syed Galib Ahmed Date: Thu, 6 Aug 2026 00:30:46 +0600 Subject: [PATCH 1/6] feat(order): add prepaid status --- includes/enums/order/status.php | 4 +++- includes/payments/functions.php | 1 + includes/repositories/order-repository.php | 3 ++- .../Version1/class-orders-controller.php | 2 ++ includes/setup/activation.php | 24 ++++++++++++++++++- 5 files changed, 31 insertions(+), 3 deletions(-) diff --git a/includes/enums/order/status.php b/includes/enums/order/status.php index b67531f9d8..c4ee9bd76c 100644 --- a/includes/enums/order/status.php +++ b/includes/enums/order/status.php @@ -6,6 +6,7 @@ class Status { const PENDING = 'pending'; + const PREPAID = 'prepaid'; const PAID = 'paid'; const FAILED = 'failed'; const CANCELLED = 'cancelled'; @@ -16,6 +17,7 @@ class Status { public static function all() { return [ self::PENDING, + self::PREPAID, self::PAID, self::FAILED, self::CANCELLED, @@ -24,4 +26,4 @@ public static function all() { self::UNPAID, ]; } -} \ No newline at end of file +} diff --git a/includes/payments/functions.php b/includes/payments/functions.php index 73106870b8..5cb3386b4c 100644 --- a/includes/payments/functions.php +++ b/includes/payments/functions.php @@ -45,6 +45,7 @@ function atbdp_get_payment_statuses() { $statuses = [ 'created' => __( "Created", 'directorist' ), 'pending' => __( "Pending", 'directorist' ), + 'prepaid' => __( "Prepaid", 'directorist' ), 'completed' => __( "Completed", 'directorist' ), 'failed' => __( "Failed", 'directorist' ), 'cancelled' => __( "Cancelled", 'directorist' ), diff --git a/includes/repositories/order-repository.php b/includes/repositories/order-repository.php index 67b9ebc600..9a4265dd95 100644 --- a/includes/repositories/order-repository.php +++ b/includes/repositories/order-repository.php @@ -11,6 +11,7 @@ use Directorist\Helpers\DateTime; use Directorist\DTO\Order\DTO; use Directorist\Enums\Order\Status as OrderStatus; +use Directorist\Enums\Payment\Status as PaymentStatus; use Directorist\Enums\Order\TaxType as OrderTaxType; use Directorist\Enums\Order\DiscountType as OrderDiscountType; use Directorist\DTO\Order\Read; @@ -169,7 +170,7 @@ public function update( \Directorist\Utils\DTO $dto ) { do_action( 'directorist_after_order_update', $this->to_dto( $updated_order ), $old_order ); - if ( $dto->is_initialized( 'status' ) ) { + if ( $dto->is_initialized( 'status' ) && in_array( $dto->get_status(), PaymentStatus::all(), true ) ) { ( new PaymentRepository )->update_status_by_order_id( $dto->get_id(), $dto->get_status() ); } diff --git a/includes/rest-api/Version1/class-orders-controller.php b/includes/rest-api/Version1/class-orders-controller.php index 4058166c37..afbea5c885 100644 --- a/includes/rest-api/Version1/class-orders-controller.php +++ b/includes/rest-api/Version1/class-orders-controller.php @@ -305,6 +305,7 @@ protected function legacy_status_to_current_status( string $status ): string { $map = array( 'created' => OrderStatus::PENDING, 'pending' => OrderStatus::PENDING, + 'prepaid' => OrderStatus::PREPAID, 'completed' => OrderStatus::PAID, 'failed' => OrderStatus::FAILED, 'cancelled' => OrderStatus::CANCELLED, @@ -317,6 +318,7 @@ protected function legacy_status_to_current_status( string $status ): string { protected function current_status_to_legacy_status( string $status ): string { $map = array( OrderStatus::PENDING => 'pending', + OrderStatus::PREPAID => 'prepaid', OrderStatus::PAID => 'completed', OrderStatus::FAILED => 'failed', OrderStatus::CANCELLED => 'cancelled', diff --git a/includes/setup/activation.php b/includes/setup/activation.php index f347f1034f..9f08fde7c0 100644 --- a/includes/setup/activation.php +++ b/includes/setup/activation.php @@ -21,6 +21,7 @@ public static function register_hooks() { public static function run() { // Run the activation tasks. self::create_tables(); + self::sync_order_status_enum(); } public static function create_tables() { @@ -77,4 +78,25 @@ public static function create_tables() { } ); } -} \ No newline at end of file + + private static function sync_order_status_enum() { + global $wpdb; + + $table_name = $wpdb->prefix . 'directorist_orders'; + + if ( $wpdb->get_var( $wpdb->prepare( 'SHOW TABLES LIKE %s', $table_name ) ) !== $table_name ) { + return; + } + + $statuses = array_map( + function( $status ) { + return "'" . esc_sql( $status ) . "'"; + }, + OrderStatus::all() + ); + + $wpdb->query( + "ALTER TABLE {$table_name} MODIFY status ENUM(" . implode( ',', $statuses ) . ") DEFAULT '" . esc_sql( OrderStatus::PENDING ) . "'" + ); + } +} From c6146117c1ded325c9df6d3b34a9bd167a8a5a08 Mon Sep 17 00:00:00 2001 From: Syed Galib Ahmed Date: Thu, 6 Aug 2026 22:35:45 +0600 Subject: [PATCH 2/6] fix: include directory slug in author profile links --- includes/classes/class-permalink.php | 20 ++++++++++++++++---- templates/single/section-author_info.php | 15 ++++++++------- templates/widgets/author-info.php | 17 +++++++++-------- 3 files changed, 33 insertions(+), 19 deletions(-) diff --git a/includes/classes/class-permalink.php b/includes/classes/class-permalink.php index f3f9776a33..52c615c3aa 100644 --- a/includes/classes/class-permalink.php +++ b/includes/classes/class-permalink.php @@ -33,12 +33,26 @@ public static function get_listing_permalink( $post_id = 0, $permalink = '' ) { $permalink = get_the_permalink( $post_id ); } + $directory_slug = self::get_listing_directory_type_slug( $post_id ); + + $permalink = str_replace( '%' . ATBDP_DIRECTORY_TYPE . '%', $directory_slug, $permalink ); + + return $permalink; + } + + /** + * Get the directory type slug for a listing. + * + * @param int $post_id Listing ID. + * @return string + */ + public static function get_listing_directory_type_slug( $post_id = 0 ) { $directory_slug = ''; $directory_id = directorist_get_listing_directory( $post_id ); if ( $directory_id ) { $directory_term = get_term( $directory_id, ATBDP_DIRECTORY_TYPE ); - $directory_slug = $directory_term ? $directory_term->slug : ''; + $directory_slug = ( $directory_term && ! is_wp_error( $directory_term ) ) ? $directory_term->slug : ''; } if ( empty( $directory_slug ) ) { @@ -49,9 +63,7 @@ public static function get_listing_permalink( $post_id = 0, $permalink = '' ) { } } - $permalink = str_replace( '%' . ATBDP_DIRECTORY_TYPE . '%', $directory_slug, $permalink ); - - return $permalink; + return $directory_slug; } public static function get_listing_slug() { diff --git a/templates/single/section-author_info.php b/templates/single/section-author_info.php index dea02ad27a..ba6a63b198 100644 --- a/templates/single/section-author_info.php +++ b/templates/single/section-author_info.php @@ -9,12 +9,13 @@ if ( ! defined( 'ABSPATH' ) ) exit; -$id = $listing->id; -$author_id = $listing->author_id; -$u_pro_pic = get_user_meta( $author_id, 'pro_pic', true ); -$u_pro_pic = ! empty( $u_pro_pic ) ? wp_get_attachment_image_src( $u_pro_pic, 'thumbnail' ) : ''; -$author_img = ! empty( $u_pro_pic ) ? $u_pro_pic[0] : ''; -$avatar_img = get_avatar( $author_id, 32 ); +$id = $listing->id; +$author_id = $listing->author_id; +$directory_type = ATBDP_Permalink::get_listing_directory_type_slug( $id ); +$u_pro_pic = get_user_meta( $author_id, 'pro_pic', true ); +$u_pro_pic = ! empty( $u_pro_pic ) ? wp_get_attachment_image_src( $u_pro_pic, 'thumbnail' ) : ''; +$author_img = ! empty( $u_pro_pic ) ? $u_pro_pic[0] : ''; +$avatar_img = get_avatar( $author_id, 32 ); ?>
section_id( $id ); ?>> @@ -112,7 +113,7 @@ - + diff --git a/templates/widgets/author-info.php b/templates/widgets/author-info.php index 876f701ec7..3cc293665d 100644 --- a/templates/widgets/author-info.php +++ b/templates/widgets/author-info.php @@ -12,13 +12,14 @@
@@ -124,8 +125,8 @@ class="directorist-single-author-contact-info-text" - -
\ No newline at end of file +
From 2cb30a0a5fe9c9a0ce6a195f58772b34475d0770 Mon Sep 17 00:00:00 2001 From: Syed Galib Ahmed Date: Mon, 17 Aug 2026 17:12:01 +0600 Subject: [PATCH 3/6] fix(order): preserve status column constraints --- includes/setup/activation.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/setup/activation.php b/includes/setup/activation.php index 9f08fde7c0..ee76faa185 100644 --- a/includes/setup/activation.php +++ b/includes/setup/activation.php @@ -96,7 +96,7 @@ function( $status ) { ); $wpdb->query( - "ALTER TABLE {$table_name} MODIFY status ENUM(" . implode( ',', $statuses ) . ") DEFAULT '" . esc_sql( OrderStatus::PENDING ) . "'" + "ALTER TABLE {$table_name} MODIFY status ENUM(" . implode( ',', $statuses ) . ") NOT NULL DEFAULT '" . esc_sql( OrderStatus::PENDING ) . "'" ); } } From 9eec0b0dcc6cde03bfb225b36209aeb16aa36df7 Mon Sep 17 00:00:00 2001 From: Syed Galib Ahmed Date: Mon, 17 Aug 2026 17:18:13 +0600 Subject: [PATCH 4/6] fix: include directory slug in author avatar link --- includes/model/SingleListing.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/includes/model/SingleListing.php b/includes/model/SingleListing.php index 377c707c8e..e2f551a55f 100644 --- a/includes/model/SingleListing.php +++ b/includes/model/SingleListing.php @@ -1590,12 +1590,13 @@ public function user_avatar() { $user_pro_pic = get_user_meta( $this->author_id, 'pro_pic', true ); $u_pro_pic = ! empty( $u_pro_pic ) ? wp_get_attachment_image_src( $u_pro_pic, 'thumbnail' ) : ''; $author_data = get_userdata( $this->author_id ); + $directory_type = ATBDP_Permalink::get_listing_directory_type_slug( $this->id ); $author_first_name = ! empty( $author_data ) ? $author_data->first_name : ''; $author_last_name = ! empty( $author_data ) ? $author_data->last_name : ''; $args = [ - 'author_link' => ATBDP_Permalink::get_user_profile_page_link( $this->author_id ), + 'author_link' => ATBDP_Permalink::get_user_profile_page_link( $this->author_id, $directory_type ), 'u_pro_pic' => $u_pro_pic, 'avatar_img' => get_avatar( $this->author_id, apply_filters( 'atbdp_avatar_size', 32 ) ), 'author_full_name' => $author_first_name . ' ' . $author_last_name, From 1bc3a55b50925e3cbcacb148d01bb59f81c019a1 Mon Sep 17 00:00:00 2001 From: Armanul46 <47377178+Armanul46@users.noreply.github.com> Date: Tue, 18 Aug 2026 01:54:00 +0600 Subject: [PATCH 5/6] readme update --- config.php | 2 +- directorist-base.php | 2 +- readme.txt | 10 +++++++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/config.php b/config.php index ebd94a5c14..85dec62a2b 100644 --- a/config.php +++ b/config.php @@ -1,7 +1,7 @@ Date: Mon, 24 Aug 2026 20:01:42 +0600 Subject: [PATCH 6/6] fix: preserve empty optional dropdown values --- templates/listing-form/custom-fields/select.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/templates/listing-form/custom-fields/select.php b/templates/listing-form/custom-fields/select.php index ac8d2b9fc1..8df27290ff 100644 --- a/templates/listing-form/custom-fields/select.php +++ b/templates/listing-form/custom-fields/select.php @@ -2,24 +2,34 @@ /** * @author wpWax * @since 6.6 - * @version 8.6 + * @version 8.9.4 */ if ( ! defined( 'ABSPATH' ) ) exit; // Get conditional logic attributes using centralized method $conditional_logic_attr = $listing_form->get_conditional_logic_attributes( $data ); +$options = ! empty( $data['options'] ) && is_array( $data['options'] ) ? $data['options'] : []; +$has_empty_option = in_array( '', wp_list_pluck( $options, 'option_value' ), true ); +$show_empty_option = empty( $data['required'] ) && ! $has_empty_option; +$placeholder = ! empty( $data['placeholder'] ) ? $data['placeholder'] : __( 'Select...', 'directorist' ); ?>
> field_label_template( $data );?> - +