• I was looking through the code and noticed that there’s some unreachable code in your plugin.

    There’s a redirect on line 6 & and exit statement on line 7.

    There are 17 lines of code after this that are unreachable.

    public function impact_activate( $plugin ) {
    $arr = explode( '/', $plugin );
    if ( count( $arr ) >= 1 && strpos( $arr[ count( $arr ) - 1 ], 'impact' ) !== false ) {
    $store_url = home_url();
    $path = '/wp-admin/admin.php?page=impact-settings';
    $url = $store_url . $path;
    wp_safe_redirect( $url );
    exit;
    global $user;
    global $wpdb;

    $store_url = home_url();
    $user = wp_get_current_user();
    $endpoint = '/wc-auth/v1/authorize';
    $params = array(
    'app_name' => 'Impact',
    'scope' => 'read_write',
    'user_id' => $user->user_login,
    'return_url' => home_url() . '/wp-admin/admin.php?page=impact-settings',
    'callback_url' => home_url() . '/wp-json/impact/v1/callback',
    );
    $query_string = http_build_query( $params );
    $url = $store_url . $endpoint . '?' . $query_string;
    wp_safe_redirect( $url );
    exit;
    }
    }

    I’d suggest deleting these lines to clean up the code base.

  • You must be logged in to reply to this topic.