Changeset 5441 for trunk/src/includes/extend/buddypress/activity.php
- Timestamp:
- 07/10/2014 03:54:41 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/includes/extend/buddypress/activity.php
r4995 r5441 271 271 272 272 // Bail if no activity ID is in post meta 273 if ( empty( $activity_id ) ) 273 if ( empty( $activity_id ) ) { 274 274 return null; 275 } 275 276 276 277 // Get the activity stream item, bail if it doesn't exist 277 278 $existing = bp_activity_get_specific( array( 'activity_ids' => $activity_id, 'show_hidden' => true, 'spam' => 'all', ) ); 278 if ( empty( $existing['total'] ) || ( 1 !== (int) $existing['total'] ) ) 279 if ( empty( $existing['total'] ) || ( 1 !== (int) $existing['total'] ) ) { 279 280 return null; 281 } 280 282 281 283 // Return the activity ID since we've verified the connection … … 296 298 297 299 // Already forced off, so comply 298 if ( false === $can_comment ) 300 if ( false === $can_comment ) { 299 301 return $can_comment; 302 } 300 303 301 304 // Check if blog & forum activity stream commenting is off … … 383 386 384 387 // Bail early if topic is by anonymous user 385 if ( !empty( $anonymous_data ) ) 386 return; 388 if ( !empty( $anonymous_data ) ) { 389 return; 390 } 387 391 388 392 // Bail if site is private 389 if ( !bbp_is_site_public() ) 390 return; 393 if ( !bbp_is_site_public() ) { 394 return; 395 } 391 396 392 397 // Validate activity data … … 396 401 397 402 // Bail if user is not active 398 if ( bbp_is_user_inactive( $user_id ) ) 399 return; 403 if ( bbp_is_user_inactive( $user_id ) ) { 404 return; 405 } 400 406 401 407 // Bail if topic is not published 402 if ( !bbp_is_topic_published( $topic_id ) ) 403 return; 408 if ( !bbp_is_topic_published( $topic_id ) ) { 409 return; 410 } 404 411 405 412 // User link for topic author … … 451 458 452 459 // Get activity ID, bail if it doesn't exist 453 if ( $activity_id = $this->get_activity_id( $topic_id ) ) 460 $activity_id = $this->get_activity_id( $topic_id ); 461 if ( !empty( $activity_id ) ) { 454 462 return bp_activity_delete( array( 'id' => $activity_id ) ); 463 } 455 464 456 465 return false; … … 460 469 * Update the activity stream entry when a topic status changes 461 470 * 462 * @param int $ post_id471 * @param int $topic_id 463 472 * @param obj $post 464 473 * @uses get_post_type() … … 475 484 476 485 // Bail early if not a topic 477 if ( get_post_type( $post ) !== bbp_get_topic_post_type() ) 478 return; 486 if ( get_post_type( $post ) !== bbp_get_topic_post_type() ) { 487 return; 488 } 479 489 480 490 $topic_id = bbp_get_topic_id( $topic_id ); 481 491 482 492 // Bail early if topic is by anonymous user 483 if ( bbp_is_topic_anonymous( $topic_id ) ) 484 return; 493 if ( bbp_is_topic_anonymous( $topic_id ) ) { 494 return; 495 } 485 496 486 497 // Action based on new status … … 524 535 525 536 // Do not log activity of anonymous users 526 if ( !empty( $anonymous_data ) ) 527 return; 537 if ( !empty( $anonymous_data ) ) { 538 return; 539 } 528 540 529 541 // Bail if site is private 530 if ( !bbp_is_site_public() ) 531 return; 542 if ( !bbp_is_site_public() ) { 543 return; 544 } 532 545 533 546 // Validate activity data … … 538 551 539 552 // Bail if user is not active 540 if ( bbp_is_user_inactive( $user_id ) ) 541 return; 553 if ( bbp_is_user_inactive( $user_id ) ) { 554 return; 555 } 542 556 543 557 // Bail if reply is not published 544 if ( !bbp_is_reply_published( $reply_id ) ) 545 return; 558 if ( !bbp_is_reply_published( $reply_id ) ) { 559 return; 560 } 546 561 547 562 // Setup links for activity stream … … 597 612 598 613 // Get activity ID, bail if it doesn't exist 599 if ( $activity_id = $this->get_activity_id( $reply_id ) ) 614 $activity_id = $this->get_activity_id( $reply_id ); 615 if ( !empty( $activity_id ) ) { 600 616 return bp_activity_delete( array( 'id' => $activity_id ) ); 617 } 601 618 602 619 return false; … … 606 623 * Update the activity stream entry when a reply status changes 607 624 * 608 * @param int $ post_id625 * @param int $reply_id 609 626 * @param obj $post 610 627 * @uses get_post_type() … … 622 639 623 640 // Bail early if not a reply 624 if ( get_post_type( $post ) !== bbp_get_reply_post_type() ) 625 return; 641 if ( get_post_type( $post ) !== bbp_get_reply_post_type() ) { 642 return; 643 } 626 644 627 645 $reply_id = bbp_get_reply_id( $reply_id ); 628 646 629 647 // Bail early if reply is by anonymous user 630 if ( bbp_is_reply_anonymous( $reply_id ) ) 631 return; 648 if ( bbp_is_reply_anonymous( $reply_id ) ) { 649 return; 650 } 632 651 633 652 // Action based on new status
Note: See TracChangeset
for help on using the changeset viewer.