bp_ps_fields_box( $post )
Output BuddyBoss profile search admin settings.
Description
Source
File: bp-core/profile-search/bps-admin.php
function bp_ps_fields_box ( $post ) { $bp_ps_options = bp_ps_meta ( $post->ID ); list ($groups, $fields) = bp_ps_get_fields (); echo '<script>var bp_ps_groups = ['. json_encode ($groups). '];</script>'; ?> <div id="field_box" class="field_box"> <p> <span class="bp_ps_col1"></span> <span class="bp_ps_col2"><strong> <?php _e('Field', 'buddyboss'); ?></strong></span> <span class="bp_ps_col3"><strong> <?php _e('Label', 'buddyboss'); ?></strong></span> <span class="bp_ps_col4"><strong> <?php _e('Description', 'buddyboss'); ?></strong></span> <span class="bp_ps_col5"><strong> <?php _e('Search Mode', 'buddyboss'); ?></strong></span> </p> <input type="hidden" id="empty-box-alert" name="empty-box-alert" value="<?php _e('You cannot remove this field, you must have at least one field to use this feature. To disable search navigate to Dashboard->BuddyBoss->Settings->Profiles.', 'buddyboss'); ?>"> <?php foreach ($bp_ps_options['field_code'] as $k => $id) { if (empty ($fields[$id])) continue; $field = $fields[$id]; $label = esc_attr ($bp_ps_options['field_label'][$k]); $default = esc_attr ($field->name); $showlabel = empty ($label)? "placeholder=\"$default\"": "value=\"$label\""; $desc = esc_attr ($bp_ps_options['field_desc'][$k]); $default = esc_attr ($field->description); $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'); ?>"> ⇅</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", $bp_ps_options['field_mode'][$k]); } 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' == $bp_ps_options['field_mode'][$k] ) { 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> ";//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 } ?> </div> <input type="hidden" id="field_next" value="<?php echo count ($bp_ps_options['field_code']); ?>" /> <p><a href="javascript:add_field()"><?php _e('Add Field', 'buddyboss'); ?></a></p> <?php }
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.