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

Fix permalink/rewrite rule issue on activation #2492

Merged
merged 1 commit into from Mar 19, 2019

Conversation

Projects
None yet
3 participants
@jom
Copy link
Member

commented Mar 19, 2019

If courses already existed in database and then we reactivate Sensei, we would need to go into Permalink settings (or save a course) before the rewrite rules would flush with the registered post type. This should fix that issue.

Testing Instructions

  • Activate Sensei. Create a course. View that course (frontend) in another tab.
  • Deactivate Sensei.
  • Activate Sensei again. Refresh the frontend course and make sure it is still accessible.

@jom jom added this to the 2.0.0 milestone Mar 19, 2019

@jom jom requested review from alexsanford and donnapep Mar 19, 2019

@jom jom changed the base branch from master to release/2.0 Mar 19, 2019

@lkraav

This comment has been minimized.

Copy link
Contributor

commented Mar 19, 2019

I just read https://wordpress.stackexchange.com/questions/123401/where-when-how-to-properly-flush-rewrite-rules-within-the-scope-of-a-plugin but can you remind me, why in Sensei's case flushing rules directly on activation hook won't work? Do we have dynamic post types of some sort, registered only after activation hook triggers, or...?

@jom

This comment has been minimized.

Copy link
Member Author

commented Mar 19, 2019

@lkraav I imagine it is because we register our post types on init, which has already been fired when the activation hook runs here so our post types wouldn't be registered if we flush directly. We also add our own rewrite tag/rule on init on includes/class-sensei-course-results.php.

We could set up an activation method that calls those post type registration methods and rewrite rule setup, but thought I'd use this functionality that Sensei already has.

@alexsanford
Copy link
Contributor

left a comment

Works for me!

@jom jom merged commit 7d6aac6 into release/2.0 Mar 19, 2019

1 check failed

continuous-integration/travis-ci/pr The Travis CI build failed
Details

@jom jom deleted the fix/rewrite-rules-on-activation branch Mar 19, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.