Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/field-types/class-field-type-multi-select-post-type.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ public function edit_field_options_html( array $args = array() ) {
$new_posts_selected = $_POST[ 'field_' . $this->field_obj->id ];
$posts_selected = ( $posts_selected != $new_posts_selected ) ? $new_posts_selected : $posts_selected;
}

$posts_selected = apply_filters( 'bp_get_the_profile_field_multiselect_custom_post_type_selected', $posts_selected, $args, $post_type_selected, $this->field_obj->id );

// Get posts of custom post type selected.
$posts = new \WP_Query(
array(
Expand Down Expand Up @@ -237,6 +240,7 @@ public static function display_filter( $field_value, $field_id = 0 ) {

$post_ids = explode( ',', $field_value );
$post_ids = wp_parse_id_list( $post_ids );
$post_ids = apply_filters( 'bp_xprofile_field_multiselect_custom_post_type_value', $post_ids, $field_id );
_prime_post_caches( $post_ids, false, false );

$list = '';
Expand Down
3 changes: 3 additions & 0 deletions src/field-types/class-field-type-multi-select-taxonomy.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ public function edit_field_options_html( array $args = array() ) {
$terms_selected = ( $terms_selected != $new_terms_selected ) ? $new_terms_selected : $terms_selected;
}

$terms_selected = apply_filters( 'bp_get_the_profile_field_multiselect_custom_taxonomy_selected', $terms_selected, $args, $taxonomy_selected, $this->field_obj->id );

// Get terms of custom taxonomy selected.
$terms = get_terms( $taxonomy_selected, array( 'hide_empty' => false ) );

Expand Down Expand Up @@ -229,6 +231,7 @@ public static function display_filter( $field_value, $field_id = '' ) {

$field_value = explode( ',', $field_value );
$term_ids = wp_parse_id_list( $field_value );
$term_ids = apply_filters( 'bp_xprofile_field_multiselect_custom_taxonomy_value', $term_ids, $field_id );

$tax = self::get_selected_taxonomy( $field_id );
$list = '';
Expand Down
5 changes: 5 additions & 0 deletions src/field-types/class-field-type-select-post-type.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ public function edit_field_options_html( array $args = array() ) {
$new_post_selected = (int) $_POST[ 'field_' . $this->field_obj->id ];
$post_selected = ( $post_selected != $new_post_selected ) ? $new_post_selected : $post_selected;
}

$post_selected = apply_filters( 'bp_get_the_profile_field_select_custom_post_type_selected', $post_selected, $args, $post_type_selected, $this->field_obj->id );

// Get posts of custom post type selected.
$posts = new \WP_Query(
array(
Expand Down Expand Up @@ -194,6 +197,8 @@ public static function display_filter( $field_value, $field_id = '' ) {
return '';
}

$post_id = apply_filters( 'bp_xprofile_field_select_custom_post_type_value', $post_id, $field_id );

return sprintf( '<a href="%1$s">%2$s</a>', esc_url( get_permalink( $post_id ) ), get_the_title( $post_id ) );
}

Expand Down
4 changes: 4 additions & 0 deletions src/field-types/class-field-type-select-taxonomy.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ public function edit_field_options_html( array $args = array() ) {
$term_selected = ( $term_selected != $new_term_selected ) ? $new_term_selected : $term_selected;
}

$term_selected = apply_filters( 'bp_get_the_profile_field_select_custom_taxonomy_selected', $term_selected, $args, $taxonomy_selected, $this->field_obj->id );

// Get terms of custom taxonomy selected.
$terms = get_terms( $taxonomy_selected, array( 'hide_empty' => false ) );

Expand Down Expand Up @@ -205,6 +207,8 @@ public static function display_filter( $field_value, $field_id = 0 ) {
$term_id = absint( $field_value );
$tax = self::get_selected_taxonomy( $field_id );

$term_id = apply_filters( 'bp_xprofile_field_select_custom_taxonomy_value', $term_id, $field_id );

$term = get_term( $term_id, $tax );
if ( ! $term || is_wp_error( $term ) ) {
return '';
Expand Down