Skip to content

Commit

Permalink
fix: Black recommended plugins page in case all of the recommended pa…
Browse files Browse the repository at this point in the history
…ge already installed
  • Loading branch information
devAsadNur committed Jan 17, 2025
1 parent 705eb76 commit 3ae552a
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions includes/Admin/SetupWizard.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,15 @@ class SetupWizard {
*/
private $deferred_actions = [];

/**
* Instance of RecommendedPlugins class for managing plugin recommendations.
*
* @since DOKAN_SINCE
*
* @var RecommendedPlugins Handles the retrieval and management of recommended plugins
*/
private RecommendedPlugins $recommended_plugins;

/**
* Hook in tabs.
*/
Expand All @@ -35,6 +44,8 @@ public function __construct() {
}

if ( current_user_can( 'manage_woocommerce' ) ) {
$this->recommended_plugins = new RecommendedPlugins();

add_action( 'admin_menu', [ $this, 'admin_menus' ] );
add_action( 'admin_init', [ $this, 'setup_wizard' ], 99 );

Expand Down Expand Up @@ -699,9 +710,7 @@ public function dokan_setup_recommended() {
<ul class="recommended-step">
<?php
if ( $this->user_can_install_plugin() ) {
$recommended_plugins = new RecommendedPlugins();

foreach ( $recommended_plugins->get() as $plugin ) {
foreach ( $this->recommended_plugins->get() as $plugin ) {
$this->display_recommended_item( $plugin );
}
}
Expand Down Expand Up @@ -855,6 +864,10 @@ protected function should_show_recommended_step() {
return false;
}

if ( ! count( $this->recommended_plugins->get() ) ) {
return false;
}

return true;
}

Expand Down

0 comments on commit 3ae552a

Please sign in to comment.