Skip to content

Commit

Permalink
Merge branch 'trunk' into fix/prevent-rendering-lesson-actions-in-con…
Browse files Browse the repository at this point in the history
…tent-drip
  • Loading branch information
Imran92 authored Oct 29, 2024
2 parents 438d8ca + f634821 commit 3bb10f6
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 77 deletions.
74 changes: 0 additions & 74 deletions .github/workflows/code-coverage.yml

This file was deleted.

4 changes: 4 additions & 0 deletions changelog/fix-archive-404-issue-in-hello-elementor
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fixed

Hello elementor theme throwing 404 when rendering the Courses archive page
4 changes: 4 additions & 0 deletions changelog/fix-view-results-block-deprecated-notice
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fixed

Fix PHP deprecation notice in View Results block
3 changes: 2 additions & 1 deletion includes/blocks/class-sensei-block-view-results.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ public function render( $attributes, $content ): string {
}

$results_link = Sensei_Course::get_view_results_link( $course_id );
parse_str( wp_parse_url( $results_link, PHP_URL_QUERY ), $results_link_query_params );

parse_str( (string) wp_parse_url( $results_link, PHP_URL_QUERY ), $results_link_query_params );

$form_inputs = '';
foreach ( $results_link_query_params as $name => $value ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ protected function output_content_as_page( $content, $object_to_copy = null, $po
$wp_query->posts = array( $post );
// On taxonomy pages the queried_object must remain a WP_Term object.
if ( ! is_tax() ) {
$wp_query->queried_object = $post;
$wp_query->queried_object_id = $post->ID;
$wp_query->queried_object = $post;
}

$wp_the_query = $wp_query;
// phpcs:enable WordPress.WP.GlobalVariablesOverride.Prohibited

Expand All @@ -98,6 +98,7 @@ protected function output_content_as_page( $content, $object_to_copy = null, $po
$wp_query->is_404 = false;
$wp_query->is_page = true;
$wp_query->is_single = true;
$wp_query->is_singular = true;
$wp_query->is_archive = false;
$wp_query->max_num_pages = 0;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,18 @@ public function testCourseArchivePage_WhenRendered_RendersQueryListBlockIfPageCo
$this->assertStringContainsString( 'wp-block-sensei-lms-course-list', $post->post_content );
}

public function testHandleRequest_WhenCalled_SetsGlobalWpQueryWithCorrectIsSingularAndQueryObjectId() {
/* ARRANGE */
Sensei_Setup_Wizard::instance()->pages->create_pages();

/* ACT */
$this->handler->handle_request();

/* ASSERT */
$this->assertTrue( is_singular() );
$this->assertEquals( 0, get_queried_object_id() );
}

/**
* Helper to set up the current request to be a course archive page. This request
* will be handled by the unsupported theme handler if the theme is not
Expand Down

0 comments on commit 3bb10f6

Please sign in to comment.