public function edit_field_html(array $raw_properties = array()) { if (isset($raw_properties['user_id'])) { unset($raw_properties['user_id']); } // HTML5 required attribute. if (bp_get_the_profile_field_is_required()) { $raw_properties['required'] = 'required'; } $field = new BP_XProfile_Field(bp_get_the_profile_field_id()); $options = $field->get_children(true); if (count($options) > 0) { $step = 1 / pow(10, (int) $options[0]->name); } else { $step = 0.01; } $html = $this->get_edit_field_html_elements(array_merge(array('type' => 'number', 'step' => $step, 'value' => bp_get_the_profile_field_edit_value()), $raw_properties)); $label = sprintf('<label for="%s">%s%s</label>', bp_get_the_profile_field_input_name(), bp_get_the_profile_field_name(), bp_get_the_profile_field_is_required() ? ' ' . esc_html__('(required)', 'buddypress') : ''); // Label. echo apply_filters('bxcft_field_label', $label, bp_get_the_profile_field_id(), bp_get_the_profile_field_type(), bp_get_the_profile_field_input_name(), bp_get_the_profile_field_name(), bp_get_the_profile_field_is_required()); // Errors. do_action(bp_get_the_profile_field_errors_action()); // Input. ?> <input <?php echo $html; ?> /> <?php }
/** * Maps XProfile caps to built in WordPress caps * * @since 1.6 * * @param array $caps Capabilities for meta capability * @param string $cap Capability name * @param int $user_id User id * @param mixed $args Arguments * @uses get_post() To get the post * @uses get_post_type_object() To get the post type object * @uses apply_filters() Calls 'bp_map_meta_caps' with caps, cap, user id and * args * @return array Actual capabilities for meta capability */ function bp_xprofile_map_meta_caps($caps, $cap, $user_id, $args) { switch ($cap) { case 'bp_xprofile_change_field_visibility': $caps = array('exist'); // Must allow for logged-out users during registration // You may pass args manually: $field_id, $profile_user_id $field_id = isset($args[0]) ? (int) $args[0] : bp_get_the_profile_field_id(); $profile_user_id = isset($args[1]) ? (int) $args[1] : bp_displayed_user_id(); // Visibility on the fullname field is not editable if (1 == $field_id) { $caps[] = 'do_not_allow'; break; } // Has the admin disabled visibility modification for this field? if ('disabled' == bp_xprofile_get_meta($field_id, 'field', 'allow_custom_visibility')) { $caps[] = 'do_not_allow'; break; } // Friends don't let friends edit each other's visibility if ($profile_user_id != bp_displayed_user_id() && !bp_current_user_can('bp_moderate')) { $caps[] = 'do_not_allow'; break; } break; } return apply_filters('bp_xprofile_map_meta_caps', $caps, $cap, $user_id, $args); }
/** * Grant the 'bp_xprofile_change_field_visibility' cap to logged-out users. * * @since 2.7.1 * * @param bool $user_can * @param int $user_id * @param string $capability * @return bool */ function bp_xprofile_grant_bp_xprofile_change_field_visibility_for_logged_out_users($user_can, $user_id, $capability) { if ('bp_xprofile_change_field_visibility' === $capability && 0 === $user_id) { $field_id = bp_get_the_profile_field_id(); if ($field_id && ($field = xprofile_get_field($field_id))) { $user_can = 'allowed' === $field->allow_custom_visibility; } } return $user_can; }
/** * Maps XProfile caps to built in WordPress caps * * @since BuddyPress (1.6.0) * * @param array $caps Capabilities for meta capability * @param string $cap Capability name * @param int $user_id User id * @param mixed $args Arguments * @uses get_post() To get the post * @uses get_post_type_object() To get the post type object * @uses apply_filters() Calls 'bp_map_meta_caps' with caps, cap, user id and * args * @return array Actual capabilities for meta capability */ function bp_xprofile_map_meta_caps($caps, $cap, $user_id, $args) { switch ($cap) { case 'bp_xprofile_change_field_visibility': $caps = array('exist'); // Must allow for logged-out users during registration // You may pass args manually: $field_id, $profile_user_id $field_id = isset($args[0]) ? (int) $args[0] : bp_get_the_profile_field_id(); $profile_user_id = isset($args[1]) ? (int) $args[1] : bp_displayed_user_id(); // Visibility on the fullname field is not editable if (1 == $field_id) { $caps[] = 'do_not_allow'; break; } // Has the admin disabled visibility modification for this field? if ('disabled' == bp_xprofile_get_meta($field_id, 'field', 'allow_custom_visibility')) { $caps[] = 'do_not_allow'; break; } // Friends don't let friends edit each other's visibility if ($profile_user_id != bp_displayed_user_id() && !bp_current_user_can('bp_moderate')) { $caps[] = 'do_not_allow'; break; } break; } /** * Filters the XProfile caps to built in WordPress caps. * * @since BuddyPress (1.6.0) * * @param array $caps Capabilities for meta capability. * @param string $cap Capability name. * @param int $user_id User ID being mapped. * @param mixed $args Capability arguments. */ return apply_filters('bp_xprofile_map_meta_caps', $caps, $cap, $user_id, $args); }
public function edit_field_html(array $raw_properties = array()) { if (isset($raw_properties['user_id'])) { unset($raw_properties['user_id']); } // HTML5 required attribute. if (bp_get_the_profile_field_is_required()) { $raw_properties['required'] = 'required'; } $html = $this->get_edit_field_html_elements(array_merge(array('type' => 'url', 'value' => bp_get_the_profile_field_edit_value()), $raw_properties)); $label = sprintf('<label for="%s">%s%s</label>', bp_get_the_profile_field_input_name(), bp_get_the_profile_field_name(), bp_get_the_profile_field_is_required() ? ' ' . esc_html__('(required)', 'buddypress') : ''); // Label. echo apply_filters('bxcft_field_label', $label, bp_get_the_profile_field_id(), bp_get_the_profile_field_type(), bp_get_the_profile_field_input_name(), bp_get_the_profile_field_name(), bp_get_the_profile_field_is_required()); // Errors. do_action(bp_get_the_profile_field_errors_action()); // Input. ?> <input <?php echo $html; ?> /> <?php }
public function edit_field_html(array $raw_properties = array()) { if (isset($raw_properties['user_id'])) { unset($raw_properties['user_id']); } // HTML5 required attribute. if (bp_get_the_profile_field_is_required()) { $raw_properties['required'] = 'required'; } $field = new BP_XProfile_Field(bp_get_the_profile_field_id()); $args = array('type' => 'number', 'value' => bp_get_the_profile_field_edit_value()); $options = $field->get_children(true); if ($options) { foreach ($options as $o) { if (strpos($o->name, 'min_') !== false) { $args['min'] = str_replace('min_', '', $o->name); } if (strpos($o->name, 'max_') !== false) { $args['max'] = str_replace('max_', '', $o->name); } } } $html = $this->get_edit_field_html_elements(array_merge($args, $raw_properties)); $label = sprintf('<label for="%s">%s%s</label>', bp_get_the_profile_field_input_name(), bp_get_the_profile_field_name(), bp_get_the_profile_field_is_required() ? ' ' . esc_html__('(required)', 'buddypress') : ''); // Label. echo apply_filters('bxcft_field_label', $label, bp_get_the_profile_field_id(), bp_get_the_profile_field_type(), bp_get_the_profile_field_input_name(), bp_get_the_profile_field_name(), bp_get_the_profile_field_is_required()); // Errors. do_action(bp_get_the_profile_field_errors_action()); // Input. ?> <input <?php echo $html; ?> /> <?php }
public function edit_field_html(array $raw_properties = array()) { if (isset($raw_properties['user_id'])) { unset($raw_properties['user_id']); } $html = $this->get_edit_field_html_elements(array_merge(array('type' => 'file', 'accept' => 'image/*'), $raw_properties)); $uploads = wp_upload_dir(); // Label. $label = sprintf('<label for="%s">%s%s</label>', bp_get_the_profile_field_input_name(), bp_get_the_profile_field_name(), bp_get_the_profile_field_is_required() ? esc_html('(required)', 'buddypress') : ''); // Input file. $input = sprintf('<input type="hidden" name="%1$s" id="%1$s" value="%2$s" /><input %3$s />', bp_get_the_profile_field_input_name(), bp_get_the_profile_field_edit_value() != '' && bp_get_the_profile_field_edit_value() != '-' ? bp_get_the_profile_field_edit_value() : '-', $html); // Actual image. if (bp_get_the_profile_field_edit_value() != '' && bp_get_the_profile_field_edit_value() != '-') { $actual_image = sprintf('<img src="%1$s" alt="%2$s" /><label for="%2$s_deleteimg"><input type="checkbox" name="%2$s_deleteimg" id="%2$s_deleteimg" value="1" /> %3$s</label><input type="hidden" name="%2$s_hiddenimg" id="%2$s_hiddenimg" value="%4$s" />', $uploads['baseurl'] . bp_get_the_profile_field_edit_value(), bp_get_the_profile_field_input_name(), __('Check this to delete this image', 'bxcft'), bp_get_the_profile_field_edit_value()); } elseif (bp_get_profile_field_data(array('field' => bp_get_the_profile_field_id())) != '' && bp_get_profile_field_data(array('field' => bp_get_the_profile_field_id())) != '-') { $actual_image = sprintf('%1$s<label for="%2$s_deleteimg"><input type="checkbox" name="%2$s_deleteimg" id="%2$s_deleteimg" value="1" /> %3$s</label><input type="hidden" name="%2$s_hiddenimg" id="%2$s_hiddenimg" value="%4$s" />', strip_tags(bp_get_profile_field_data(array('field' => bp_get_the_profile_field_id()))), bp_get_the_profile_field_input_name(), __('Check this to delete this image', 'bxcft'), isset($_POST['field_' . bp_get_the_profile_field_id() . '_hiddenimg']) ? $_POST['field_' . bp_get_the_profile_field_id() . '_hiddenimg'] : ''); } else { $actual_image = ''; } echo apply_filters('bxcft_field_label', $label, bp_get_the_profile_field_id(), bp_get_the_profile_field_type(), bp_get_the_profile_field_input_name(), bp_get_the_profile_field_name(), bp_get_the_profile_field_is_required()); do_action(bp_get_the_profile_field_errors_action()); echo apply_filters('bxcft_field_input', $input, bp_get_the_profile_field_id(), bp_get_the_profile_field_type(), bp_get_the_profile_field_input_name(), bp_get_the_profile_field_is_required()); echo apply_filters('bxcft_field_actual_image', $actual_image, bp_get_the_profile_field_id(), bp_get_the_profile_field_type(), bp_get_the_profile_field_input_name(), bp_get_the_profile_field_edit_value()); ?> <script type="text/javascript"> if (jQuery('#profile-edit-form').length > 0) { jQuery('#profile-edit-form').attr('enctype', 'multipart/form-data'); } if (jQuery('#your-profile').length > 0) { jQuery('#your-profile').attr('enctype', 'multipart/form-data'); } <?php if (bp_get_the_profile_field_edit_value() != '' && bp_get_the_profile_field_edit_value() != '-') { ?> jQuery('#field_<?php echo bp_get_the_profile_field_id(); ?> _deleteimg').change(function() { if (jQuery(this).is(':checked') && jQuery('input#field_<?php echo bp_get_the_profile_field_id(); ?> [type=file]').val() === '') { jQuery('input#field_<?php echo bp_get_the_profile_field_id(); ?> [type=hidden]').val(''); } else { jQuery('input#field_<?php echo bp_get_the_profile_field_id(); ?> [type=hidden]').val('<?php echo bp_get_the_profile_field_edit_value(); ?> '); } }); <?php } ?> jQuery('input#field_<?php echo bp_get_the_profile_field_id(); ?> [type=file]').change(function() { if (jQuery(this).val() !== '') { jQuery('input#field_<?php echo bp_get_the_profile_field_id(); ?> [type=hidden]').val('-'); } else { jQuery('input#field_<?php echo bp_get_the_profile_field_id(); ?> [type=hidden]').val(''); } }); </script> <?php }
?> "> <?php /** * added conditional because "public" visability was removed */ if (bp_get_the_profile_field_id() != '1') { ?> <?php printf(__('2 - Visibility cannot be changed. Visible to: <span class="current-visibility-level">%s</span>', 'buddypress'), $obj_bp_ev->ez_bp_get_the_profile_field_visibility_level_label($str_field_ev)); ?> <?php } else { echo '<p class="field-visibility-settings-toggle" id="field-visibility-settings-toggle-' . bp_get_the_profile_field_id() . '">'; printf(__('3 - Visibility cannot be changed. Visible to: <span class="current-visibility-level">All See</span>', 'buddypress'), ''); echo '</p>'; ?> <?php } ?> </div> <?php } ?> <?php do_action('bp_custom_profile_edit_fields'); ?>
public static function form_settings_xprofile_fields($gmw_forms, $formID, $section, $option) { global $bp; if (!bp_is_active('xprofile')) { _e('Buddypress xprofile fields component is deactivated. You will need to activate in in order to use this feature.', 'GMW'); return; } if (function_exists('bp_has_profile')) { if (bp_has_profile('hide_empty_fields=0')) { $dateboxes = array(); $dateboxes[0] = ''; while (bp_profile_groups()) { bp_the_profile_group(); while (bp_profile_fields()) { bp_the_profile_field(); if (bp_get_the_profile_field_type() == 'datebox' || bp_get_the_profile_field_type() == 'birthdate') { $dateboxes[] = bp_get_the_profile_field_id(); } else { $field_id = bp_get_the_profile_field_id(); ?> <input type="checkbox" name="<?php echo 'gmw_forms[' . $formID . '][' . $section . '][profile_fields][]'; ?> " value="<?php echo $field_id; ?> " <?php if (isset($gmw_forms[$formID][$section]['profile_fields']) && in_array($field_id, $gmw_forms[$formID][$section]['profile_fields'])) { echo ' checked=checked'; } ?> /> <label><?php bp_the_profile_field_name(); ?> </label> <br /> <?php } } } ?> <label><strong style="margin:5px 0px;float:left;width:100%"><?php _e('Choose the "Age Range" Field', 'GMW'); ?> </strong></label><br /> <select name="<?php echo 'gmw_forms[' . $formID . '][' . $section . '][profile_fields_date]'; ?> "> <?php foreach ($dateboxes as $datebox) { $field = new BP_XProfile_Field($datebox); $selected = $gmw_forms[$formID][$section]['profile_fields_date'] == $datebox ? 'selected="selected"' : ''; ?> <option value="<?php echo $datebox; ?> " <?php echo $selected; ?> ><?php echo $field->name; ?> </option> <?php } ?> </select> <?php } } }
?> </h4> <table class="form-table"> <?php while (bp_profile_fields()) { bp_the_profile_field(); ?> <?php /* Setup field classes. */ $bp_classes = array(); $bp_classes[] = 'field_' . bp_get_the_profile_field_id(); $bp_classes[] = 'field_' . sanitize_title(bp_get_the_profile_field_name()); if (bp_get_the_profile_field_is_required()) { $bp_classes[] = 'bp-field-required'; $bp_classes[] = 'field_' . bp_get_the_profile_field_id() . '_required'; $bp_classes[] = 'field_' . sanitize_title(bp_get_the_profile_field_name()) . '_required'; } $css_classes = ' class="' . implode(' ', $bp_classes) . '"'; ?> <tr style='background: transparent;' <?php echo $css_classes; ?> > <th><label for="<?php bp_the_profile_field_input_name(); ?> "><?php bp_the_profile_field_name();
/** * Return the XProfile field visibility select list for settings * * @since BuddyPress (2.0.0) */ function bp_profile_get_settings_visibility_select($args = '') { // Parse optional arguments $r = bp_parse_args($args, array('field_id' => bp_get_the_profile_field_id(), 'before' => '', 'after' => '', 'class' => 'bp-xprofile-visibility'), 'xprofile_settings_visibility_select'); // Empty return value, filled in below if a valid field ID is found $retval = ''; // Only do-the-do if there's a valid field ID if (!empty($r['field_id'])) { // Start the output buffer ob_start(); // Output anything before echo $r['before']; ?> <?php if (bp_current_user_can('bp_xprofile_change_field_visibility')) { ?> <label for="<?php echo esc_attr('field_' . $r['field_id']); ?> _visibility" class="bp-screen-reader-text"><?php _e('Select visibility', 'buddypress'); ?> </label> <select class="<?php echo esc_attr($r['class']); ?> " name="<?php echo esc_attr('field_' . $r['field_id']); ?> _visibility" id="<?php echo esc_attr('field_' . $r['field_id']); ?> _visibility"> <?php foreach (bp_xprofile_get_visibility_levels() as $level) { ?> <option value="<?php echo esc_attr($level['id']); ?> " <?php selected($level['id'], bp_get_the_profile_field_visibility_level()); ?> ><?php echo esc_html($level['label']); ?> </option> <?php } ?> </select> <?php } else { ?> <span class="field-visibility-settings-notoggle" title="<?php esc_attr_e("This field's visibility cannot be changed.", 'buddypress'); ?> "><?php bp_the_profile_field_visibility_level_label(); ?> </span> <?php } // Output anything after echo $r['after']; // Get the output buffer and empty it $retval = ob_get_clean(); } /** * Filters the dropdown list for setting visibility. * * @since BuddyPress (2.0.0) * * @param string $retval HTML output for the visibility dropdown list. * @param array $r Parsed arguments to be used with display. * @param array $args Original passed in arguments to be used with display. */ return apply_filters('bp_profile_settings_visibility_select', $retval, $r, $args); }
function buddyboss_customizer_xprofile_field_choices() { $options = array(); if (function_exists('bp_is_active')) { if (bp_is_active('xprofile') && bp_has_profile(array('user_id' => bp_loggedin_user_id()))) { while (bp_profile_groups()) { bp_the_profile_group(); if (bp_profile_group_has_fields()) { while (bp_profile_fields()) { bp_the_profile_field(); $options[bp_get_the_profile_field_id()] = bp_get_the_profile_field_name(); } } } } } return $options; }
public function edit_field_html(array $raw_properties = array()) { $this->_edit_field_html($raw_properties); bp_xprofile_member_type_field_helper()->set_shown(bp_get_the_profile_field_id()); }
/** * Return the 'required' markup in extended profile field labels. * * @since 2.4.0 * * @return string HTML for the required label. */ function bp_get_the_profile_field_required_label() { $retval = ''; if (bp_get_the_profile_field_is_required()) { $translated_string = __('(required)', 'buddypress'); $retval = ' <span class="bp-required-field-label">'; $retval .= apply_filters('bp_get_the_profile_field_required_label', $translated_string, bp_get_the_profile_field_id()); $retval .= '</span>'; } return $retval; }
function bp_the_profile_field_id() { echo bp_get_the_profile_field_id(); }
/** * Output HTML for this field type on the wp-admin Profile Fields screen. * * Must be used inside the {@link bp_profile_fields()} template loop. * * @since 2.0.0 * * @param array $raw_properties Optional key/value array of permitted attributes that you want to add. */ public function admin_field_html(array $raw_properties = array()) { $richtext_enabled = bp_xprofile_is_richtext_enabled_for_field(); if (!$richtext_enabled) { $r = bp_parse_args($raw_properties, array('cols' => 40, 'rows' => 5)); ?> <textarea <?php echo $this->get_edit_field_html_elements($r); ?> ></textarea> <?php } else { /** This filter is documented in bp-xprofile/classes/class-bp-xprofile-field-type-textarea.php */ $editor_args = apply_filters('bp_xprofile_field_type_textarea_editor_args', array('teeny' => true, 'media_buttons' => false, 'quicktags' => true, 'textarea_rows' => 1), 'admin'); wp_editor('', 'xprofile_textarea_' . bp_get_the_profile_field_id(), $editor_args); } }
public function may_be_show_field() { $field_id = bp_get_the_profile_field_id(); if (!$this->was_shown($field_id) && in_array(bp_get_the_profile_field_type(), $this->field_types)) { $field_type = bp_xprofile_create_field_type(bp_get_the_profile_field_type()); $field_type->edit_field_html(); } }
</div> <?php } ?> <?php do_action('bp_custom_profile_edit_fields'); ?> <p class="description"><?php bp_the_profile_field_description(); ?> </p> </div> <?php $field_ids[] = bp_get_the_profile_field_id(); ?> <?php } ?> <?php do_action('bp_after_profile_field_content'); ?> </div><!-- end of step --> <?php } ?>
<?php } else { if (bp_get_the_profile_field_id() == 24) { ?> <h2>Professional Affiliations</h2> <div class="explanatory-text"> <p>Please provide any current professional affiliation(s), such as any institutions where you work, teach, or freelance, or any publications to which you contribute. Enter as many affiliations as needed.</p> </div> <?php } else { if (bp_get_the_profile_field_id() == 6) { ?> <h2>Research</h2> <?php } else { if (bp_get_the_profile_field_id() == 9) { ?> <h2>Mailing Address</h2> <div class="explanatory-text"> <p>Enter an optional address (work, home, or other) where you would like to receive professional correspondence.</p> </div> <?php } } } } ?> <div<?php bp_field_css_class('editfield');
public function edit_field_html(array $raw_properties = array()) { $user_id = bp_displayed_user_id(); // user_id is a special optional parameter that we pass to {@link bp_the_profile_field_options()}. if (isset($raw_properties['user_id'])) { $user_id = (int) $raw_properties['user_id']; unset($raw_properties['user_id']); } // HTML5 required attribute. if (bp_get_the_profile_field_is_required()) { $raw_properties['required'] = 'required'; } $day_html = $this->get_edit_field_html_elements(array_merge(array('id' => bp_get_the_profile_field_input_name() . '_day', 'name' => bp_get_the_profile_field_input_name() . '_day'), $raw_properties)); $month_html = $this->get_edit_field_html_elements(array_merge(array('id' => bp_get_the_profile_field_input_name() . '_month', 'name' => bp_get_the_profile_field_input_name() . '_month'), $raw_properties)); $year_html = $this->get_edit_field_html_elements(array_merge(array('id' => bp_get_the_profile_field_input_name() . '_year', 'name' => bp_get_the_profile_field_input_name() . '_year'), $raw_properties)); $label = sprintf('<label for="%s_day">%s%s</label>', bp_get_the_profile_field_input_name(), bp_get_the_profile_field_name(), bp_get_the_profile_field_is_required() ? ' ' . esc_html__('(required)', 'buddypress') : ''); // Label. echo apply_filters('bxcft_field_label', $label, bp_get_the_profile_field_id(), bp_get_the_profile_field_type(), bp_get_the_profile_field_input_name(), bp_get_the_profile_field_name(), bp_get_the_profile_field_is_required()); // Errors do_action(bp_get_the_profile_field_errors_action()); // Input. ?> <select <?php echo $day_html; ?> > <?php bp_the_profile_field_options(array('type' => 'day', 'user_id' => $user_id)); ?> </select> <select <?php echo $month_html; ?> > <?php bp_the_profile_field_options(array('type' => 'month', 'user_id' => $user_id)); ?> </select> <select <?php echo $year_html; ?> > <?php bp_the_profile_field_options(array('type' => 'year', 'user_id' => $user_id)); ?> </select> <?php }
/** * Return the field visibility radio buttons */ function bp_profile_get_visibility_radio_buttons() { $html = '<ul class="radio">'; foreach (bp_xprofile_get_visibility_levels() as $level) { $checked = $level['id'] == bp_get_the_profile_field_visibility_level() ? ' checked="checked" ' : ''; $html .= '<li><label for="see-field_' . esc_attr($level['id']) . '"><input type="radio" id="see-field_' . esc_attr($level['id']) . '" name="field_' . bp_get_the_profile_field_id() . '_visibility" value="' . esc_attr($level['id']) . '"' . $checked . ' /> ' . esc_html($level['label']) . '</label></li>'; } $html .= '</ul>'; return apply_filters('bp_profile_get_visibility_radio_buttons', $html); }
/** * Return the XProfile field visibility select list for settings * * @since BuddyPress (2.0.0) */ function bp_profile_get_settings_visibility_select($args = '') { // Parse optional arguments $r = bp_parse_args($args, array('field_id' => bp_get_the_profile_field_id(), 'before' => '', 'after' => '', 'class' => 'bp-xprofile-visibility'), 'xprofile_settings_visibility_select'); // Empty return value, filled in below if a valid field ID is found $retval = ''; // Only do-the-do if there's a valid field ID if (!empty($r['field_id'])) { // Start the output buffer ob_start(); // Output anything before echo $r['before']; ?> <?php if (bp_current_user_can('bp_xprofile_change_field_visibility')) { ?> <select class="<?php echo esc_attr($r['class']); ?> " name="<?php echo esc_attr('field_' . $r['field_id']); ?> _visibility"> <?php foreach (bp_xprofile_get_visibility_levels() as $level) { ?> <option value="<?php echo esc_attr($level['id']); ?> " <?php selected($level['id'], bp_get_the_profile_field_visibility_level()); ?> ><?php echo esc_html($level['label']); ?> </option> <?php } ?> </select> <?php } else { ?> <span class="field-visibility-settings-notoggle" title="<?php esc_attr_e("This field's visibility cannot be changed.", 'buddypress'); ?> "><?php bp_the_profile_field_visibility_level_label(); ?> </span> <?php } // Output anything after echo $r['after']; // Get the output buffer and empty it $retval = ob_get_clean(); } // Output the dropdown list return apply_filters('bp_profile_settings_visibility_select', $retval, $r, $args); }
/** * Is rich text enabled for this profile field? * * By default, rich text is enabled for textarea fields and disabled for all other field types. * * @since 2.4.0 * * @param int|null $field_id Optional. Default current field ID. * @return bool */ function bp_xprofile_is_richtext_enabled_for_field($field_id = null) { if (!$field_id) { $field_id = bp_get_the_profile_field_id(); } $field = xprofile_get_field($field_id); $enabled = false; if ($field instanceof BP_XProfile_Field) { $enabled = (bool) $field->type_obj->supports_richtext; } /** * Filters whether richtext is enabled for the given field. * * @since 2.4.0 * * @param bool $enabled True if richtext is enabled for the field, otherwise false. * @param int $field_id ID of the field. */ return apply_filters('bp_xprofile_is_richtext_enabled_for_field', $enabled, $field_id); }
/** * Return the field visibility radio buttons */ function ez_bp_profile_get_visibility_radio_buttons($arr_args = '') { global $field; $arr_ev_levels_processed = $this->_arr_ev_levels_processed; $str_ev_level = $this->ez_bp_get_the_profile_field_visibility_level(); $str_field_edit = $arr_ev_levels_processed[$str_ev_level]['edit']; $str_field_viz = $arr_ev_levels_processed[$str_ev_level]['visible']; // Parse optional arguments $r = bp_parse_args($arr_args, array('field_id' => bp_get_the_profile_field_id(), 'before' => '<ul class="radio">', 'after' => '</ul>', 'before_radio' => '<li>', 'after_radio' => '</li>', 'class' => 'bp-xprofile-visibility'), 'xprofile_visibility_radio_buttons'); // Empty return value, filled in below if a valid field ID is found $retval = ''; // Only do-the-do if there's a valid field ID if (!empty($r['field_id'])) { // Start the output buffer ob_start(); // Output anything before echo $r['before']; ?> <?php if (bp_current_user_can('bp_xprofile_change_field_visibility')) { ?> <?php $str_label_needle = ':'; foreach (bp_xprofile_get_visibility_levels() as $level) { $str_edit = $this->get_level_edit($level['id']); $str_viz = $this->get_level_visible($level['id']); if ($str_edit == $str_field_edit) { echo $r['before_radio']; ?> <label for="<?php echo esc_attr('see-field_' . $r['field_id'] . '_' . $level['id']); ?> "> <input type="radio" id="<?php echo esc_attr('see-field_' . $r['field_id'] . '_' . $level['id']); ?> " name="<?php echo esc_attr('field_' . $r['field_id'] . '_visibility'); ?> " value="<?php echo esc_attr($level['id']); ?> " <?php checked($level['id'], bp_get_the_profile_field_visibility_level()); ?> /> <span class="field-visibility-text"><?php echo esc_html($this->ez_bp_get_the_profile_field_visibility_level_label($level['id'])); ?> </span> </label> <?php echo $r['after_radio']; } ?> <?php } ?> <?php } // Output anything after echo $r['after']; // Get the output buffer and empty it $retval = ob_get_clean(); } return apply_filters('bp_profile_get_visibility_radio_buttons', $retval, $r, $arr_args); }