• Resolved Earthman Media

    (@earthman100)


    Hello, great plugin.

    We are using on a Kinsta hosted site, and the problem we run into that when migrating plugin updates from one environment to another, using the built in tools, the Database settings which are hardcoded from the environment into the ajax-handler.php file for the advanced-ads-tracking addon are not accurate anymore.

    The Kinsta server provides DB constants which work regardless of environment, but everytime the plugin is updated, these get overwritten:

    $mysqli = @mysqli_connect( SERVER_SECRET_DB_HOST, SERVER_SECRET_DB_USER, SERVER_SECRET_DB_PASSWORD, SERVER_SECRET_DB_NAME, ‘0’, ” );

    I wonder if you would please add a filter hook to your function in wp-content/plugins/advanced-ads-tracking/classes/installer.php so that these can be modified without having to adjust your code?

    private function gather_variables() {

    // ... existing code ...

    // Apply filter to allow modification of variables

    $vars = apply_filters( 'advanced_ads_tracking_gather_variables', $vars );

    return $vars;

    }

    With that hook in place, we could then create a simple mu module to integrate our DB settings that would then work on any site environment – EG:

    <?php
    /**
    * Plugin Name: Advanced Ads Tracking Constants
    * Description: Replaces Advanced Ads Tracking variables with constants
    * Version: 1.0.0
    * Author: Earthman Media
    */

    add_filter( 'advanced_ads_tracking_gather_variables', 'replace_advanced_ads_tracking_variables' );

    function replace_advanced_ads_tracking_variables( $vars ) {
    // Replace database connection variables with constants
    if ( defined( 'SERVER_SECRET_DB_HOST' ) ) {
    $vars['db_host'] = SERVER_SECRET_DB_HOST;
    }
    if ( defined( 'SERVER_SECRET_DB_USER' ) ) {
    $vars['db_user'] = SERVER_SECRET_DB_USER;
    }
    if ( defined( 'SERVER_SECRET_DB_PASSWORD' ) ) {
    $vars['db_password'] = SERVER_SECRET_DB_PASSWORD;
    }
    if ( defined( 'SERVER_SECRET_DB_NAME' ) ) {
    $vars['db_name'] = SERVER_SECRET_DB_NAME;
    }

    // You can add more replacements here if needed

    return $vars;
    }

    My client would be most appreciative, as this would keep the ads tracking plugin from ‘breaking’ every time we update.

    Regardless of hosting, this change would benefit any user who is managing multiple versions of their site where updates are pushed via git or other processes, rather than managing updates on each environment, separately.

    I eagerly await your response to this pressing matter.

Viewing 1 replies (of 1 total)
  • Plugin Support schmidt25

    (@schmidt25)

    Hi @earthman100

    Thanks for reaching out.

    It looks like this question is referring to the Tracking add-on. The forums on www.remarpro.com are only for the plugins that are also hosted here. If you need help with any premium extensions of Advanced Ads, I want kindly ask you to reach out to our support.

    Thanks for understanding, and we hopefully meet us there.

    Best regards,

    Joachim

Viewing 1 replies (of 1 total)
  • The topic ‘Request for DB settings hook in installer’ is closed to new replies.