current Version of CF7 doesn't work with Wordpress 4.8 at all. So we had to downgrade CF7 to 4.7. After hours of debugging i discovered that you totaly break support for Versions < 4.8 of CF7.
Why didn't you do a simple request for the CF7 Version and decide then if $tag should be an object or an array. Like this:
function listing_agent_shortcode( $tag ) {
$cf7 = get_plugin_data( get_home_path()."/wp-content/plugins/contact-form-7/wp-contact-form-7.php", $markup = false, $translate = false );
if ($cf7['Version'] <= 4.7) {
if ( ! is_array( $tag ) || empty( $tag['name'] ) )
return;
return '<input type="hidden" name="' . esc_attr( $tag['name'] ) . '" value="' . esc_attr( antispambot( get_the_author_meta( 'email' ) ) ) . '" />';
} else{
if ( ! is_object( $tag ) || empty( $tag->name ) )
return;
return '<input type="hidden" name="' . esc_attr( $tag->name ) .'" value="' . esc_attr( esc_url( get_permalink() ) ) . '" />';
}
}