Changeset 5262
- Timestamp:
- 11/01/2011 11:21:59 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-activity/bp-activity-actions.php
r5259 r5262 195 195 196 196 // Is the current user allowed to spam items? 197 if ( ! BP_Akismet::user_can_mark_spam() )197 if ( !bp_activity_user_can_mark_spam() ) 198 198 return false; 199 199 … … 210 210 211 211 // Mark as spam 212 $bp->activity->akismet->mark_as_spam( $activity );212 bp_activity_mark_as_spam( $activity ); 213 213 $activity->save(); 214 214 -
trunk/bp-activity/bp-activity-akismet.php
r5259 r5262 47 47 add_action( 'bp_activity_before_save', array( $this, 'check_activity' ), 1, 1 ); 48 48 49 // Update activity meta after a spam check50 add_action( 'bp_activity_after_save', array( $this, 'update_activity_meta' ), 1, 1 );51 52 49 // Tidy up member's latest (activity) update 53 50 add_action( 'bp_activity_posted_update', array( $this, 'check_member_activity_update' ), 1, 3 ); 51 52 // Hooks to extend Activity core spam/ham functions for Akismet 53 add_action( 'bp_activity_mark_as_spam', array( $this, 'mark_as_spam' ), 10, 2 ); 54 add_action( 'bp_activity_mark_as_ham', array( $this, 'mark_as_ham' ), 10, 2 ); 55 56 // Hook into the Activity wp-admin screen 57 //add_action( 'bp_activity_admin_comment_row_actions', array( $this, 'add_activity_status_row' ), 10, 2 ); 54 58 } 55 59 … … 90 94 return; 91 95 92 // Was this $activity_id just marked as spam? 93 if ( !$this->last_activity->id || $activity_id != $this->last_activity->id )96 // Was this $activity_id just marked as spam? If not, bail out. 97 if ( !$this->last_activity->id || $activity_id != $this->last_activity->id || 'false' == $this->last_activity->akismet_submission['bp_as_result'] ) 94 98 return; 95 99 … … 103 107 * This function is intended to be used inside the activity stream loop. 104 108 * 105 * @since 1. 2109 * @since 1.6 106 110 */ 107 111 public function add_activity_spam_button() { 108 if ( ! BP_Akismet::user_can_mark_spam() )112 if ( !bp_activity_user_can_mark_spam() ) 109 113 return; 110 114 … … 131 135 * This function is intended to be used inside the activity stream loop. 132 136 * 133 * @since 1. 2137 * @since 1.6 134 138 */ 135 139 public function add_activity_comment_spam_button() { 136 if ( ! BP_Akismet::user_can_mark_spam() )140 if ( !bp_activity_user_can_mark_spam() ) 137 141 return; 138 142 … … 156 160 157 161 /** 158 * Convenience function to control whether the current user is allowed to mark activity items as spam159 *160 * @global object $bp BuddyPress global settings161 * @return bool True if user is allowed to mark activity items as spam162 * @since 1.6163 * @static164 */165 public static function user_can_mark_spam() {166 global $bp;167 return apply_filters( 'bp_activity_akismet_user_can_mark_spam', $bp->loggedin_user->is_site_admin );168 }169 170 /**171 162 * Get a list of filterable types of activity item that we want Akismet to automatically check for spam. 172 163 * … … 183 174 * 184 175 * @param BP_Activity_Activity $activity 185 * @since 1.6 186 */ 187 public function mark_as_spam( &$activity ) { 188 $activity->is_spam = 1; 189 176 * @param string $source Either "by_a_person" (e.g. a person has manually marked the activity as spam) or "by_akismet" (automatically spammed). 177 * @since 1.6 178 */ 179 public function mark_as_spam( $activity, $source ) { 190 180 // Record this item so we can do some tidyup in BP_Akismet::check_member_activity_update() 191 181 $this->last_activity = $activity; 192 182 193 // Clear the activity stream first page cache 194 wp_cache_delete( 'bp_activity_sitewide_front', 'bp' ); 195 196 // Clear the activity comment cache for this activity item 197 wp_cache_delete( 'bp_activity_comments_' . $activity->id, 'bp' ); 198 199 do_action( 'bp_activity_akismet_mark_as_spam', $activity ); 183 do_action( 'bp_activity_akismet_mark_as_spam', $activity, $source ); 200 184 } 201 185 … … 204 188 * 205 189 * @param BP_Activity_Activity $activity 206 * @since 1.6 207 */ 208 public function mark_as_ham( &$activity ) { 209 $activity->is_spam = 0; 210 211 // Clear the activity stream first page cache 212 wp_cache_delete( 'bp_activity_sitewide_front', 'bp' ); 213 214 // Clear the activity comment cache for this activity item 215 wp_cache_delete( 'bp_activity_comments_' . $activity->id, 'bp' ); 216 217 //bp_activity_delete_meta( $activity->id, 'bpla_spam' ); 218 do_action( 'bp_activity_akismet_mark_as_ham', $activity ); 219 190 * @param string $source Either "by_a_person" (e.g. a person has manually marked the activity as spam) or "by_akismet" (automatically spammed). 191 * @since 1.6 192 */ 193 public function mark_as_ham( $activity, $source ) { 220 194 //DJPAULTODO: Run bp_activity_at_name_filter() somehow... but not twice, if we can help it. Maybe check if it was auto-spammed by Akismet? 195 196 do_action( 'bp_activity_akismet_mark_as_ham', $activity, $source ); 221 197 } 222 198 223 199 /** 224 * Check if the activity item is spam or ham 225 * 226 * @param BP_Activity_Activity $activity The activity item to check 227 * @see http://akismet.com/development/api/ 228 * @since 1.6 229 * @todo Spam counter? 230 * @todo Auto-delete old spam? 231 */ 232 public function check_activity( $activity ) { 233 // By default, only handle activity updates and activity comments. 234 if ( !in_array( $activity->type, BP_Akismet::get_activity_types() ) ) 235 return; 236 237 $this->last_activity = null; 238 $userdata = get_userdata( $activity->user_id ); 239 240 // Build up a data package for the Akismet service to inspect 200 * Build a data package for the Akismet service to inspect 201 * 202 * @param BP_Activity_Activity $activity 203 * @see http://akismet.com/development/api/#comment-check 204 * @since 1.6 205 * @static 206 */ 207 public static function build_akismet_data_package( $activity ) { 208 $userdata = get_userdata( $activity->user_id ); 209 241 210 $activity_data = array(); 242 211 $activity_data['akismet_comment_nonce'] = 'inactive'; … … 264 233 $activity_data['akismet_comment_nonce'] = wp_verify_nonce( $_POST["_bp_as_nonce_{$activity->secondary_item_id}"], "_bp_as_nonce_{$userdata->ID}_{$activity->secondary_item_id}" ) ? 'passed' : 'failed'; 265 234 235 return apply_filters( 'bp_akismet_build_akismet_data_package', $activity_data, $activity ); 236 } 237 238 /** 239 * Check if the activity item is spam or ham 240 * 241 * @param BP_Activity_Activity $activity The activity item to check 242 * @see http://akismet.com/development/api/ 243 * @since 1.6 244 * @todo Spam counter? 245 * @todo Auto-delete old spam? 246 */ 247 public function check_activity( $activity ) { 248 // By default, only handle activity updates and activity comments. 249 if ( !in_array( $activity->type, BP_Akismet::get_activity_types() ) ) 250 return; 251 252 // Make sure last_activity is clear to avoid any confusion 253 $this->last_activity = null; 254 255 // Build data package for Akismet 256 $activity_data = BP_Akismet::build_akismet_data_package( $activity ); 257 266 258 // Check with Akismet to see if this is spam 267 $activity_data = $this-> maybe_spam( $activity_data);259 $activity_data = $this->send_akismet_request( $activity_data, 'check', 'spam' ); 268 260 269 261 // Record this item … … 279 271 280 272 // Mark as spam 281 $this->mark_as_spam( $activity);273 bp_activity_mark_as_spam( $activity, 'by_akismet' ); 282 274 } 283 } 284 285 /** 286 * Update activity meta after a spam check 287 * 275 276 // Update activity meta after a spam check 277 add_action( 'bp_activity_after_save', array( $this, 'update_activity_akismet_meta' ), 1, 1 ); 278 } 279 280 /** 281 * Update activity meta after a manual spam change (user initiated) 282 * 283 * @global object $bp BuddyPress global settings 288 284 * @param BP_Activity_Activity $activity The activity to check 289 285 * @since 1.6 290 286 */ 291 public function update_activity_meta( $activity ) { 287 public function update_activity_spam_meta( $activity ) { 288 global $bp; 289 290 // By default, only handle activity updates and activity comments. 291 if ( !in_array( $activity->type, BP_Akismet::get_activity_types() ) ) 292 return; 293 294 $this->update_activity_history( $activity->id, sprintf( __( '%s reported this activity as spam', 'buddypress' ), $bp->loggedin_user->fullname ), 'report-spam' ); 295 bp_activity_update_meta( $activity->id, '_bp_akismet_user_result', 'true' ); 296 bp_activity_update_meta( $activity->id, '_bp_akismet_user', $bp->loggedin_user->fullname ); 297 } 298 299 /** 300 * Update activity meta after a manual ham change (user initiated) 301 * 302 * @global object $bp BuddyPress global settings 303 * @param BP_Activity_Activity $activity The activity to check 304 * @since 1.6 305 */ 306 public function update_activity_ham_meta( $activity ) { 307 global $bp; 308 309 // By default, only handle activity updates and activity comments. 310 if ( !in_array( $activity->type, BP_Akismet::get_activity_types() ) ) 311 return; 312 313 $this->update_activity_history( $activity->id, sprintf( __( '%s reported this activity as not spam', 'buddypress' ), $bp->loggedin_user->fullname ), 'report-ham' ); 314 bp_activity_update_meta( $activity->id, '_bp_akismet_user_result', 'false' ); 315 bp_activity_update_meta( $activity->id, '_bp_akismet_user', $bp->loggedin_user->fullname ); 316 } 317 318 /** 319 * Update activity meta after an automatic spam check (not user initiated) 320 * 321 * @param BP_Activity_Activity $activity The activity to check 322 * @since 1.6 323 */ 324 public function update_activity_akismet_meta( $activity ) { 292 325 // Check we're dealing with what was last updated by Akismet 293 326 if ( empty( $this->last_activity ) || !empty( $this->last_activity ) && $activity->id != $this->last_activity->id ) … … 330 363 * @since 1.6 331 364 */ 332 p rotected function maybe_spam( $activity_data, $check = 'check', $spam = 'spam' ) {365 public function send_akismet_request( $activity_data, $check = 'check', $spam = 'spam' ) { 333 366 global $akismet_api_host, $akismet_api_port; 334 367 … … 481 514 * @since 1.6 482 515 */ 483 p rivatefunction update_activity_history( $activity_id = 0, $message = '', $event = '' ) {516 public function update_activity_history( $activity_id = 0, $message = '', $event = '' ) { 484 517 $event = array( 485 518 'event' => $event, -
trunk/bp-activity/bp-activity-classes.php
r5259 r5262 99 99 100 100 // Static Functions 101 function get( $max = false, $page = 1, $per_page = 25, $sort = 'DESC', $search_terms = false, $filter = false, $display_comments = false, $show_hidden = false, $exclude = false, $in = false, $ hide_spam = true) {101 function get( $max = false, $page = 1, $per_page = 25, $sort = 'DESC', $search_terms = false, $filter = false, $display_comments = false, $show_hidden = false, $exclude = false, $in = false, $spam = 'ham_only' ) { 102 102 global $wpdb, $bp; 103 103 … … 111 111 112 112 // Spam 113 if ( $hide_spam )113 if ( 'ham_only' == $spam ) 114 114 $where_conditions['spam_sql'] = 'a.is_spam = 0'; 115 elseif ( 'spam_only' == $spam ) 116 $where_conditions['spam_sql'] = 'a.is_spam = 1'; 115 117 116 118 // Searching … … 191 193 192 194 if ( $activities && $display_comments ) 193 $activities = BP_Activity_Activity::append_comments( $activities, $ hide_spam );195 $activities = BP_Activity_Activity::append_comments( $activities, $spam ); 194 196 195 197 // If $max is set, only return up to the max results … … 362 364 * @global wpdb $wpdb WordPress database object 363 365 * @param array $activities 364 * @param bool $ hide_spam Optional. Defaults to true (don't retrieve spammed items).366 * @param bool $spam Optional; 'ham_only' (default), 'spam_only' or 'all'. 365 367 * @return array The updated activities with nested comments 366 368 * @since 1.2 367 369 */ 368 function append_comments( $activities, $ hide_spam = true) {370 function append_comments( $activities, $spam = 'ham_only' ) { 369 371 global $bp, $wpdb; 370 372 … … 374 376 foreach( (array)$activities as $activity ) { 375 377 if ( 'activity_comment' != $activity->type && $activity->mptt_left && $activity->mptt_right ) 376 $activity_comments[$activity->id] = BP_Activity_Activity::get_activity_comments( $activity->id, $activity->mptt_left, $activity->mptt_right, $ hide_spam );378 $activity_comments[$activity->id] = BP_Activity_Activity::get_activity_comments( $activity->id, $activity->mptt_left, $activity->mptt_right, $spam ); 377 379 } 378 380 … … 393 395 * @param int $left Left-most node boundary 394 396 * @param into $right Right-most node boundary 395 * @param bool $ hide_spam Optional. Defaults to true (don't retrieve spammed items).397 * @param bool $spam Optional; 'ham_only' (default), 'spam_only' or 'all'. 396 398 * @return array The updated activities with nested comments 397 399 * @since 1.2 398 400 */ 399 function get_activity_comments( $activity_id, $left, $right, $ hide_spam = true) {401 function get_activity_comments( $activity_id, $left, $right, $spam = 'ham_only' ) { 400 402 global $wpdb, $bp; 401 403 … … 413 415 414 416 // Don't retrieve activity comments marked as spam 415 if ( $hide_spam )417 if ( 'ham_only' == $spam ) 416 418 $spam_sql = 'AND a.is_spam = 0'; 419 elseif ( 'spam_only' == $spam ) 420 $spam_sql = 'AND a.is_spam = 1'; 417 421 else 418 422 $spam_sql = ''; 419 423 420 $sql = apply_filters( 'bp_activity_comments_user_join_filter', $wpdb->prepare( "SELECT a.*, u.user_email, u.user_nicename, u.user_login, u.display_name{$fullname_select} FROM {$bp->activity->table_name} a, {$wpdb->users} u{$fullname_from} WHERE u.ID = a.user_id {$fullname_where} AND a.type = 'activity_comment' ${spam_sql} AND a.item_id = %d AND a.mptt_left BETWEEN %d AND %d ORDER BY a.date_recorded ASC", $activity_id, $left, $right ), $activity_id, $left, $right, $ hide_spam);424 $sql = apply_filters( 'bp_activity_comments_user_join_filter', $wpdb->prepare( "SELECT a.*, u.user_email, u.user_nicename, u.user_login, u.display_name{$fullname_select} FROM {$bp->activity->table_name} a, {$wpdb->users} u{$fullname_from} WHERE u.ID = a.user_id {$fullname_where} AND a.type = 'activity_comment' ${spam_sql} AND a.item_id = %d AND a.mptt_left BETWEEN %d AND %d ORDER BY a.date_recorded ASC", $activity_id, $left, $right ), $activity_id, $left, $right, $spam_sql ); 421 425 422 426 // Retrieve all descendants of the $root node -
trunk/bp-activity/bp-activity-functions.php
r5259 r5262 692 692 function bp_activity_get( $args = '' ) { 693 693 $defaults = array( 694 'max' => false, // Maximum number of results to return695 'page' => 1, // page 1 without a per_page will result in no pagination.696 'per_page' => false, // results per page697 'sort' => 'DESC', // sort ASC or DESC698 'display_comments' => false, // false for no comments. 'stream' for within stream display, 'threaded' for below each activity item699 700 'search_terms' => false, // Pass search terms as a string701 'show_hidden' => false, // Show activity items that are hidden site-wide?702 'exclude' => false, // Comma-separated list of activity IDs to exclude703 'in' => false, // Comma-separated list or array of activity IDs to which you want to limit the query704 ' hide_spam' => true, // Don't retrieve items marked as spam?694 'max' => false, // Maximum number of results to return 695 'page' => 1, // page 1 without a per_page will result in no pagination. 696 'per_page' => false, // results per page 697 'sort' => 'DESC', // sort ASC or DESC 698 'display_comments' => false, // false for no comments. 'stream' for within stream display, 'threaded' for below each activity item 699 700 'search_terms' => false, // Pass search terms as a string 701 'show_hidden' => false, // Show activity items that are hidden site-wide? 702 'exclude' => false, // Comma-separated list of activity IDs to exclude 703 'in' => false, // Comma-separated list or array of activity IDs to which you want to limit the query 704 'spam' => 'ham_only', // 'ham_only' (default), 'spam_only' or 'all'. 705 705 706 706 /** … … 720 720 721 721 // Attempt to return a cached copy of the first page of sitewide activity. 722 if ( 1 == (int)$page && empty( $max ) && empty( $search_terms ) && empty( $filter ) && 'DESC' == $sort && empty( $exclude )) {722 if ( 1 == (int)$page && empty( $max ) && empty( $search_terms ) && empty( $filter ) && empty( $exclude ) && empty( $in ) && 'DESC' == $sort && empty( $exclude ) && 'ham_only' == $spam ) { 723 723 if ( !$activity = wp_cache_get( 'bp_activity_sitewide_front', 'bp' ) ) { 724 $activity = BP_Activity_Activity::get( $max, $page, $per_page, $sort, $search_terms, $filter, $display_comments, $show_hidden, false, false, $ hide_spam );724 $activity = BP_Activity_Activity::get( $max, $page, $per_page, $sort, $search_terms, $filter, $display_comments, $show_hidden, false, false, $spam ); 725 725 wp_cache_set( 'bp_activity_sitewide_front', $activity, 'bp' ); 726 726 } 727 727 728 728 } else { 729 $activity = BP_Activity_Activity::get( $max, $page, $per_page, $sort, $search_terms, $filter, $display_comments, $show_hidden, $exclude, $in, $ hide_spam );729 $activity = BP_Activity_Activity::get( $max, $page, $per_page, $sort, $search_terms, $filter, $display_comments, $show_hidden, $exclude, $in, $spam ); 730 730 } 731 731 … … 748 748 function bp_activity_get_specific( $args = '' ) { 749 749 $defaults = array( 750 'activity_ids' => false, // A single activity_id or array of IDs.751 'display_comments' => false, // true or false to display threaded comments for these specific activity items752 ' hide_spam' => false, // Retrieve items marked as spam753 ' max' => false, // Maximum number of results to return754 'p age' => 1, // page 1 without a per_page will result in no pagination.755 ' per_page' => false, // results per page756 's how_hidden' => true, // When fetching specific items, show all757 's ort' => 'DESC', // sort ASC or DESC750 'activity_ids' => false, // A single activity_id or array of IDs. 751 'display_comments' => false, // true or false to display threaded comments for these specific activity items 752 'max' => false, // Maximum number of results to return 753 'page' => 1, // page 1 without a per_page will result in no pagination. 754 'per_page' => false, // results per page 755 'show_hidden' => true, // When fetching specific items, show all 756 'sort' => 'DESC', // sort ASC or DESC 757 'spam' => 'ham_only', // Retrieve items marked as spam 758 758 ); 759 759 $r = wp_parse_args( $args, $defaults ); 760 760 extract( $r, EXTR_SKIP ); 761 761 762 return apply_filters( 'bp_activity_get_specific', BP_Activity_Activity::get( $max, $page, $per_page, $sort, false, false, $display_comments, $show_hidden, false, $activity_ids, $ hide_spam ) );762 return apply_filters( 'bp_activity_get_specific', BP_Activity_Activity::get( $max, $page, $per_page, $sort, false, false, $display_comments, $show_hidden, false, $activity_ids, $spam ) ); 763 763 } 764 764 … … 1327 1327 } 1328 1328 1329 /** 1330 * Convenience function to control whether the current user is allowed to mark activity items as spam 1331 * 1332 * @global object $bp BuddyPress global settings 1333 * @return bool True if user is allowed to mark activity items as spam 1334 * @since 1.6 1335 * @static 1336 */ 1337 function bp_activity_user_can_mark_spam() { 1338 global $bp; 1339 return apply_filters( 'bp_activity_user_can_mark_spam', $bp->loggedin_user->is_site_admin ); 1340 } 1341 1342 /** 1343 * Mark activity item as spam 1344 * 1345 * @global object $bp BuddyPress global settings 1346 * @param BP_Activity_Activity $activity 1347 * @param string $source Optional; default is "by_a_person" (e.g. a person has manually marked the activity as spam). 1348 * @since 1.6 1349 */ 1350 function bp_activity_mark_as_spam( &$activity, $source = 'by_a_person' ) { 1351 global $bp; 1352 1353 $activity->is_spam = 1; 1354 1355 // Clear the activity stream first page cache 1356 wp_cache_delete( 'bp_activity_sitewide_front', 'bp' ); 1357 1358 // Clear the activity comment cache for this activity item 1359 wp_cache_delete( 'bp_activity_comments_' . $activity->id, 'bp' ); 1360 1361 // If Akismet is active, and this was a manual spam/ham request, stop Akismet checking the activity 1362 if ( 'by_a_person' == $source && !empty( $bp->activity->akismet ) ) { 1363 remove_action( 'bp_activity_before_save', array( $bp->activity->akismet, 'check_activity' ), 1, 1 ); 1364 1365 // Build data package for Akismet 1366 $activity_data = BP_Akismet::build_akismet_data_package( $activity ); 1367 1368 // Tell Akismet this is spam 1369 $activity_data = $bp->activity->akismet->send_akismet_request( $activity_data, 'submit', 'spam' ); 1370 1371 // Update meta 1372 add_action( 'bp_activity_after_save', array( $bp->activity->akismet, 'update_activity_spam_meta' ), 1, 1 ); 1373 } 1374 1375 do_action( 'bp_activity_mark_as_spam', $activity, $source ); 1376 } 1377 1378 /** 1379 * Mark activity item as ham 1380 * 1381 * @global object $bp BuddyPress global settings 1382 * @param BP_Activity_Activity $activity 1383 * @param string $source Optional; default is "by_a_person" (e.g. a person has manually marked the activity as spam). 1384 * @since 1.6 1385 */ 1386 function bp_activity_mark_as_ham( &$activity, $source = 'by_a_person' ) { 1387 global $bp; 1388 1389 $activity->is_spam = 0; 1390 1391 // Clear the activity stream first page cache 1392 wp_cache_delete( 'bp_activity_sitewide_front', 'bp' ); 1393 1394 // Clear the activity comment cache for this activity item 1395 wp_cache_delete( 'bp_activity_comments_' . $activity->id, 'bp' ); 1396 1397 // If Akismet is active, and this was a manual spam/ham request, stop Akismet checking the activity 1398 if ( 'by_a_person' == $source && !empty( $bp->activity->akismet ) ) { 1399 remove_action( 'bp_activity_before_save', array( $bp->activity->akismet, 'check_activity' ), 1, 1 ); 1400 1401 // Build data package for Akismet 1402 $activity_data = BP_Akismet::build_akismet_data_package( $activity ); 1403 1404 // Tell Akismet this is spam 1405 $activity_data = $bp->activity->akismet->send_akismet_request( $activity_data, 'submit', 'ham' ); 1406 1407 // Update meta 1408 add_action( 'bp_activity_after_save', array( $bp->activity->akismet, 'update_activity_ham_meta' ), 1, 1 ); 1409 } 1410 1411 //DJPAULTODO: Run bp_activity_at_name_filter() somehow... but not twice, if we can help it. Maybe check if it was auto-spammed by Akismet? 1412 do_action( 'bp_activity_mark_as_ham', $activity, $source ); 1413 } 1414 1415 1329 1416 /** Embeds *******************************************************************/ 1330 1417 -
trunk/bp-activity/bp-activity-loader.php
r5259 r5262 54 54 if ( defined( 'AKISMET_VERSION' ) && ( !empty( $akismet_key ) || defined( 'WPCOM_API_KEY' ) ) ) 55 55 $includes[] = 'akismet'; 56 57 if ( is_admin() ) 58 $includes[] = 'admin'; 56 59 57 60 parent::includes( $includes ); -
trunk/bp-activity/bp-activity-template.php
r5259 r5262 105 105 var $full_name; 106 106 107 function __construct( $page, $per_page, $max, $include, $sort, $filter, $search_terms, $display_comments, $show_hidden, $exclude = false, $in = false, $ hide_spam = true) {107 function __construct( $page, $per_page, $max, $include, $sort, $filter, $search_terms, $display_comments, $show_hidden, $exclude = false, $in = false, $spam = 'ham_only' ) { 108 108 global $bp; 109 109 … … 119 119 // Fetch specific activity items based on ID's 120 120 if ( !empty( $include ) ) 121 $this->activities = bp_activity_get_specific( array( 'activity_ids' => explode( ',', $include ), 'max' => $max, 'page' => $this->pag_page, 'per_page' => $this->pag_num, 'sort' => $sort, 'display_comments' => $display_comments, 'show_hidden' => $show_hidden, ' hide_spam' => $hide_spam ) );121 $this->activities = bp_activity_get_specific( array( 'activity_ids' => explode( ',', $include ), 'max' => $max, 'page' => $this->pag_page, 'per_page' => $this->pag_num, 'sort' => $sort, 'display_comments' => $display_comments, 'show_hidden' => $show_hidden, 'spam' => $spam ) ); 122 122 123 123 // Fetch all activity items 124 124 else 125 $this->activities = bp_activity_get( array( 'display_comments' => $display_comments, 'max' => $max, 'per_page' => $this->pag_num, 'page' => $this->pag_page, 'sort' => $sort, 'search_terms' => $search_terms, 'filter' => $filter, 'show_hidden' => $show_hidden, 'exclude' => $exclude, 'in' => $in, ' hide_spam' => $hide_spam ) );125 $this->activities = bp_activity_get( array( 'display_comments' => $display_comments, 'max' => $max, 'per_page' => $this->pag_num, 'page' => $this->pag_page, 'sort' => $sort, 'search_terms' => $search_terms, 'filter' => $filter, 'show_hidden' => $show_hidden, 'exclude' => $exclude, 'in' => $in, 'spam' => $spam ) ); 126 126 127 127 if ( !$max || $max >= (int)$this->activities['total'] ) … … 299 299 'max' => false, // max number to return 300 300 'show_hidden' => $show_hidden, // Show activity items that are hidden site-wide? 301 ' hide_spam' => true, // Don't retrieve items marked as spam?301 'spam' => 'ham_only', // Hide spammed items 302 302 303 303 // Scope - pre-built activity filters for a user (friends/groups/favorites/mentions) … … 384 384 385 385 // If specific activity items have been requested, override the $hide_spam argument. This prevents backpat errors with AJAX. 386 if ( !empty( $include ) && $hide_spam )387 $ hide_spam = false;388 389 $activities_template = new BP_Activity_Template( $page, $per_page, $max, $include, $sort, $filter, $search_terms, $display_comments, $show_hidden, $exclude, $in, $ hide_spam );386 if ( !empty( $include ) && 'ham_only' == $spam ) 387 $spam = 'all'; 388 389 $activities_template = new BP_Activity_Template( $page, $per_page, $max, $include, $sort, $filter, $search_terms, $display_comments, $show_hidden, $exclude, $in, $spam ); 390 390 391 391 return apply_filters( 'bp_has_activities', $activities_template->has_activities(), $activities_template ); -
trunk/bp-core/bp-core-cssjs.php
r4961 r5262 27 27 ul#adminmenu li.toplevel_page_bp-general-settings:hover .wp-menu-image a, 28 28 ul#adminmenu li.toplevel_page_bp-general-settings.wp-has-current-submenu .wp-menu-image a { 29 background-position: -1px 0; 30 } 31 32 /* Activity Icon */ 33 ul#adminmenu li.toplevel_page_bp-activity-settings .wp-menu-image a img { display: none; } 34 ul#adminmenu li.toplevel_page_bp-activity-settings .wp-menu-image a { background-image: url( <?php echo plugins_url( 'buddypress/bp-core/images/admin_menu_icon.png' ) ?> ) !important; background-position: -1px -32px; } 35 ul#adminmenu li.toplevel_page_bp-activity-settings:hover .wp-menu-image a, 36 ul#adminmenu li.toplevel_page_bp-activity-settings.wp-has-current-submenu .wp-menu-image a { 29 37 background-position: -1px 0; 30 38 } -
trunk/bp-themes/bp-default/_inc/ajax.php
r5259 r5262 340 340 341 341 // Is the current user allowed to spam items? 342 if ( ! BP_Akismet::user_can_mark_spam() )342 if ( !bp_activity_user_can_mark_spam() ) 343 343 return false; 344 344 … … 357 357 358 358 // Mark as spam 359 $bp->activity->akismet->mark_as_spam( $activity );359 bp_activity_mark_as_spam( $activity ); 360 360 $activity->save(); 361 361
Note: See TracChangeset
for help on using the changeset viewer.