BP_XProfile_Field_Type_Checkbox_Acceptance::admin_new_field_html( BP_XProfile_Field $current_field, string $control_type = '' )

Admin new field screen.


Parameters Parameters

$current_field

(BP_XProfile_Field) (Required) Profile field object.

$control_type

(string) (Optional) Control type.

Default value: ''


Source Source

File: bp-xprofile/classes/class-bp-xprofile-field-type-checkbox-acceptance.php

	public function admin_new_field_html( BP_XProfile_Field $current_field, $control_type = '' ) {
		$type = array_search( get_class( $this ), bp_xprofile_get_field_types() );

		if ( false === $type ) {
			return;
		}

		$class   = $current_field->type != $type ? 'display: none;' : '';
		$page_id = bp_xprofile_get_meta( $current_field->id, 'field', 'bp_xprofile_checkbox_acceptance_page', true );
		?>

		<div id="<?php echo esc_attr( $type ); ?>" class="postbox bp-options-box" style="<?php echo esc_attr( $class ); ?> margin-top: 15px;">
			<h3><?php esc_html_e( 'Select the page the user needs to accept the terms of:', 'buddypress' ); ?></h3>
			<div class="inside">
				<p>
					<?php
					echo wp_dropdown_pages(
						array(
							'name'             => 'bp_xprofile_checkbox_acceptance_page',
							'echo'             => false,
							'show_option_none' => __( '&mdash; Select &mdash;', 'buddypress' ),
							'selected'         => $page_id ? $page_id : false,
						)
					);

					$page = null;
					if ( $page_id ) {
						$page = get_post( $page_id );
					}
					?>

					<?php if ( $page instanceof WP_Post ) : ?>

						<a href="<?php echo esc_url( get_permalink( $page ) ); ?>" class="button-secondary" target="_bp">
							<?php esc_html_e( 'View', 'buddypress' ); ?> <span class="dashicons dashicons-external" aria-hidden="true" style="vertical-align: text-bottom;"></span>
							<span class="screen-reader-text"><?php esc_html_e( '(opens in a new tab)', 'buddypress' ); ?></span>
						</a>

					<?php endif; ?>
				</p>
			</div>
		</div>
		<?php
	}


Top ↑

Changelog Changelog

Changelog
Version Description
8.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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