bp_nouveau_ajax_get_single_activity_content()
Fetches an activity’s full, non-excerpted content via a POST request.
Description Description
Used for the ‘Read More’ link on long activity items.
Return Return
(string) JSON reply
Source Source
File: bp-templates/bp-nouveau/includes/activity/ajax.php
function bp_nouveau_ajax_get_single_activity_content() { $response = array( 'feedback' => sprintf( '<div class="bp-feedback bp-messages error">%s</div>', esc_html__( 'There was a problem displaying the content. Please try again.', 'buddypress' ) ), ); // Bail if not a POST action. if ( ! bp_is_post_request() ) { wp_send_json_error( $response ); } // Nonce check! if ( empty( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'bp_nouveau_activity' ) ) { wp_send_json_error( $response ); } $activity_array = bp_activity_get_specific( array( 'activity_ids' => $_POST['id'], 'display_comments' => 'stream', ) ); if ( empty( $activity_array['activities'][0] ) ) { wp_send_json_error( $response ); } $activity = $activity_array['activities'][0]; /** * Fires before the return of an activity's full, non-excerpted content via a POST request. * * @since 3.0.0 * * @param string $activity Activity content. Passed by reference. */ do_action_ref_array( 'bp_nouveau_get_single_activity_content', array( &$activity ) ); // Activity content retrieved through AJAX should run through normal filters, but not be truncated. remove_filter( 'bp_get_activity_content_body', 'bp_activity_truncate_entry', 5 ); /** This filter is documented in bp-activity/bp-activity-template.php */ $content = apply_filters( 'bp_get_activity_content_body', $activity->content ); wp_send_json_success( array( 'contents' => $content ) ); }
Expand full source code Collapse full source code View on Trac
Changelog Changelog
Version | Description |
---|---|
3.0.0 | Introduced. |