bp_search_ajax_option()

BuddyBoss Profile Search Admin

Description

Source

File: bp-core/profile-search/bps-admin.php

function bp_search_ajax_option() {

	list ($groups, $fields) = bp_ps_get_fields ();
	$k = (int) $_POST['count'] - 1;
	$id = $_POST['field_id'];
	$field = $fields[$id];
	$label = '';
	$default = esc_attr ($field->name);
	$showlabel = empty ($label)? "placeholder=\"$default\"": "value=\"$label\"";
	$desc = '';
	$showdesc = ! empty( $desc ) ? "value=\"$desc\"" : "";
	?>

	<div id="field_div<?php echo $k; ?>" class="sortable">
		<span class="bp_ps_col1" title="<?php _e('Drag & drop to reorder fields', 'buddyboss'); ?>">&nbsp;&#x21C5;</span>
		<?php _bp_ps_field_select ($groups, "bp_ps_options[field_name][$k]", "field_name$k", $id); ?>
		<input class="bp_ps_col3" type="text" name="bp_ps_options[field_label][<?php echo $k; ?>]" id="field_label<?php echo $k; ?>" <?php echo $showlabel; ?> />
		<input class="bp_ps_col4" type="text" name="bp_ps_options[field_desc][<?php echo $k; ?>]" id="field_desc<?php echo $k; ?>" <?php echo $showdesc; ?> />
		<?php
		if ( 'heading' != $field->code ) {
			_bp_ps_filter_select ($field, "bp_ps_options[field_mode][$k]", "field_mode$k", $_POST['field_id']);
		} else {
			echo "<span class='bp_ps_col5'>-</span>";
		}
		?>
		<a href="javascript:remove('field_div<?php echo $k; ?>')" class="delete"><?php _e('Remove', 'buddyboss'); ?></a>

		<?php
		if ( 'date_range' === 'contains' ) {
			global $wpdb;
			$bp = buddypress();
			$field_group_id = $wpdb->get_var( "SELECT group_id FROM {$bp->profile->table_name_fields} WHERE id = {$field->id} AND type != 'option' " );
			$is_repeater_enabled = 'on' == bp_xprofile_get_meta( $field_group_id, 'group', 'is_repeater_enabled' ) ? true : false;

			if ( $is_repeater_enabled ) {
				echo "<br><span class='bp_ps_col1'></span>&nbsp;&nbsp;";//for spacing
				echo "<em>". __( 'WARNING', 'buddyboss' ) ."</em>: " . __( 'You are adding a date field which is inside a repeater set. This will not work correctly in search.', 'buddyboss' );
				echo "<p></p>";//for spacing
			}
		}
		?>
	</div> <?php

	wp_die();
}

Changelog

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