Assets are not loaded under a specific condition
johnalarcon opened this issue · 2 comments
Description
The scripts and styles are not loaded if the user is unauthenticated while using the Shield Security plugin's "Master Password" feature. This is an edge-case scenario.
Steps to Reproduce
- Visit
Tools > PHP Error Log Viewer
while unauthenticated under Shield's master password functionality. - Scripts and styles are not loaded.
Expected Behavior
- Scripts and styles are loaded any time the error log is being viewed.
Additional Context
I reported this issue to Paul and he was quick to take a look, indicating this was expected behavior. The issue (from this side) is that the slug for the error log plugin's menu item is:
tools.php?page=codepotent-php-error-log-viewer
...however, when the user is unauthenticated (in Shield,) the slug is changed to:
import.php?page=codepotent-php-error-log-viewer
...thus breaking the code that enqueues the error logs scripts and styles. A possible solution (credit to Paul) was to enqueue the assets slightly differently, such that the root slug doesn't make a difference.
if ( strpos( get_current_screen()->base, PLUGIN_SLUG ) !== false ) {
wp_enqueue_style( PLUGIN_SLUG.'-admin', URL_STYLES.'/admin-global.css' );
}
With some minor tweaks to the above suggestion, I'm cool with the solution and will implement it.
Completed and slated for v 1.4.0
Fixed and to be released in version 2.0.0.