diff --git a/config.php b/config.php index ebd94a5c14..85dec62a2b 100644 --- a/config.php +++ b/config.php @@ -1,7 +1,7 @@ ATBDP_POST_TYPE, @@ -120,46 +124,20 @@ private function featured_listing_followup() { // Start the Loop if ( $listings->found_posts ) { foreach ( $listings->posts as $listing ) { - $order = $this->get_order_by_listing( $listing->ID ); - if ( $order ) { - $days = round( abs( strtotime( current_time( 'mysql' ) ) - strtotime( $order[0]->post_date ) ) / 86400 ); - if ( $days > $featured_days ) { - do_action( 'atbdp_listing_featured_to_general', $listing->ID ); - update_post_meta( $listing->ID, '_featured', '' ); - } + $has_paid_order = $orders->listing_has_paid_featured_order( $listing->ID ); + $has_active_entitlement = $orders->listing_has_active_featured_entitlement( $listing->ID ); + + if ( ! $has_paid_order || $has_active_entitlement ) { + continue; } + + do_action( 'atbdp_listing_featured_to_general', $listing->ID ); + update_post_meta( $listing->ID, '_featured', '' ); } } } } - private function get_order_by_listing( $listing_id ) { - $args = [ - 'post_type' => ATBDP_ORDER_POST_TYPE, - 'posts_per_page' => 1, - 'post_status' => 'publish', - 'meta_query' => [ - 'relation' => 'AND', - [ - 'key' => '_listing_id', - 'value' => $listing_id, - ], - [ - 'key' => '_payment_status', - 'value' => 'completed', - ], - ], - ]; - - $listings = new WP_Query( $args ); - - // Start the Loop - if ( $listings->found_posts ) { - return $listings->posts; - } - return ''; - } - /** * Move listings to renewal status (only if applicable). * diff --git a/includes/classes/class-featured-listing-checkout.php b/includes/classes/class-featured-listing-checkout.php index e7ae39ef75..c1ea7b3007 100644 --- a/includes/classes/class-featured-listing-checkout.php +++ b/includes/classes/class-featured-listing-checkout.php @@ -13,16 +13,24 @@ class FeaturedListingCheckout { const CHECKOUT_TYPE = 'featured_listing'; - public function __construct() { - add_filter( 'directorist_checkout_types', [$this, 'add_checkout_type'] ); + public function __construct() { add_filter( 'directorist_order_data', [ $this, 'handle_order_data' ] ); - add_action( 'directorist_after_order_update', [$this, 'handle_after_order_update'] ); add_filter( 'directorist_payment_receipt_order_items', [$this, 'handle_payment_receipt_order_items'], 10, 2 ); + + add_action( 'plugins_loaded', [ $this, 'register_hooks' ], 20 ); + } + + public function register_hooks() { + if ( directorist_is_force_disabled_featured_listings() ) { + return; + } + + add_filter( 'directorist_checkout_types', [$this, 'add_checkout_type'] ); + add_action( 'directorist_after_order_update', [$this, 'handle_after_order_update'], 10, 2 ); add_filter( 'directorist_checkout_validation', [$this, 'validate_checkout'], 10, 2 ); add_action( 'directorist_checkout_table', [$this, 'handle_checkout_table'], 10, 4 ); add_filter( 'directorist_checkout_subtotal', [$this, 'handle_checkout_subtotal'], 10, 3 ); add_action( 'directorist_checkout_create_order', [$this, 'handle_checkout_create_order'], 10, 3 ); - add_action( 'directorist_before_order_update', [$this, 'handle_before_order_update'] ); add_filter( 'directorist_checkout_product_name', [$this, 'handle_checkout_product_name'], 10, 2 ); add_filter( 'directorist_ajax_listing_submission_response', [ $this, 'handle_listing_submission_response_data' ], 10, 2 ); add_filter( 'directorist_listing_update_args_after_preview', [ $this, 'handle_listing_status_after_preview' ], 10, 2 ); @@ -125,24 +133,7 @@ public function handle_checkout_create_order( OrderDTO $dto, string $checkout_ty $dto->set_listing_id( $request->get_param( 'listing_id' ) )->set_is_featured_listing( 1 )->set_ref_type( self::CHECKOUT_TYPE )->set_amount( $amount )->set_sub_total( $amount ); } - public function handle_before_order_update( OrderDTO $dto ) { - if ( ! $this->is_featured_order( $dto ) ) { - return; - } - - if ( ! $dto->is_initialized( 'status' ) || $dto->get_status() !== Status::PAID ) { - return; - } - - $order = directorist_get_order_by_id( $dto->get_id() ); - - if ( $order->is_featured_listing && ! $order->expires_at ) { - $featured_days = get_directorist_option( 'featured_listing_time', 30 ); - $dto->set_expires_at( directorist_now()->add_days( $featured_days ) ); - } - } - - public function handle_after_order_update( OrderDTO $dto ) { + public function handle_after_order_update( OrderDTO $dto, $old_order = null ) { if ( ! $this->is_featured_order( $dto ) ) { return; } @@ -152,19 +143,69 @@ public function handle_after_order_update( OrderDTO $dto ) { } if ( Status::PAID === $dto->get_status() ) { + $order_expiration = $this->should_refresh_order_expiration( $dto, $old_order ) + ? $this->refresh_order_expiration( $dto ) + : null; + directorist_set_listing_featured( $dto->get_listing_id(), true ); // Publish the listing if it's pending $listing = get_post( $dto->get_listing_id() ); - + + if ( $listing && $order_expiration ) { + $this->update_listing_expiration( $listing, $order_expiration ); + } + if ( $listing && 'publish' !== $listing->post_status ) { directorist_set_listing_status( $dto->get_listing_id(), 'publish' ); } - } else { + } elseif ( ! directorist_order_repository()->listing_has_active_featured_entitlement( $dto->get_listing_id() ) ) { directorist_set_listing_featured( $dto->get_listing_id(), false ); } } + private function is_paid_transition( $old_order ): bool { + return ! $old_order || ! isset( $old_order->status ) || Status::PAID !== $old_order->status; + } + + private function should_refresh_order_expiration( OrderDTO $order, $old_order ): bool { + return $this->is_paid_transition( $old_order ) || ! $order->is_initialized( 'expires_at' ); + } + + private function refresh_order_expiration( OrderDTO $order ) { + $featured_days = (int) get_directorist_option( 'featured_listing_time', 30 ); + $order_expiration = directorist_now()->add_days( $featured_days ); + + $order->set_expires_at( $order_expiration ); + $expiration_update = ( new OrderDTO() ) + ->set_id( $order->get_id() ) + ->set_expires_at( $order_expiration ); + + directorist_order_repository()->silent_update( $expiration_update ); + + return $order_expiration; + } + + private function update_listing_expiration( $listing, $order_expiration ) { + if ( get_post_meta( $listing->ID, '_never_expire', true ) ) { + return; + } + + $listing_expiration = get_post_meta( $listing->ID, '_expiry_date', true ); + $listing_expiration_date = $listing_expiration + ? date_create_from_format( 'Y-m-d H:i:s', $listing_expiration, wp_timezone() ) + : false; + + if ( $listing_expiration_date + && $listing_expiration === $listing_expiration_date->format( 'Y-m-d H:i:s' ) + && $listing_expiration_date->getTimestamp() >= $order_expiration->getTimestamp() + ) { + return; + } + + update_post_meta( $listing->ID, '_expiry_date', $order_expiration->format( 'Y-m-d H:i:s' ) ); + } + public function handle_payment_receipt_order_items( array $order_items, OrderDTO $order ) { if ( ! $this->is_featured_order( $order ) ) { return $order_items; @@ -206,7 +247,7 @@ public function handle_checkout_product_name( string $product_name, OrderDTO $dt } public function is_featured_order( OrderDTO $order_dto ): bool { - if ( ! $order_dto->is_initialized( 'ref_type' ) || ! $order_dto->is_initialized( 'ref' ) || ! $order_dto->is_initialized( 'listing_id' ) ) { + if ( ! $order_dto->is_initialized( 'ref_type' ) || ! $order_dto->is_initialized( 'listing_id' ) ) { return false; } 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/includes/directorist-core-functions.php b/includes/directorist-core-functions.php index 240cf293dd..e2d77dbb53 100644 --- a/includes/directorist-core-functions.php +++ b/includes/directorist-core-functions.php @@ -18,6 +18,13 @@ function directorist_is_guest_submission_enabled() { return (bool) get_directorist_option( 'guest_listings', false ); } +/** + * @return bool + */ +function directorist_is_force_disabled_featured_listings() { + return (bool) apply_filters( 'directorist_is_force_disabled_featured_listings', false ); +} + function directorist_is_featured_listing_enabled( array $context = [] ) { return (bool) apply_filters( 'directorist_is_featured_listing_enabled', get_directorist_option( 'enable_featured_listing' ), $context ); } 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/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, 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..c46779507b 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; @@ -88,6 +89,46 @@ public function listing_has_paid_featured_order( int $listing_id ): bool { return $order ? true : false; } + public function listing_has_active_featured_entitlement( int $listing_id ): bool { + $orders = $this->get_query_builder() + ->select( 'd_order.ref_type', 'd_order.created_at', 'd_order.expires_at' ) + ->where( 'd_order.listing_id', $listing_id ) + ->where( 'd_order.is_featured_listing', 1 ) + ->where( 'd_order.status', OrderStatus::PAID ) + ->get(); + + $current_time = directorist_now()->getTimestamp(); + $featured_days = (int) get_directorist_option( 'featured_listing_time', 30 ); + $is_active = false; + + foreach ( $orders as $order ) { + if ( ! empty( $order->expires_at ) ) { + $is_active = ( new DateTime( $order->expires_at ) )->getTimestamp() > $current_time; + } elseif ( 'featured_listing' === $order->ref_type ) { + $is_active = ( new DateTime( $order->created_at ) )->add_days( $featured_days )->getTimestamp() > $current_time; + } else { + $is_active = true; + } + + if ( $is_active ) { + break; + } + } + + return (bool) apply_filters( 'directorist_listing_has_active_featured_entitlement', $is_active, $listing_id, $orders ); + } + + public function get_latest_paid_featured_order_by_listing_id( int $listing_id ) { + return $this->get_query_builder() + ->select( 'd_order.created_at', 'd_order.expires_at' ) + ->where( 'd_order.listing_id', $listing_id ) + ->where( 'd_order.is_featured_listing', 1 ) + ->where( 'd_order.ref_type', 'featured_listing' ) + ->where( 'd_order.status', OrderStatus::PAID ) + ->order_by_desc( 'd_order.id' ) + ->first(); + } + protected function get_orders( Builder $query, Read $dto ) { $query = apply_filters( 'directorist_order_list_query', $query, $dto ); @@ -169,7 +210,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/repositories/payment-repository.php b/includes/repositories/payment-repository.php index d669148943..bb87f503ad 100644 --- a/includes/repositories/payment-repository.php +++ b/includes/repositories/payment-repository.php @@ -9,6 +9,7 @@ use Directorist\Utils\Database\Query\Builder; use Directorist\DTO\Payment\DTO; use Directorist\Enums\Order\Status as OrderStatus; +use Directorist\Enums\Payment\Status as PaymentStatus; use Directorist\DBModels\Payment; class PaymentRepository extends Repository { @@ -33,15 +34,34 @@ public function get( $order_id ) { * @return int */ public function create( \Directorist\Utils\DTO $dto ) { - $payment_id = parent::create( $dto ); + $payment_id = $this->create_without_order_update( $dto ); + $payment = $payment_id ? $this->get_by_id( $payment_id ) : null; + + if ( ! $payment || (int) $payment->id !== $payment_id || $payment->status !== $dto->get_status() ) { + return 0; + } - if ( $dto->is_initialized( 'status' ) && $dto->get_status() === OrderStatus::PAID ) { + if ( $dto->is_initialized( 'status' ) && $dto->get_status() === PaymentStatus::PAID ) { $this->order_repository->update_status( $dto->get_order_id(), OrderStatus::PAID ); } return $payment_id; } + /** + * Create a payment without synchronizing the related order status. + * + * @param \Directorist\Utils\DTO $dto Payment data. + * @return int Payment ID, or zero when the insert fails. + */ + public function create_without_order_update( \Directorist\Utils\DTO $dto ) { + global $wpdb; + + $payment_id = parent::create( $dto ); + + return $wpdb->last_error ? 0 : $payment_id; + } + public function update_status_by_order_id( int $order_id, string $status ): int { return $this->get_query_builder() ->where( 'order_id', $order_id ) @@ -69,4 +89,4 @@ public function to_dto( $payment ) { return $dto; } -} \ No newline at end of file +} diff --git a/includes/rest-api/Version1/class-orders-controller.php b/includes/rest-api/Version1/class-orders-controller.php index 4058166c37..f2f55bf2c4 100644 --- a/includes/rest-api/Version1/class-orders-controller.php +++ b/includes/rest-api/Version1/class-orders-controller.php @@ -12,6 +12,7 @@ use Directorist\DTO\Order\DTO as OrderDTO; use Directorist\DTO\Payment\DTO as PaymentDTO; use Directorist\Enums\Order\Status as OrderStatus; +use Directorist\Enums\Payment\Status as PaymentStatus; use WP_Error; use WP_REST_Request; use WP_REST_Server; @@ -140,7 +141,8 @@ public function create_item( $request ) { $dto = apply_filters( 'directorist_rest_legacy_order_create_dto', $dto, $request ); - $order_id = directorist_order_repository()->create( $dto ); + $order_repository = directorist_order_repository(); + $order_id = $order_repository->create( $dto ); if ( ! $order_id ) { return new WP_Error( 'invalid_order', __( 'Unable to create order.', 'directorist' ), array( 'status' => 400 ) ); @@ -153,11 +155,25 @@ public function create_item( $request ) { ->set_order_id( $order_id ) ->set_amount( $amount ) ->set_currency( $currency ) - ->set_status( $this->legacy_status_to_current_status( $legacy_status ) ) + ->set_status( $this->legacy_payment_status_to_current_status( $legacy_status ) ) ->set_method( $gateway ) ->set_transaction_id( $transaction_id ? $transaction_id : null ); - directorist_payment_repository()->create( apply_filters( 'directorist_rest_legacy_order_create_payment_dto', $payment_dto, $request, $dto ) ); + $payment_dto = apply_filters( 'directorist_rest_legacy_order_create_payment_dto', $payment_dto, $request, $dto ); + $payment_repository = directorist_payment_repository(); + $payment_id = $payment_repository->create_without_order_update( $payment_dto ); + $payment = $payment_id ? $payment_repository->get_by_id( $payment_id ) : null; + + if ( ! $payment_id || ! $payment || (int) $payment->id !== $payment_id || $payment->status !== $payment_dto->get_status() ) { + $payment_repository->delete_by( 'order_id', $order_id ); + $order_repository->delete_by_id( $order_id ); + + return new WP_Error( 'rest_payment_create_failed', __( 'Unable to create payment.', 'directorist' ), array( 'status' => 500 ) ); + } + + if ( OrderStatus::PAID === $dto->get_status() ) { + $order_repository->update_status( $order_id, OrderStatus::PAID ); + } } do_action( 'atbdp_order_created', $order_id, $listing_id ); @@ -258,6 +274,9 @@ protected function get_order( int $order_id ) { protected function prepare_legacy_order_data( $order, WP_REST_Request $request ): array { $payment = ! empty( $order->payment ) ? $order->payment : null; $plan_id = $this->get_plan_id( $order ); + $status = OrderStatus::PREPAID === ( $order->status ?? '' ) + ? $order->status + : ( $payment->status ?? $order->status ?? '' ); $data = array( 'id' => (int) $order->id, @@ -273,7 +292,7 @@ protected function prepare_legacy_order_data( $order, WP_REST_Request $request ) 'remaining_featured_listings' => 0, 'amount' => round( (float) ( $order->amount ?? 0 ), 2 ), 'currency' => (string) ( $order->currency ?? '' ), - 'payment_status' => $this->current_status_to_legacy_status( $payment->status ?? $order->status ?? '' ), + 'payment_status' => $this->current_status_to_legacy_status( $status ), 'payment_gateway' => (string) ( $payment->method ?? '' ), 'transaction_id' => (string) ( $payment->transaction_id ?? '' ), 'created_by' => 'web', @@ -305,6 +324,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, @@ -314,9 +334,24 @@ protected function legacy_status_to_current_status( string $status ): string { return $map[ $status ] ?? OrderStatus::PENDING; } + protected function legacy_payment_status_to_current_status( string $status ): string { + $map = array( + 'created' => PaymentStatus::PENDING, + 'pending' => PaymentStatus::PENDING, + 'prepaid' => PaymentStatus::PAID, + 'completed' => PaymentStatus::PAID, + 'failed' => PaymentStatus::FAILED, + 'cancelled' => PaymentStatus::CANCELLED, + 'refunded' => PaymentStatus::REFUNDED, + ); + + return $map[ $status ] ?? PaymentStatus::PENDING; + } + 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..ee76faa185 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 ) . ") NOT NULL DEFAULT '" . esc_sql( OrderStatus::PENDING ) . "'" + ); + } +} diff --git a/readme.txt b/readme.txt index 540e9c57ab..5a19c4f12a 100644 --- a/readme.txt +++ b/readme.txt @@ -5,7 +5,7 @@ Tags: business directory, listings, classifieds, directory plugin, directory Requires at least: 4.6 Tested up to: 7.0 Requires PHP: 7.0 -Stable tag: 8.9.3 +Stable tag: 8.9.4 License: GPLv3 License URI: https://www.gnu.org/licenses/gpl-3.0.html @@ -300,6 +300,15 @@ Directorist comes with an AI-powered directory builder. Use the Create with AI o == Changelog == += 8.9.4 - Aug 18, 2026 = + +**Improved** +- Added prepaid order status support across order management and REST API status mapping. (#2955) + +**Fixed** +- Author profile links missing directory type slug in multi-directory listings. (#2957) +- Featured listing expiration sync issue. (#2969) + = 8.9.3 - Aug 9, 2026 = **Security** 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 +