• Resolved Alex Culshaw

    (@alexculshaw)


    Hi all,

    Wondering if anyone can help me. I’m using a function to dynamically get all of the posts within a custom post type into a Select field in CF7.

    Since upgrading to CF7 3.7 the above error presents itself. If I roll back to 3.6 the problem disappears! Here’s my code:

    function my_add_game_list_to_contact_form ( $tag, $unused ) {  
    
    	if ( $tag['name'] != 'game-list' )
    		return $tag;  
    
    	$args = array ( 'post_type' => 'game',
    					'numberposts' => -1,
    					'orderby' => 'title',
    					'order' => 'ASC',
    					'post_status' => 'publish' );
    	$game_list = get_posts($args);  
    
    	if ( ! $game_list )
    		return $tag;  
    
    	foreach ( $game_list as $single_game ) {
    		$tag['raw_values'][] = $single_game->post_title;
    		$tag['values'][] = $single_game->post_title;
    		$tag['labels'][] = $single_game->post_title;
    		$tag['pipes']->pipes[] = array ( 'before' => $single_game->post_title, 'after' => $single_game->post_title);
    	}  
    
    	return $tag;
    }
    add_filter( 'wpcf7_form_tag', 'my_add_game_list_to_contact_form', 10, 2);

    Is there a fix I can implement to the above code to make it work with 3.7, or is this a bug in 3.7?

    Cheers!

    Alex

    https://wordpress.org/plugins/contact-form-7/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Takayuki Miyoshi

    (@takayukister)

    $tag['pipes']->pipes[] = array ( 'before' => $single_game->post_title, 'after' => $single_game->post_title);

    Remove this line. ‘pipes’ is no longer accessible. Also you don’t need to do so.

    Thread Starter Alex Culshaw

    (@alexculshaw)

    Thanks for the prompt reply Takayuki – that solved it 🙂 . Much appreciated!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘3.7 – Fatal error: Cannot access private property WPCF7_Pipes’ is closed to new replies.