Alert: 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 Member Type metabox.


Description Description


Return Return

(void) If default field or if the field does not support the feature.


Top ↑

Source 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 ) {
			return;
		}

		// Bail when no member 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( 'Member Types', 'buddypress' ); ?></h2>
			<div class="inside">
				<p class="description"><?php _e( 'This field should be available to:', 'buddypress' ); ?></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 member type', 'buddypress' ); ?>
						</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.', 'buddypress' ) ?></p>
			</div>

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

		<?php
	}

Top ↑

Changelog Changelog

Changelog
Version Description
2.4.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.