Changeset 12286 for trunk/src/bp-activity/bp-activity-functions.php
- Timestamp:
- 11/15/2018 07:17:12 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-activity/bp-activity-functions.php
r12281 r12286 3918 3918 3919 3919 /** 3920 * AJAX endpoint for Suggestions API lookups.3921 *3922 * @since 2.1.03923 */3924 function bp_ajax_get_suggestions() {3925 if ( ! bp_is_user_active() || empty( $_GET['term'] ) || empty( $_GET['type'] ) ) {3926 wp_send_json_error( 'missing_parameter' );3927 exit;3928 }3929 3930 $args = array(3931 'term' => sanitize_text_field( $_GET['term'] ),3932 'type' => sanitize_text_field( $_GET['type'] ),3933 );3934 3935 // Support per-Group suggestions.3936 if ( ! empty( $_GET['group-id'] ) ) {3937 $args['group_id'] = absint( $_GET['group-id'] );3938 }3939 3940 $results = bp_core_get_suggestions( $args );3941 3942 if ( is_wp_error( $results ) ) {3943 wp_send_json_error( $results->get_error_message() );3944 exit;3945 }3946 3947 wp_send_json_success( $results );3948 }3949 add_action( 'wp_ajax_bp_get_suggestions', 'bp_ajax_get_suggestions' );3950 3951 /**3952 3920 * Detect a change in post type status, and initiate an activity update if necessary. 3953 3921 *
Note: See TracChangeset
for help on using the changeset viewer.