- Timestamp:
- 06/01/2016 09:00:21 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-templates/bp-legacy/buddypress-functions.php
r10825 r10858 920 920 921 921 if ( ! $object && bp_is_active( 'activity' ) ) { 922 $activity_id = bp_activity_post_update( array( 'content' => $_POST['content'] ) );922 $activity_id = bp_activity_post_update( array( 'content' => $_POST['content'], 'error_type' => 'wp_error' ) ); 923 923 924 924 } elseif ( 'groups' === $object ) { 925 925 if ( $item_id && bp_is_active( 'groups' ) ) 926 $activity_id = groups_post_update( array( 'content' => $_POST['content'], 'group_id' => $item_id ) );926 $activity_id = groups_post_update( array( 'content' => $_POST['content'], 'group_id' => $item_id, 'error_type' => 'wp_error' ) ); 927 927 928 928 } else { … … 932 932 } 933 933 934 if ( empty( $activity_id ) )934 if ( false === $activity_id ) { 935 935 exit( '-1<div id="message" class="error bp-ajax-message"><p>' . __( 'There was a problem posting your update. Please try again.', 'buddypress' ) . '</p></div>' ); 936 } elseif ( is_wp_error( $activity_id ) && $activity_id->get_error_code() ) { 937 exit( '-1<div id="message" class="error bp-ajax-message"><p>' . $activity_id->get_error_message() . '</p></div>' ); 938 } 936 939 937 940 $last_recorded = ! empty( $_POST['since'] ) ? date( 'Y-m-d H:i:s', intval( $_POST['since'] ) ) : 0; … … 998 1001 'content' => $_POST['content'], 999 1002 'parent_id' => $_POST['comment_id'], 1003 'error_type' => 'wp_error' 1000 1004 ) ); 1001 1005 1002 if ( ! $comment_id ) { 1003 if ( ! empty( $bp->activity->errors['new_comment'] ) && is_wp_error( $bp->activity->errors['new_comment'] ) ) { 1004 $feedback = $bp->activity->errors['new_comment']->get_error_message(); 1005 unset( $bp->activity->errors['new_comment'] ); 1006 } 1007 1008 exit( '-1<div id="message" class="error bp-ajax-message"><p>' . esc_html( $feedback ) . '</p></div>' ); 1006 if ( is_wp_error( $comment_id ) ) { 1007 exit( '-1<div id="message" class="error bp-ajax-message"><p>' . esc_html( $comment_id->get_error_message() ) . '</p></div>' ); 1009 1008 } 1010 1009
Note: See TracChangeset
for help on using the changeset viewer.