WordPress.org

Ready to get started?Download WordPress

Forums

wordpress and openX (5 posts)

  1. matthieugd
    Member
    Posted 5 years ago #

    Hello,

    I setup WordPress and OpenX on the same server but with different databases (named WPDB and OPENXDB).

    In my template I got his

    functionX_plugin1WP()
    
    //<!--/* OpenX Local Mode Tag v2.6.0 */-->
    
      // The MAX_PATH below should point to the base of your OpenX installation
      define('MAX_PATH', '/home/xxx/yyyy');
      if (@include_once(MAX_PATH . '/www/delivery/alocal.php')) {
        if (!isset($phpAds_context)) {
          $phpAds_context = array();
        }
        // function view_local($what, $zoneid=0, $campaignid=0, $bannerid=0, $target='', $source='', $withtext='', $context='', $charset='')
        $phpAds_raw = view_local('', 1, 0, 0, '_blank', '', '0', $phpAds_context, '');
      }
      echo $phpAds_raw['html'];
    
    functionX_pluginWP2()
    functionX_plugin3WP()

    On the last 2 functions called I got in the error_log file several error messages like "database error table doesn't exist" with reference like OPENXDB.wp_terms etc ...

    I think it's because the OpenX code switch the current database and the two last functions got the wrong db "link" ? But the users see no errors on the page and the functions seems to render proper content.

    I've changed in the wp-db.php script the init loop of the table names from

    foreach ( $this->tables as $table )
    			$this->$table = $this->prefix . $table;

    to

    foreach ( $this->tables as $table )
    			$this->$table = 'WPDB .'.$this->prefix . $table;

    And now the errors never got in the log file. I knwo it's not a perfect solution because I modified the WP code but I don't see any workaround (or I can use the client mode to deliver ads with JS but it 's not what I want).

  2. The_Tim
    Member
    Posted 5 years ago #

    I have experienced this same problem, although in my case it was completely screwing up the display of my site whenever I would insert an OpenX local-mode code into the left sidebar.

    The above change to wp-db.php did the trick, but I will of course be looking for a better long-term solution. Perhaps that change can be made into a little plugin?

  3. pixelgeek
    Member
    Posted 4 years ago #

    I had the same error and it even occurs with the old phpAdsNew code base so its not unique to OpenX.

    Used your fix. Not sure who to report the bug to though. Seems to be a problem with OpenX though

  4. pixelgeek
    Member
    Posted 4 years ago #

  5. The_Tim
    Member
    Posted 4 years ago #

    Thanks for that link, pixelgeek. The old fix stopped working for me after the 2.8 update (it broke posting and other things) but the fix you linked looks like a better solution.

Topic Closed

This topic has been closed to new replies.

About this Topic