ech3
Forum Replies Created
Viewing 1 replies (of 1 total)
-
Forum: Plugins
In reply to: [SQLite Integration] SQLite: unexpected T_FUNCTIONI ended up having to add a dollar sign before the orderby_callback function’s flipped variable in a couple of places to get it to work. Below is the diff I used.
[Edit – Reversed the diff to the correct direction]
--- query.class.php.orig 2014-09-12 06:21:17.802511000 -0400 +++ query.class.php 2014-09-12 06:11:27.503756000 -0400 @@ -766,15 +766,20 @@ $_wpdb = new PDODB(); $results = $_wpdb->get_results($query); $_wpdb = null; - $compare = function($a, $b) { - global $flipped; - return $flipped[$a->ID] - $flipped[$b->ID]; - }; - usort($results, $compare); + //$compare = function($a, $b) { + //global $flipped; + //return $flipped[$a->ID] - $flipped[$b->ID]; + //}; + //usort($results, $compare); + usort($results, array($this, 'orderby_callback')); } $wpdb->dbh->pre_ordered_results = $results; } } + private function orderby_callback($a, $b) { + global $flipped; + return $flipped[$a->ID] - $flipped[$b->ID]; + } /** * Method to avoid DELETE with JOIN statement. *
Viewing 1 replies (of 1 total)