Skip to content

Commit

Permalink
Fix an issue that prevented the admin dashboard from opening when woo…
Browse files Browse the repository at this point in the history
…-commerce was not installed or active
  • Loading branch information
michelve committed Dec 19, 2019
1 parent a38a7e5 commit 22a87ea
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ sftp-config_.json
sftp-config.json
sftp-config-alt.json
Icon
package-lock.json
.Icon
1 change: 0 additions & 1 deletion admin/slm-admin-init.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
die;
}


require_once SLM_ADMIN . 'slm-manage-licenses.php';
require_once SLM_ADMIN . 'slm-add-licenses.php';
require_once SLM_ADMIN . 'slm-lic-settings.php';
Expand Down
24 changes: 14 additions & 10 deletions includes/slm-scripts.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,13 @@ function slm_frontend_assets() {
/**
* Check if WooCommerce is activated
*/
if (!function_exists('is_woocommerce_activated') && is_account_page()) {
wp_enqueue_style('bootstrapcdn-slm', 'https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css');
wp_enqueue_script( 'bootstrapcdn-slm-js', 'https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js', array('jquery'), '4.1.3', true );
if (is_plugin_active('woocommerce/woocommerce.php')) {

if(is_account_page()) {
wp_enqueue_style('bootstrapcdn-slm', 'https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css');
wp_enqueue_script('bootstrapcdn-slm-js', 'https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js', array('jquery'), '4.1.3', true);
}

}
// custom css
wp_enqueue_style('softwarelicensemanager', SLM_ASSETS_URL .'css/slm-front-end.css');
Expand All @@ -28,17 +32,17 @@ function slm_frontend_assets() {
add_action('admin_enqueue_scripts', 'slm_admin_assets');



/**
* Check if WooCommerce is activated
*/
if (!function_exists('is_woocommerce_activated')) {
if (is_plugin_active('woocommerce/woocommerce.php')) {
add_action('template_redirect', 'slm_get_page');
}

function slm_get_page(){
if (is_page('my-account')) {
add_action('wp_enqueue_scripts', 'slm_js_license');
function slm_get_page()
{
if (is_page('my-account')) {
add_action('wp_enqueue_scripts', 'slm_js_license');
}
}
}


0 comments on commit 22a87ea

Please sign in to comment.