Changeset 6525
- Timestamp:
- 06/12/2017 02:10:58 PM (8 years ago)
- Location:
- trunk/src/includes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/includes/admin/tools/upgrade.php
r6523 r6525 178 178 $tpt = bbp_get_topic_post_type(); 179 179 $rpt = bbp_get_reply_post_type(); 180 $pps = bbp_get_public_status_id(); 181 $cps = bbp_get_closed_status_id(); 182 $sql = $bbp_db->prepare( "INSERT INTO {$bbp_db->postmeta} (post_id, meta_key, meta_value) ( 180 $sql = "INSERT INTO {$bbp_db->postmeta} (post_id, meta_key, meta_value) ( 183 181 SELECT postmeta.meta_value, '_bbp_engagement', posts.post_author 184 182 FROM {$bbp_db->posts} AS posts … … 187 185 AND postmeta.meta_key = '_bbp_topic_id' 188 186 WHERE posts.post_type IN (%s, %s) 189 AND posts.post_status IN (%s, %s) 190 GROUP BY postmeta.meta_value, posts.post_author)", $tpt, $rpt, $pps, $cps ); 187 GROUP BY postmeta.meta_value, posts.post_author)"; 191 188 192 189 // Run the big query 193 $prepare = $bbp_db->prepare( $sql, $tpt, $rpt , $pps, $cps);190 $prepare = $bbp_db->prepare( $sql, $tpt, $rpt ); 194 191 $engagements = $bbp_db->query( $prepare ); 195 192 -
trunk/src/includes/users/engagements.php
r6522 r6525 196 196 $topic_id = bbp_get_topic_id( $topic_id ); 197 197 $bbp_db = bbp_db(); 198 $statii = "'" . implode( "', '", bbp_get_public_topic_statuses() ) . "'";199 198 200 199 // A cool UNION query! … … 202 201 SELECT DISTINCT( post_author ) FROM ( 203 202 SELECT post_author FROM {$bbp_db->posts} 204 WHERE ( ID = %d AND post_ status IN ({$statii}) AND post_type = %s )203 WHERE ( ID = %d AND post_type = %s ) 205 204 UNION 206 205 SELECT post_author FROM {$bbp_db->posts} 207 WHERE ( post_parent = %d AND post_ status = %s AND post_type = %s )206 WHERE ( post_parent = %d AND post_type = %s ) 208 207 ) as u1"; 209 208 210 209 // Prepare & get results 211 $query = $bbp_db->prepare( $sql, $topic_id, bbp_get_topic_post_type(), $topic_id, bbp_get_ public_status_id(), bbp_get_reply_post_type() );210 $query = $bbp_db->prepare( $sql, $topic_id, bbp_get_topic_post_type(), $topic_id, bbp_get_reply_post_type() ); 212 211 $results = $bbp_db->get_col( $query ); 213 212
Note: See TracChangeset
for help on using the changeset viewer.