BP_REST_Activity_Details_Endpoint::bp_rest_legacy_get_activity_filters()

Legacy template activity directory filter support added.

Description

Return

(mixed)

Source

File: bp-activity/classes/class-bp-rest-activity-details-endpoint.php

	public function bp_rest_legacy_get_activity_filters() {
		$filters_data = bp_get_activity_show_filters();
		$filters      = array();

		preg_match_all( '/<option value="(.*?)"\s*>(.*?)<\/option>/', $filters_data, $matches );

		if ( ! empty( $matches[1] ) && ! empty( $matches[2] ) ) {
			foreach ( $matches[1] as $ik => $key_action ) {
				if ( ! empty( $matches[2][ $ik ] ) && ! isset( $filters[ $key_action ] ) ) {
					$filters[ $key_action ] = $matches[2][ $ik ];
				}
			}
		}

		return apply_filters( 'bp_rest_legacy_get_activity_filters', $filters );
	}

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.