# This patch file was generated by NetBeans IDE
# Following Index: paths are relative to: \\UBU\www\sandbox\public_html\wp-content\plugins\buddypress\bp-activity
# This patch can be applied using context Tools: Patch action on respective folder.
# It uses platform neutral UTF-8 encoding and \n newlines.
# Above lines and this line are ignored by the patching process.
|
|
|
|
| 156 | 156 | if ( $filter ) |
| 157 | 157 | $filter_sql = BP_Activity_Activity::get_filter_sql( $filter ); |
| 158 | 158 | |
| | 159 | /* Skip disabled components */ |
| | 160 | $disabled_components_sql = BP_Activity_Activity::get_disabled_components_sql(); |
| | 161 | |
| 159 | 162 | if ( $limit && $page && $max_items ) |
| 160 | | $activities = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$bp->activity->table_name} WHERE user_id = %d $filter_sql ORDER BY date_recorded DESC $pag_sql", $user_id ) ); |
| | 163 | $activities = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$bp->activity->table_name} WHERE user_id = %d $filter_sql $disabled_components_sql ORDER BY date_recorded DESC $pag_sql", $user_id ) ); |
| 161 | 164 | else |
| 162 | | $activities = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$bp->activity->table_name} WHERE user_id = %d $filter_sql ORDER BY date_recorded DESC $pag_sql $max_sql", $user_id ) ); |
| | 165 | $activities = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$bp->activity->table_name} WHERE user_id = %d $filter_sql $disabled_components_sql ORDER BY date_recorded DESC $pag_sql $max_sql", $user_id ) ); |
| 163 | 166 | |
| 164 | | $total_activities = $wpdb->get_var( $wpdb->prepare( "SELECT count(id) FROM {$bp->activity->table_name} WHERE user_id = %d $filter_sql ORDER BY date_recorded DESC $max_sql", $user_id ) ); |
| | 167 | $total_activities = $wpdb->get_var( $wpdb->prepare( "SELECT count(id) FROM {$bp->activity->table_name} WHERE user_id = %d $filter_sql $disabled_components_sql ORDER BY date_recorded DESC $max_sql", $user_id ) ); |
| 165 | 168 | |
| 166 | 169 | return array( 'activities' => $activities, 'total' => (int)$total_activities ); |
| 167 | 170 | } |
| … |
… |
|
| 184 | 187 | if ( $filter ) |
| 185 | 188 | $filter_sql = BP_Activity_Activity::get_filter_sql( $filter ); |
| 186 | 189 | |
| | 190 | /* Skip disabled components */ |
| | 191 | $disabled_components_sql = BP_Activity_Activity::get_disabled_components_sql(); |
| | 192 | |
| 187 | 193 | $friend_ids = friends_get_friend_user_ids( $user_id ); |
| 188 | 194 | |
| 189 | 195 | if ( !$friend_ids ) |
| … |
… |
|
| 192 | 198 | $friend_ids = implode( ',', $friend_ids ); |
| 193 | 199 | |
| 194 | 200 | if ( $limit && $page && $max_items ) |
| 195 | | $activities = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT id, user_id, content, primary_link, date_recorded, component_name, component_action FROM {$bp->activity->table_name} WHERE user_id IN ({$friend_ids}) $filter_sql ORDER BY date_recorded DESC $pag_sql" ) ); |
| | 201 | $activities = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT id, user_id, content, primary_link, date_recorded, component_name, component_action FROM {$bp->activity->table_name} WHERE user_id IN ({$friend_ids}) $filter_sql $disabled_components_sql ORDER BY date_recorded DESC $pag_sql" ) ); |
| 196 | 202 | else |
| 197 | | $activities = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT id, user_id, content, primary_link, date_recorded, component_name, component_action FROM {$bp->activity->table_name} WHERE user_id IN ({$friend_ids}) $filter_sql ORDER BY date_recorded DESC $pag_sql $max_sql" ) ); |
| | 203 | $activities = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT id, user_id, content, primary_link, date_recorded, component_name, component_action FROM {$bp->activity->table_name} WHERE user_id IN ({$friend_ids}) $filter_sql $disabled_components_sql ORDER BY date_recorded DESC $pag_sql $max_sql" ) ); |
| 198 | 204 | |
| 199 | | $total_activities = $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(user_id) FROM {$bp->activity->table_name} WHERE user_id IN ({$friend_ids}) $filter_sql ORDER BY date_recorded DESC $max_sql" ) ); |
| | 205 | $total_activities = $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT count(user_id) FROM {$bp->activity->table_name} WHERE user_id IN ({$friend_ids}) $filter_sql $disabled_components_sql ORDER BY date_recorded DESC $max_sql" ) ); |
| 200 | 206 | |
| 201 | 207 | return array( 'activities' => $activities, 'total' => (int)$total_activities ); |
| 202 | 208 | } |
| … |
… |
|
| 214 | 220 | if ( $filter ) |
| 215 | 221 | $filter_sql = BP_Activity_Activity::get_filter_sql( $filter ); |
| 216 | 222 | |
| | 223 | /* Skip disabled components */ |
| | 224 | $disabled_components_sql = BP_Activity_Activity::get_disabled_components_sql(); |
| | 225 | |
| 217 | 226 | if ( $limit && $page && $max ) |
| 218 | | $activities = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$bp->activity->table_name} WHERE hide_sitewide = 0 $filter_sql ORDER BY date_recorded DESC $pag_sql" ) ); |
| | 227 | $activities = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$bp->activity->table_name} WHERE hide_sitewide = 0 $filter_sql $disabled_components_sql ORDER BY date_recorded DESC $pag_sql" ) ); |
| 219 | 228 | else |
| 220 | | $activities = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$bp->activity->table_name} WHERE hide_sitewide = 0 $filter_sql ORDER BY date_recorded DESC $pag_sql $max_sql" ) ); |
| | 229 | $activities = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$bp->activity->table_name} WHERE hide_sitewide = 0 $filter_sql $disabled_components_sql ORDER BY date_recorded DESC $pag_sql $max_sql" ) ); |
| 221 | 230 | |
| 222 | | $total_activities = $wpdb->get_var( $wpdb->prepare( "SELECT count(id) FROM {$bp->activity->table_name} WHERE hide_sitewide = 0 $filter_sql ORDER BY date_recorded DESC $max_sql" ) ); |
| | 231 | $total_activities = $wpdb->get_var( $wpdb->prepare( "SELECT count(id) FROM {$bp->activity->table_name} WHERE hide_sitewide = 0 $filter_sql $disabled_components_sql ORDER BY date_recorded DESC $max_sql" ) ); |
| 223 | 232 | |
| 224 | 233 | return array( 'activities' => $activities, 'total' => (int)$total_activities ); |
| 225 | 234 | } |
| … |
… |
|
| 320 | 329 | return $object_sql . $action_sql . $pid_sql . $sid_sql; |
| 321 | 330 | } |
| 322 | 331 | |
| | 332 | function get_disabled_components_sql () { |
| | 333 | global $bp, $wpdb; |
| | 334 | |
| | 335 | // statement is null by default |
| | 336 | $disabled = array(); |
| | 337 | |
| | 338 | // are blogs disabled? |
| | 339 | if ( !isset( $bp->active_components['blogs'] ) ) |
| | 340 | $disabled[] = 'blogs'; |
| | 341 | |
| | 342 | // are relationships disabled? |
| | 343 | if ( !isset( $bp->active_components['friends'] ) ) |
| | 344 | $disabled[] = 'friends'; |
| | 345 | |
| | 346 | // are groups disabled? |
| | 347 | if ( !isset( $bp->active_components['groups'] ) ) |
| | 348 | $disabled[] = 'groups'; |
| | 349 | |
| | 350 | // any plugins need to append to this? |
| | 351 | $disabled = apply_filters( 'bp_activity_get_disabled_components', $disabled ); |
| | 352 | |
| | 353 | if ( !empty( $disabled ) ) { |
| | 354 | |
| | 355 | $statements = array(); |
| | 356 | |
| | 357 | foreach ( $disabled as $component ) { |
| | 358 | $statements[] = $wpdb->prepare( "component_name != %s", $component ); |
| | 359 | } |
| | 360 | |
| | 361 | return 'AND ' . join( ' AND ', $statements ); |
| | 362 | |
| | 363 | } else { |
| | 364 | return null; |
| | 365 | } |
| | 366 | } |
| | 367 | |
| | 368 | No newline at end of file |
| 323 | 369 | function get_last_updated() { |
| 324 | 370 | global $bp, $wpdb; |
| 325 | 371 | |