Skip to content

Instantly share code, notes, and snippets.

@rafaehlers
Created February 6, 2019 20:40
Show Gist options
  • Save rafaehlers/8b15ddb431c9d079ec11f4b5cadfb506 to your computer and use it in GitHub Desktop.
Save rafaehlers/8b15ddb431c9d079ec11f4b5cadfb506 to your computer and use it in GitHub Desktop.
Hot Fix for the Multiple Forms 0.1-beta.2 issue
<?php // MAKE SURE TO REMOVE THIS WHOLE LINE FIRST, BEFORE COPYING THIS CODE TO YOUR THEME's FUNCTIONS.PHP FILE
add_action( 'gravityview/view/query', function( &$query, $view, $request ) {
$q = $query->_introspect();
foreach ( $q['joins'] as $join ) {
// Filter to active entries only
$condition = new \GF_Query_Condition(
new \GF_Query_Column( 'status', $join[0]->source ),
\GF_Query_Condition::EQ,
new \GF_Query_Literal( 'active' )
);
$q = $query->_introspect();
$query->where( \GF_Query_Condition::_and( $q['where'], $condition ) );
}
}, 10, 3 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment