function test_adjust_affiliate_visit_count()
 {
     $this->assertEquals(1, affwp_increase_affiliate_visit_count($this->_affiliate_id));
     $this->assertEquals(2, affwp_increase_affiliate_visit_count($this->_affiliate_id));
     $this->assertEquals(1, affwp_decrease_affiliate_visit_count($this->_affiliate_id));
     $this->assertFalse(affwp_decrease_affiliate_visit_count($this->_affiliate_id2));
 }
 public function add($data = array())
 {
     if (!empty($data['url'])) {
         // Remove the referral var
         $data['url'] = remove_query_arg(affiliate_wp()->tracking->get_referral_var(), $data['url']);
     }
     $visit_id = $this->insert($data, 'visit');
     affwp_increase_affiliate_visit_count($data['affiliate_id']);
     return $visit_id;
 }
Example #3
0
 public function add($data = array())
 {
     if (!empty($data['url'])) {
         $data['url'] = affwp_sanitize_visit_url($data['url']);
     }
     if (!empty($data['campaign'])) {
         // Make sure campaign is not longer than 50 characters
         $data['campaign'] = substr($data['campaign'], 0, 50);
     }
     $visit_id = $this->insert($data, 'visit');
     affwp_increase_affiliate_visit_count($data['affiliate_id']);
     return $visit_id;
 }