bp_check_member_type_field_have_options()

Decide need to add profile field select box or not.

Description

Return

(bool)

Source

File: bp-xprofile/bp-xprofile-functions.php

1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
function bp_check_member_type_field_have_options() {
 
    $arr = array();
 
    // Get posts of custom post type selected.
    $posts = new \WP_Query( array(
        'posts_per_page' => - 1,
        'post_type'      => bp_get_member_type_post_type(),
        'orderby'        => 'title',
        'order'          => 'ASC'
    ) );
    if ( $posts ) {
        foreach ( $posts->posts as $post ) {
            $enabled = get_post_meta( $post->ID, '_bp_member_type_enable_profile_field', true );
            if ( '' === $enabled || '1' === $enabled ) {
                $arr[] = $post->ID;
            }
        }
    }
 
    if ( empty( $arr ) ) {
        return false;
    } else {
        return true;
    }
 
}

Changelog

Changelog
Version Description
BuddyBoss 1.1.3 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.