Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redirect to sample course after importing it #3545

Merged
merged 4 commits into from
Aug 21, 2020
Merged

Conversation

renatho
Copy link
Contributor

@renatho renatho commented Aug 21, 2020

Close #3535

Changes proposed in this Pull Request

@donnapep asked here to redirect the user to the imported course after the sample course installing.

Talking with @jom, as an alternative to #3535, we decided to go with a solution with less code. With that, we're trusting that our sample will always have an ID. (We created a test to ensure)

Testing instructions

  • Go to the Setup Wizard, and navigate until the ready step.
  • Click on Install a sample course.
  • Wait until the installation and make sure you're redirected to the created course page.

@renatho renatho added this to the 3.5.0 milestone Aug 21, 2020
@renatho renatho requested review from jom and donnapep August 21, 2020 16:59
@renatho renatho self-assigned this Aug 21, 2020
@@ -78,6 +79,7 @@ private function __construct() {
*/
public function init() {
add_action( 'init', [ $this, 'maybe_schedule_cron_jobs' ] );
add_action( 'init', [ $this, 'redirect_imported_sample' ], 101 );
Copy link
Member

@jom jom Aug 21, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this redirect work on admin_init or is it too late? If it works, it might be nice to limit the amount this is called.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea! It works!
Updated here: 7932346

@renatho renatho marked this pull request as ready for review August 21, 2020 18:36
@renatho renatho requested a review from jom August 21, 2020 18:36
Copy link
Member

@jom jom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good; works well! Let's temporarily remove branch restrictions to merge.

@renatho renatho merged commit 56d07ce into master Aug 21, 2020
@renatho renatho deleted the change/sample-redirect-2 branch August 21, 2020 19:48
@donnapep donnapep changed the title Change "Install sample course" redirect to the imported course Redirect to sample course after installing Aug 24, 2020
@donnapep donnapep changed the title Redirect to sample course after installing Redirect to sample course after importing it Aug 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants