This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

BP_XProfile_Field::member_type_metabox()

Private method used to output field profile type metabox.

Description

Source

File: bp-xprofile/classes/class-bp-xprofile-field.php

	private function member_type_metabox() {


		// The primary field is for all, so bail.
		if ( 1 === (int) $this->id || 0 === $this->can_delete ) {
			return;
		}

		// Bail when no profile types are registered.
		if ( ! $member_types = bp_get_member_types( array(), 'objects' ) ) {
			return;
		}

		$field_member_types = $this->get_member_types();

		?>

        <div id="member-types-div" class="postbox">
            <h2><?php _e( 'Profile Types', 'buddyboss' ); ?></h2>
            <div class="inside">
                <p class="description"><?php _e( 'This field should be available to:', 'buddyboss' ); ?></p>

                <ul>
					<?php foreach ( $member_types as $member_type ) : ?>
                        <li>
                            <label for="member-type-<?php echo $member_type->labels['name']; ?>">
                                <input name="member-types[]"
                                       id="member-type-<?php echo $member_type->labels['name']; ?>"
                                       class="member-type-selector" type="checkbox"
                                       value="<?php echo $member_type->name; ?>" <?php checked( in_array( $member_type->name, $field_member_types ) ); ?>/>
								<?php echo $member_type->labels['name']; ?>
                            </label>
                        </li>
					<?php endforeach; ?>

                    <li>
                        <label for="member-type-none">
                            <input name="member-types[]" id="member-type-none" class="member-type-selector"
                                   type="checkbox"
                                   value="null" <?php checked( in_array( 'null', $field_member_types ) ); ?>/>
							<?php _e( 'Users with no profile type', 'buddyboss' ); ?>
                        </label>
                    </li>

                </ul>
                <p class="description member-type-none-notice<?php if ( ! empty( $field_member_types ) ) : ?> hide<?php endif; ?>"><?php _e( 'Unavailable to all members.', 'buddyboss' ) ?></p>
            </div>

            <input type="hidden" name="has-member-types" value="1"/>
        </div>

		<?php
	}

Changelog

Changelog
Version Description
BuddyPress 2.4.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.