options not updating
-
I have a wordpress network and noticed a LOT of request to the piwik server to get the javascript code.
I checked the database options for some of the sites hosted in the network and none of them had the _piwik_ options set only wp-piwik-last_tracking_code_update
So wp-piwik requested new code over and over again.
I digged a bit into the code and noticed that add_blog_option did not work got into setOption
there the add_blog_option returned false, makes sense since the option already exists, changed that on to update_blog_option
but still no success, seemed that the options where reset some else.
So I moved the $this->settings [$key] = $value; outside the if/else
resulting in
public function setOption($key, $value, $blogID = null) { $this->settingsChanged = true; self::$wpPiwik->log ( 'Changed option ' . $key . ': ' . $value ); if ($this->checkNetworkActivation () && ! empty ( $blogID )) { if ( ! update_blog_option ( $blogID, 'wp-piwik-'.$key, $value ) ) { add_blog_option ( $blogID, 'wp-piwik-'.$key, $value ); } } $this->settings [$key] = $value; }
not sure the function was actual the cause but it solved the problem. The database tables are now populated with piwik options.
- The topic ‘options not updating’ is closed to new replies.