• Resolved daanburozero

    (@daanburozero)


    Hi there,

    I’m using FormCraft for quite some time now, and all of a sudden my script for forwarding data to a third party by using a post script isn’t working anymore. It seems that the action I added in function.php doesn’t execute the function anymore.

    Here is my code:

    function your_function($content, $meta, $raw_content, $integrations)
    {
    
    	if($content['Form ID']==15){
    		$cOpm='';
    		$cVNaam='';
    		$cANaam='';
    		$cAdres='';
    		$cPostcode='';
    		$cWoonplaats='';
    		$cTelefoon='';
    		$cEmail='';
    		$cGebdat='';
    		$lGeslacht='';
    		$cBeschikbaarPer='';
    		$nWeekUrenMin='';
    		$nWeekUrenMax='';
    		$cSalarisWens='';
    		$cFunctieWens='';
    		$aVervoer=''; 
    		$aRijbewijs='';
    		$uploaded_file='';
    
    		
    
    		
    		$message='Form ID'.$content['Form ID']."\r\n";
    		foreach($raw_content as $item){
    			switch($item['identifier']){
    				case "field24":
    					$cVNaam=$item['value'];
    				break;
    				case "field25":
    					$cANaam=$item['value'];
    				break;
    				case "field26":
    				case "field27":
    					$cAdres.=($cAdres==''?'':' ').$item['value'];
    				break;
    				case "field28":
    					$cPostcode=$item['value'];
    				break;
    				case "field29":
    					$cWoonplaats=$item['value'];
    				break;
    				case "field30":
    					$cTelefoon=$item['value'];
    				break;
    				case "field31":
    					$cEmail=$item['value'];
    				break;
    				case "field32":
    					$cGebdat=$item['value'];
    				break;
    				case "field23":
    					$lGeslacht=$item['value'];
    				break;
    				
    				case "field16":
    				case "field20":
    					$cOpm.=($cOpm==''?'':' - ').$item['value'];
    				break;
    				
    				case "field6":
    					$cBeschikbaarPer=$item['value'];
    				break;
    				case "field39":
    					$nWeekUrenMin=$item['value'];
    				break;
    				case "field40":
    					$nWeekUrenMax=$item['value'];
    				break;
    				case "field41":
    					$cSalarisWens=$item['value'];
    				break;
    				case "field3":
    				case "field4":
    					$cFunctieWens.=($cFunctieWens==''?'':' ').$item['value'];
    				break;
    				
    				case "field37":
    					$aVervoer=$item['value'];
    				break;
    				case "field12":
    					$aRijbewijs=$item['value'];
    				break;
    				
    				
    				case "field17":
    					$file_path = $_SERVER['DOCUMENT_ROOT'].str_replace('#######','',$item['url'][0]);
    					$uploaded_file = '@' . realpath($file_path);
    				break;
    			}
    			
    			
    			
    			if($item['identifier']=='field17'){
    				$message.=$item['identifier'].' - '.$item['label']."= "."\r\n";
    			}else{
    				$message.=$item['identifier'].' - '.$item['label']."= ".$item['value']."\r\n";
    			}
    		}
    		
    		
    		$ar_post = array(
    			'JOBINQUIRE_ID'=>0,
    			'url_back'=>'http://google.nl',
    			'url_error'=>'http://google.nl',
    			'cTussen'=>'',
    			'cLand'=>'',
    			'cTel06'=>'',
    			'cCustname'=>'A12',
    			'cKey'=>'#############',
    			'mail_from'=>'#############',
    			'mail_body'=>'Bedankt voor de inschrijving.',
    			'cOpm'=>$cOpm,
    			'cVNaam'=>$cVNaam,
    			'cANaam'=>$cANaam,
    			'cAdres'=>$cAdres,
    			'cPostcode'=>$cPostcode,
    			'cWoonplaats'=>$cWoonplaats,
    			'cTelefoon'=>$cTelefoon,
    			'cEmail'=>$cEmail,
    			'cGebdat'=>$cGebdat,
    			'lGeslacht'=>$lGeslacht,
    			'cBeschikbaarPer'=>$cBeschikbaarPer,
    			'nWeekUrenMin'=>$nWeekUrenMin,
    			'nWeekUrenMax'=>$nWeekUrenMax,
    			'cSalarisWens'=>$cSalarisWens,
    			'cFunctieWens'=>$cFunctieWens,
    			'aVervoer[]'=>$aVervoer,
    			'aRijbewijs[]'=>$aRijbewijs,
    			
    			
    		);
    		
    		$message.="\r\n".implode("\r\n",$ar_post);
    		
    		$ar_post['uploaded_file']=$uploaded_file;
    
    		
    		ob_start();
    		$a = sendUbPlus($ar_post);
    		ob_end_clean();
    
    	}
    	
    
    	
    }
    
    add_action('formcraft_before_save', 'your_function', 10, 4);
    

    Could anyone help me out?

    Thanks in advance

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.