/** * bp_the_profile_field_options() * * Displays field options HTML for field types of 'selectbox', 'multiselectbox', * 'radio', 'checkbox', and 'datebox'. * * @package BuddyPress Xprofile * @since 1.1 * * @uses bp_get_the_profile_field_options() * * @param array $args Specify type for datebox. Allowed 'day', 'month', 'year'. */ function bp_the_profile_field_options($args = '') { echo bp_get_the_profile_field_options($args); }
/** * Renders Buddypress profile field * * @param object $bp_field. * @param boolean $returm. * @author peshkov@UD */ protected function render_bp_field($bp_field, $return = false) { global $field; $field = $bp_field; $type = bp_get_the_profile_field_type(); ob_start(); switch ($type) { case 'textbox': ?> <div class="bp textbox"> <input type="text" name="bp[<?php bp_the_profile_field_input_name(); ?> ]" id="<?php bp_the_profile_field_input_name(); ?> " value="<?php bp_the_profile_field_edit_value(); ?> " <?php if (bp_get_the_profile_field_is_required()) { ?> aria-required="true"<?php } ?> /> </div> <?php break; case 'textarea': ?> <div class="bp textarea"> <textarea rows="5" cols="40" name="bp[<?php bp_the_profile_field_input_name(); ?> ]" id="<?php bp_the_profile_field_input_name(); ?> " <?php if (bp_get_the_profile_field_is_required()) { ?> aria-required="true"<?php } ?> ><?php bp_the_profile_field_edit_value(); ?> </textarea> </div> <?php break; case 'selectbox': ?> <div class="bp selectbox"> <select name="bp[<?php bp_the_profile_field_input_name(); ?> ]" id="<?php bp_the_profile_field_input_name(); ?> " <?php if (bp_get_the_profile_field_is_required()) { ?> aria-required="true"<?php } ?> > <?php bp_the_profile_field_options(); ?> </select> </div> <?php break; case 'multiselectbox': $input_type = bp_get_the_profile_field_input_name(); preg_match('/field_[0-9]+/', $input_type, $matches); if ($matches) { $input_type = $matches[0]; } ?> <div class="bp multiselectbox"> <select name="bp[<?php echo $input_type; ?> ][]" id="<?php echo $input_type; ?> " multiple="multiple" <?php if (bp_get_the_profile_field_is_required()) { ?> aria-required="true"<?php } ?> > <?php bp_the_profile_field_options(); ?> </select> <?php if (!bp_get_the_profile_field_is_required()) { ?> <a class="bp-clear-value" href="javascript:bp_clear_profile_field( '<?php echo $input_type; ?> ' );"><?php _e('Clear', ud_get_wp_crm()->domain); ?> </a> <?php } ?> </div> <?php break; case 'radio': ?> <div class="bp radio"> <?php $options = bp_get_the_profile_field_options(); $options = preg_replace('/(name=[\\"\'])(field\\_[0-9]+)/', '$1bp[$2]', $options); echo $options; ?> <?php if (!bp_get_the_profile_field_is_required()) { ?> <a class="bp-clear-value" href="javascript:bp_clear_profile_field( '<?php bp_the_profile_field_input_name(); ?> ' );"><?php _e('Clear', ud_get_wp_crm()->domain); ?> </a> <?php } ?> </div> <?php break; case 'checkbox': ?> <div class="bp checkbox"> <?php $options = bp_get_the_profile_field_options(); $options = preg_replace('/(name=[\\"\'])(field\\_[0-9]+)/', '$1bp[$2]', $options); echo $options; ?> </div> <?php break; case 'datebox': ?> <div class="bp datebox"> <select name="bp[<?php bp_the_profile_field_input_name(); ?> _day]" id="<?php bp_the_profile_field_input_name(); ?> _day" <?php if (bp_get_the_profile_field_is_required()) { ?> aria-required="true"<?php } ?> > <?php bp_the_profile_field_options('type=day'); ?> </select> <select name="bp[<?php bp_the_profile_field_input_name(); ?> _month]" id="<?php bp_the_profile_field_input_name(); ?> _month" <?php if (bp_get_the_profile_field_is_required()) { ?> aria-required="true"<?php } ?> > <?php bp_the_profile_field_options('type=month'); ?> </select> <select name="bp[<?php bp_the_profile_field_input_name(); ?> _year]" id="<?php bp_the_profile_field_input_name(); ?> _year" <?php if (bp_get_the_profile_field_is_required()) { ?> aria-required="true"<?php } ?> > <?php bp_the_profile_field_options('type=year'); ?> </select> </div> <?php break; } $return = ob_get_contents(); ob_end_clean(); if ($return) { return $return; } else { echo $return; } }