Created
February 6, 2019 20:40
-
-
Save rafaehlers/8b15ddb431c9d079ec11f4b5cadfb506 to your computer and use it in GitHub Desktop.
Hot Fix for the Multiple Forms 0.1-beta.2 issue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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