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

Refactor to load most of plugin after `plugins_loaded` #175

Merged
merged 5 commits into from Mar 19, 2019

Conversation

Projects
None yet
3 participants
@jom
Copy link
Contributor

commented Mar 18, 2019

This is a large refactor to make it possible to load most of the plugin on plugins_loaded action hook without breaking activation steps. To do this, it moves most functions out of the main plugin file into the main class and into a new sensei-certificates-functions.php file.

Built file:
sensei-certificates.zip

Testing Instructions

With how widespread this PR is, it will require full testing of the plugin. To test the changes in the PR:

  • In fresh instance, activate just this plugin (in this branch) without Sensei.
  • Activate Sensei and refresh page (see known issues).
  • Make sure certificate template is created.

In another fresh instance:

  • Activate Sensei. Create courses and lessons. Have multiple users finish those courses.
  • Activate this branch of this plugin.
  • Make sure certificate template is created and certificates are added to those who completed the course.

Known Issues

  • Without this PR (Automattic/sensei#2490), data updates won't be listed.
  • Certificates menu will only load on page load after Sensei or the plugin is activated.

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

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

@jom jom changed the title [WIP] Refactor to load most of plugin after `plugins_loaded` Refactor to load most of plugin after `plugins_loaded` Mar 18, 2019

@jom jom force-pushed the change/deps-check-on-load branch from e5ed24d to 450c5a7 Mar 19, 2019

$sensei_certificate_templates_installed = get_option( 'sensei_certificate_templates_installer', false );
$user_data_installed = false;
$template_installed = false;
define( 'SENSEI_CERTIFICATES_VERSION', '2.0.0' );

This comment has been minimized.

Copy link
@jom

jom Mar 19, 2019

Author Contributor

This should be 1.1.1 for the purpose of this PR, but we can change it when we release beta.

@alexsanford
Copy link
Contributor

left a comment

This looks good to me. I tested it, and it seemed to set up the data on activation as expected 👍

Show resolved Hide resolved classes/class-woothemes-sensei-certificates.php Outdated
Show resolved Hide resolved classes/class-woothemes-sensei-certificates.php Outdated

@jom jom merged commit 6c521a3 into master Mar 19, 2019

@jom jom deleted the change/deps-check-on-load 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.