/**
  * Processes email confirmation when double opt-in is set.
  * @param string $confirm_code
  */
 static function process_optin($confirm_code)
 {
     if (empty($confirm_code)) {
         return false;
     }
     $participant = new cf_Participant($confirm_code, true);
     // get participant based on the confirmation code
     if (!$participant->_valid) {
         return false;
     }
     if ($participant->status != 'not_confirmed') {
         // check participant status, has not be not_confirmed or there is nothing to confirm
         return false;
     }
     $contest = new cf_Contest($participant->contest_id);
     // check if the contest participant is in, is valid
     if (!$contest->_valid) {
         return false;
     }
     if (isset($participant->tmp_referral)) {
         // get referring participant and credit him the referral
         $referral = new cf_Participant($participant->tmp_referral, true);
         if ($referral->_valid) {
             $referral->add_meta('referral_to', $participant->id);
         }
         $participant->del_meta('tmp_referral');
     }
     $participant->set_status('');
     // change the participant status
     // process stuff
     self::process_email($contest, $participant);
     self::process_integration($contest, $participant);
     self::process_cookie($contest, $participant);
 }