fix(main file): call the constant correctly.
Closed this issue · 2 comments
Benunc commented
Issue overview
The GIVE_GOOGLE_ANALYTICS_DIR
constant is wrong, resulting in calls to /wp-content/plugins/assets/img/ga-logo-small.png
on the plugin settings page instead of /wp-content/plugins/give-google-analytics-ecommerce-tracking/assets/img/ga-logo-small.png
There are other ramifications for that not being called correctly, like scripts not loading.
Potential fix
Using recurring donations as a model, changing this on the main plugin file works:
Old
// Min. Give version.
if ( ! defined( 'GIVE_GOOGLE_ANALYTICS_MIN_GIVE_VERSION' ) ) {
define( 'GIVE_GOOGLE_ANALYTICS_MIN_GIVE_VERSION', '1.8.12' );
}
// Plugin path.
if ( ! defined( 'GIVE_GOOGLE_ANALYTICS_DIR' ) ) {
define( 'GIVE_GOOGLE_ANALYTICS_DIR', plugin_dir_path( __FILE__ ) );
}
// Plugin URL.
if ( ! defined( 'GIVE_GOOGLE_ANALYTICS_URL' ) ) {
define( 'GIVE_GOOGLE_ANALYTICS_URL', plugin_dir_url( GIVE_GOOGLE_ANALYTICS_DIR ) );
}
// Basename.
if ( ! defined( 'GIVE_GOOGLE_ANALYTICS_BASENAME' ) ) {
define( 'GIVE_GOOGLE_ANALYTICS_BASENAME', plugin_basename( GIVE_GOOGLE_ANALYTICS_DIR ) );
}
New
// Min. Give version.
if ( ! defined( 'GIVE_GOOGLE_ANALYTICS_MIN_GIVE_VERSION' ) ) {
define( 'GIVE_GOOGLE_ANALYTICS_MIN_GIVE_VERSION', '1.8.12' );
}
// Plugin File.
if ( ! defined( 'GIVE_GOOGLE_ANALYTICS_PLUGIN_FILE' ) ) {
define( 'GIVE_GOOGLE_ANALYTICS_PLUGIN_FILE', __FILE__ );
}
// Plugin path.
if ( ! defined( 'GIVE_GOOGLE_ANALYTICS_DIR' ) ) {
define( 'GIVE_GOOGLE_ANALYTICS_DIR', plugin_dir_path( GIVE_GOOGLE_ANALYTICS_PLUGIN_FILE ) );
}
// Plugin URL.
if ( ! defined( 'GIVE_GOOGLE_ANALYTICS_URL' ) ) {
define( 'GIVE_GOOGLE_ANALYTICS_URL', plugin_dir_url( GIVE_GOOGLE_ANALYTICS_PLUGIN_FILE ) );
}
// Basename.
if ( ! defined( 'GIVE_GOOGLE_ANALYTICS_BASENAME' ) ) {
define( 'GIVE_GOOGLE_ANALYTICS_BASENAME', plugin_basename( GIVE_GOOGLE_ANALYTICS_DIR ) );
}
PR incoming, if that fixes it.
Steps to replicate:
- Install and activate this plugin.
- Navigate to the settings at Donations > Settings > General (tab) > Google Analytics
- The image at the top of the page will not be showing.
- Inspect that image to see that is pointing to the wrong directory.
Benunc commented
Is this one going in a release soon? we have a ticket for it now asking.
DevinWalker commented
@Benunc yeah I just want to research how I can get the source back in to GA when a donation is made. I'll release today if I can't figure it out quickly.