Define default constants


The way some constants are currently declared and used, the only way to change their default values is to comment/uncomment their declaration in affiliateincludes/includes/config.php, which causes an issue when upgrading the plugin to new versions. So please at least allow us to re-declare them in wp-config.php thanks to the following changes:





5 occurrences for the first one and 1 occurrence on line 311 of affiliate.php for the second one.

Even better: include the config file from an action hook rather than directly on loading the plugin so we can re-declare the constants in a plugin or a theme instead of the wp-config.php file.


  • Timothy
    • Chief Pigeon

    Hey asimetrick.

    Is this not working for you in the wp-config?

    You see the code in:


    Is saying if not defined then get it defined. So if they are defined in your wp-config.php that should work just fine.

    You could load em through your theme as well if you wish. wp-config.php will just ensure its always there for the plugin. You would need to do the same within your theme.

    Take care.

  • asimetrick
    • Site Builder, Child of Zeus

    Hi Timothy.

    Sorry but it doesn't work that way.

    First, themes are loaded after plugins. So the code in /affiliateincludes/includes/config.php is executed before and once the constants are defined it's impossible to have theme redefined.

    In another plugin it's almost the same issue, because plugins are loaded in an order you cannot control.

    So yes, it's absolutely possible to define the constants in wp-config.php, and that's precisely what I asked for. The problem is that the code I mentioned only checks if the constants are defined without checking their values. So because they're always defined, setting another value has no effect at all. Not only I analyzed the code but also I first tried it, believe me.

    With this additional explanation, please read my topic another time and you'll get it.


  • aecnu
    • WP Unicorn

    Greetings asimetrick,

    Due to Tim being ill at the moment and we do expect his return next week, I am just touching base to see if you have any resolution with the "define default constants" issue or not.

    In addition, please advise if you have made any headway into getting this issue resolved or have any new information that we could possibly use to possibly get nearer a solution.

    Cheers, Joe

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.