function set_enp_button_allow_data_tracking($value) { if (empty($value)) { // return notification to pleeeease turn this value on add_settings_error('enp-nag-for-data', 'enp-nag', 'Please turn on "Allow data collection" so that we can continue to provide high-quality, open-source plugins. We will only use your Engaging Button data anonymously for research with the Engaging News Project.', 'error'); } elseif ($value === '1') { // check to see if it already was on 1 $old_allow_data_tracking_value = get_option('enp_button_allow_data_tracking'); // if it doesn't equal 1, then we should send it over if ($old_allow_data_tracking_value != 1) { // send all current data since they just turned it on $send_data = new Enp_Send_Data(); $send_data->send_all_engaging_data(); } } return $value; }