bp_nouveau_ajax_dsearch_recipients()
AJAX load recipient list.
Description
Source
File: bp-templates/bp-nouveau/includes/messages/ajax.php
1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 | function bp_nouveau_ajax_dsearch_recipients() { if ( empty ( $_GET [ 'action' ] ) ) { wp_send_json_error(); } $response = array ( 'feedback' => '<div class="bp-feedback error"><span class="bp-icon" aria-hidden="true"></span><p>' . __( 'There was a problem loading recipients. Please try again.' , 'buddyboss' ) . '</p></div>' , 'type' => 'error' , ); if ( false === bp_is_active( 'messages' ) ) { wp_send_json_error( $response ); } if ( empty ( $_GET [ 'nonce' ] ) || ! wp_verify_nonce( $_GET [ 'nonce' ], 'messages_load_recipient' ) ) { wp_send_json_error( $response ); } add_filter( 'bp_members_suggestions_query_args' , 'bp_nouveau_ajax_search_recipients_exclude_current' ); $results = bp_core_get_suggestions( [ 'term' => sanitize_text_field( $_GET [ 'term' ] ), 'type' => 'members' , ] ); $results = apply_filters( 'bp_members_suggestions_results' , $results ); wp_send_json_success( [ 'results' => array_map ( function ( $result ) { return [ 'id' => "@{$result->ID}" , 'text' => $result ->name ]; }, $results ) ] ); } |
Changelog
Version | Description |
---|---|
BuddyPress 3.0.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.