• Resolved sanselmi

    (@sanselmi)


    I think it is a bug in acf-cf7-v5.php when it checks inside $forms if $field[value] is not an array, but search with in_array() function.
    It give me a lot of Warnings when I debug WordPress.
    I point the code bellow.
    Is it?

    // Display all contact form 7 forms
    $forms = get_posts(array('post_type' => 'wpcf7_contact_form', 'orderby' => 'id', 'order' => 'ASC', 'posts_per_page' => -1, 'numberposts' => -1));       
    if($forms){  			
    	foreach($forms as $k => $form){
    	$key = $form->ID;
    	$value = $form->post_title; 
    	$selected = '';
    // Mark form as selected as required
    	if(is_array($field['value'])){
    	// If the value is an array (multiple select), loop through values and check if it is selected
    		if(in_array($key, $field['value'])){
    		    $selected = 'selected="selected"';
    		          	}
    	//Disable form selection as required
    		if(in_array(($k+1), $field['disable'])){
    		     $selected = 'disabled="disabled"';
    		          	}
    		 }else{
    	// If not a multiple select, just check normaly
    		 if($key == $field['value']){
    		     $selected = 'selected="selected"';
    		
                     //THE BUG?			  }
    	         if(in_array(($k+1), $field['disable'])){
    		     $selected = 'disabled="disabled"';</strong>
    		          	}
    		      	}
    	echo '<option value="'.$key.'" '.$selected.'>'.$value.'</option>';
    		    } 
    		}
    • This topic was modified 5 years, 1 month ago by sanselmi. Reason: Indent the code format
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Bug in acf-cf7-v5.php’ is closed to new replies.