WordPress.org

Ready to get started?Download WordPress

Forums

Google Analytics Dashboard
[resolved] Custom wp-content support (10 posts)

  1. geminorum
    Member
    Posted 3 years ago #

    The plugin does not support custom wp-content as :
    http://codex.wordpress.org/Editing_wp-config.php#Moving_wp-content
    so cannot include gad_main.js.php on my install of wp.

    suggesting :
    define( 'GAD_DIR', plugin_dir_path( __FILE__ ) );
    define( 'GAD_URL', plugin_dir_url( __FILE__ ) );
    on main plugin file.
    thx btw.

    http://wordpress.org/extend/plugins/google-analytics-dashboard/

  2. Carson McDonald
    Member
    Plugin Contributor

    Posted 3 years ago #

    I have made another update that I think should address this by using the built in way of finding the admin URL. If you would try the 2.0.2 version and let me know if it works.

  3. geminorum
    Member
    Posted 3 years ago #

    the gad_main.js.php includes correctly on 2.0.2, but I get fatal in the gad_main.js.php for including wp-config.php

  4. Carson McDonald
    Member
    Plugin Contributor

    Posted 3 years ago #

    Can you give me an idea of where wp-config.php is in relationship to the plugin directory? I'll need to see how best to do that. Curse the WP examples for not doing it in a way that works for everyone, I didn't know people moved the content dir.

  5. geminorum
    Member
    Posted 3 years ago #

    if ( file_exists( ABSPATH . 'wp-config.php') ) {
    	/** The config file resides in ABSPATH */
    	require_once( ABSPATH . 'wp-config.php' );
    } elseif ( file_exists( dirname(ABSPATH) . '/wp-config.php' ) && ! file_exists( dirname(ABSPATH) . '/wp-settings.php' ) ) {
    	/** The config file resides one level above ABSPATH but is not part of another install*/
    	require_once( dirname(ABSPATH) . '/wp-config.php' );
    }

    form wp-load.php

    p.s. I don't think that's working for the AJAX! I'll see other plugins.

  6. geminorum
    Member
    Posted 3 years ago #

    I think the better approach is to get gad_get_admin_url('/admin-ajax.php'); via a JS var into the code by printing on the <head>, link gad_main.js.php content as regular script and then call the function with the var.

  7. geminorum
    Member
    Posted 3 years ago #

    And besides, by using .js.php method, the plugin waste resources by making unnecessary calls.

  8. Carson McDonald
    Member
    Plugin Contributor

    Posted 3 years ago #

    After your suggestion I dug a little more and there is an ajaxurl javascript variable that seems to be the key. I have updated the plugin again to incorporate that and get rid of the need for the php generation. I hope that will fix a number of odd issues people have been seeing. Can you see if this also resolves the issue of having wp-content in a different location? I have about 9 different WP installs now and this is a setup I still didn't have time to try.

  9. geminorum
    Member
    Posted 3 years ago #

    2.0.3 works like a charm.
    thank you for the support.

  10. Carson McDonald
    Member
    Plugin Contributor

    Posted 3 years ago #

    No problem.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic