diff --git src/bp-activity/bp-activity-functions.php src/bp-activity/bp-activity-functions.php
index 399faff7d..e8487a78f 100644
|
|
|
function bp_activity_post_update( $args = '' ) { |
| 2051 | 2051 | ); |
| 2052 | 2052 | |
| 2053 | 2053 | if ( empty( $r['content'] ) || ! strlen( trim( $r['content'] ) ) ) { |
| | 2054 | if ( 'wp_error' === $r['error_type'] ) { |
| | 2055 | return new WP_Error( 'bp_activity_missing_content', __( 'Please enter some content to post.', 'buddypress' ) ); |
| | 2056 | } |
| | 2057 | |
| 2054 | 2058 | return false; |
| 2055 | 2059 | } |
| 2056 | 2060 | |
| 2057 | 2061 | if ( bp_is_user_inactive( $r['user_id'] ) ) { |
| | 2062 | if ( 'wp_error' === $r['error_type'] ) { |
| | 2063 | return new WP_Error( 'bp_activity_inactive_user', __( 'User account has not yet been activated.', 'buddypress' ) ); |
| | 2064 | } |
| | 2065 | |
| 2058 | 2066 | return false; |
| 2059 | 2067 | } |
| 2060 | 2068 | |
diff --git tests/phpunit/testcases/activity/functions.php tests/phpunit/testcases/activity/functions.php
index d0176b853..4e1700f02 100644
|
|
|
Bar!'; |
| 1456 | 1456 | $this->assertFalse( bp_activity_post_update( array( 'user_id' => 3, ) ) ); |
| 1457 | 1457 | } |
| 1458 | 1458 | |
| | 1459 | /** |
| | 1460 | * @group bp_activity_post_update |
| | 1461 | */ |
| | 1462 | public function test_bp_activity_post_update_empty_content_wp_error() { |
| | 1463 | $activity = bp_activity_post_update( array( |
| | 1464 | 'user_id' => 3, |
| | 1465 | 'error_type' => 'wp_error', |
| | 1466 | ) ); |
| | 1467 | |
| | 1468 | $this->assertInstanceOf( 'WP_Error', $activity ); |
| | 1469 | $this->assertEquals( 'bp_activity_missing_content', $activity->get_error_code() ); |
| | 1470 | } |
| | 1471 | |
| 1459 | 1472 | /** |
| 1460 | 1473 | * @group bp_activity_post_update |
| 1461 | 1474 | */ |
| … |
… |
Bar!'; |
| 1466 | 1479 | ) ) ); |
| 1467 | 1480 | } |
| 1468 | 1481 | |
| | 1482 | /** |
| | 1483 | * @group bp_activity_post_update |
| | 1484 | */ |
| | 1485 | public function test_bp_activity_post_update_inactive_user_wp_error() { |
| | 1486 | $activity = bp_activity_post_update( array( |
| | 1487 | 'user_id' => 3456, |
| | 1488 | 'content' => 'foo', |
| | 1489 | 'error_type' => 'wp_error', |
| | 1490 | ) ); |
| | 1491 | |
| | 1492 | $this->assertInstanceOf( 'WP_Error', $activity ); |
| | 1493 | $this->assertEquals( 'bp_activity_inactive_user', $activity->get_error_code() ); |
| | 1494 | } |
| | 1495 | |
| 1469 | 1496 | /** |
| 1470 | 1497 | * @group bp_activity_post_update |
| 1471 | 1498 | */ |