本文整理汇总了PHP中bp_get_the_profile_field_type函数的典型用法代码示例。如果您正苦于以下问题:PHP bp_get_the_profile_field_type函数的具体用法?PHP bp_get_the_profile_field_type怎么用?PHP bp_get_the_profile_field_type使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bp_get_the_profile_field_type函数的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: user_admin_profile_metaboxes
/**
* Render the xprofile metabox for Community Profile screen.
*
* @since 2.0.0
*
* @param WP_User|null $user The WP_User object for the user being edited.
* @param array $args Aray of arguments for metaboxes.
*/
public function user_admin_profile_metaboxes($user = null, $args = array())
{
// Bail if no user ID.
if (empty($user->ID)) {
return;
}
$r = bp_parse_args($args['args'], array('profile_group_id' => 0, 'user_id' => $user->ID), 'bp_xprofile_user_admin_profile_loop_args');
// We really need these args.
if (empty($r['profile_group_id']) || empty($r['user_id'])) {
return;
}
// Bail if no profile fields are available.
if (!bp_has_profile($r)) {
return;
}
// Loop through profile groups & fields.
while (bp_profile_groups()) {
bp_the_profile_group();
?>
<input type="hidden" name="field_ids[]" id="<?php
echo esc_attr('field_ids_' . bp_get_the_profile_group_slug());
?>
" value="<?php
echo esc_attr(bp_get_the_profile_group_field_ids());
?>
" />
<?php
if (bp_get_the_profile_group_description()) {
?>
<p class="description"><?php
bp_the_profile_group_description();
?>
</p>
<?php
}
?>
<?php
while (bp_profile_fields()) {
bp_the_profile_field();
?>
<div<?php
bp_field_css_class('bp-profile-field');
?>
>
<?php
$field_type = bp_xprofile_create_field_type(bp_get_the_profile_field_type());
$field_type->edit_field_html(array('user_id' => $r['user_id']));
if (bp_get_the_profile_field_description()) {
?>
<p class="description"><?php
bp_the_profile_field_description();
?>
</p>
<?php
}
/**
* Fires before display of visibility form elements for profile metaboxes.
*
* @since 1.7.0
*/
do_action('bp_custom_profile_edit_fields_pre_visibility');
$can_change_visibility = bp_current_user_can('bp_xprofile_change_field_visibility');
?>
<p class="field-visibility-settings-<?php
echo $can_change_visibility ? 'toggle' : 'notoggle';
?>
" id="field-visibility-settings-toggle-<?php
bp_the_profile_field_id();
?>
">
<?php
printf(__('This field can be seen by: %s', 'buddypress'), '<span class="current-visibility-level">' . bp_get_the_profile_field_visibility_level_label() . '</span>');
?>
<?php
if ($can_change_visibility) {
?>
<a href="#" class="button visibility-toggle-link"><?php
esc_html_e('Change', 'buddypress');
?>
//.........这里部分代码省略.........
开发者ID:igniterealtime,项目名称:community-plugins,代码行数:101,代码来源:class-bp-xprofile-user-admin.php
示例2: edit_field_html
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
}
开发者ID:baden03,项目名称:buddypress-xprofile-custom-fields-type,代码行数:30,代码来源:Bxcft_Field_Type_DecimalNumber.php
示例3: edit_field_html
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
}
开发者ID:baden03,项目名称:buddypress-xprofile-custom-fields-type,代码行数:23,代码来源:Bxcft_Field_Type_Web.php
示例4: edit_field_html
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
}
开发者ID:baden03,项目名称:buddypress-xprofile-custom-fields-type,代码行数:36,代码来源:Bxcft_Field_Type_NumberMinMax.php
示例5: bp_the_profile_field_type
function bp_the_profile_field_type()
{
echo bp_get_the_profile_field_type();
}
开发者ID:newington,项目名称:buddypress,代码行数:4,代码来源:bp-xprofile-template.php
示例6: edit_field_html
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
}
开发者ID:npire,项目名称:buddypress-xprofile-custom-fields-type,代码行数:78,代码来源:Bxcft_Field_Type_Image.php
示例7: form_settings_xprofile_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
}
}
}
开发者ID:WP-Panda,项目名称:allergenics,代码行数:74,代码来源:gmw-fl-admin.php
示例8: bp_the_profile_field_input_name
_year" id="<?php
bp_the_profile_field_input_name();
?>
_year">
<?php
bp_the_profile_field_options('type=year');
?>
</select>
</div>
<?php
}
?>
<?php
if ('url' == bp_get_the_profile_field_type()) {
?>
<label for="<?php
bp_the_profile_field_input_name();
?>
"><?php
bp_the_profile_field_name();
?>
<?php
if (bp_get_the_profile_field_is_required()) {
_e('(required)', 'buddypress');
}
?>
</label>
<input type="text" name="<?php
开发者ID:mawilliamson,项目名称:wordpress,代码行数:31,代码来源:register.php
示例9: bp_ajax_register_form_function
//.........这里部分代码省略.........
<?php
/***** Extra Profile Details ******/
?>
<?php
if (bp_is_active('xprofile')) {
?>
<?php
do_action('bp_before_signup_profile_fields');
?>
<div class="register-section ajax-register-section" id="profile-details-section">
<?php
/* Use the profile field loop to render input fields for the 'base' profile field group */
?>
<?php
if (bp_is_active('xprofile')) {
if (bp_has_profile('profile_group_id=1&hide_empty_fields=0')) {
while (bp_profile_groups()) {
bp_the_profile_group();
?>
<?php
while (bp_profile_fields()) {
bp_the_profile_field();
?>
<div class="ctrlHolder fullwidth">
<?php
if ('textbox' == bp_get_the_profile_field_type()) {
?>
<label for="<?php
bp_the_profile_field_input_name();
?>
"><?php
bp_the_profile_field_name();
?>
<?php
if (bp_get_the_profile_field_is_required()) {
_e('', 'buddypress');
}
?>
</label>
<div id="<?php
bp_the_profile_field_input_name();
?>
_error" class="error"></div>
<input type="text" name="<?php
bp_the_profile_field_input_name();
?>
" id="<?php
bp_the_profile_field_input_name();
?>
" value="<?php
bp_the_profile_field_edit_value();
?>
" />
<?php
}
?>
开发者ID:hscale,项目名称:webento,代码行数:67,代码来源:bp-ajax.registration.php
示例10: _render_buddypress_account_extra_fields
/**
* Renders BuddyPress account extra fields.
*
* @since 3.5
*
* @access private
*/
private function _render_buddypress_account_extra_fields()
{
if (!bp_is_active('xprofile')) {
return;
}
do_action('bp_before_signup_profile_fields');
?>
<div class="register-section" id="profile-details-section">
<h4><?php
_e('Profile Details', 'membership');
?>
</h4>
<?php
if (bp_has_profile('profile_group_id=1&hide_empty_fields=0')) {
?>
<?php
while (bp_profile_groups()) {
bp_the_profile_group();
?>
<?php
while (bp_profile_fields()) {
bp_the_profile_field();
?>
<?php
$field_name = bp_get_the_profile_field_input_name();
?>
<?php
$field_name_esc = esc_attr($field_name);
?>
<?php
$field_type = bp_get_the_profile_field_type();
?>
<div class="editfield">
<?php
if ('textbox' == $field_type) {
?>
<label for="<?php
echo $field_name_esc;
?>
">
<?php
if (bp_get_the_profile_field_is_required()) {
?>
<?php
printf(_x('%s (required)', '{Profile field} (required)', 'membership'), bp_get_the_profile_field_name());
?>
<?php
} else {
?>
<?php
bp_the_profile_field_name();
?>
<?php
}
?>
</label>
<?php
do_action("bp_{$field_name}_errors");
?>
<input type="text" name="<?php
echo $field_name_esc;
?>
" id="<?php
echo $field_name_esc;
?>
" value="<?php
bp_the_profile_field_edit_value();
?>
" />
<?php
}
?>
<?php
if ('textarea' == $field_type) {
?>
<label for="<?php
echo $field_name_esc;
?>
">
<?php
if (bp_get_the_profile_field_is_required()) {
?>
<?php
printf(_x('%s (required)', '{Profile field} (required)', 'membership'), bp_get_the_profile_field_name());
?>
<?php
} else {
?>
<?php
//.........这里部分代码省略.........
开发者ID:vilmark,项目名称:vilmark_main,代码行数:101,代码来源:Standard.php
示例11: may_be_show_field
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();
}
}
开发者ID:buddydev,项目名称:bp-xprofile-member-type-field,代码行数:8,代码来源:bp-xprofile-member-type-field-loader.php
示例12: render_xprofile_field
/**
* Generates the HTML code for a single XProfile input field.
*
* Code is taken from the BuddyPress default theme file:
* plugins/buddypress/bp-themes/bp-default/registration/register.php
*
* @since 1.0.1.0
* @param int $field_id The XProfile field ID.
* @param mixed $field_value Value of the field.
* @return string The HTML code to display the field.
*/
public function render_xprofile_field($field_id, $field_value = null, $visibility = false)
{
global $field;
$field = xprofile_get_field($field_id);
ob_start();
?>
<div class="ms-form-element ms-form-element-xprofile editfield field-<?php
echo $field_id;
?>
">
<?php
if ('textarea' == bp_get_the_profile_field_type()) {
?>
<label for="<?php
bp_the_profile_field_input_name();
?>
"><?php
bp_the_profile_field_name();
?>
<?php
if (bp_get_the_profile_field_is_required()) {
_e('(required)', 'buddypress');
}
?>
</label>
<?php
do_action(bp_get_the_profile_field_errors_action());
?>
<textarea rows="5" cols="40" name="<?php
bp_the_profile_field_input_name();
?>
" id="<?php
bp_the_profile_field_input_name();
?>
"><?php
bp_the_profile_field_edit_value();
?>
</textarea>
<?php
} elseif ('selectbox' == bp_get_the_profile_field_type()) {
?>
<label for="<?php
bp_the_profile_field_input_name();
?>
"><?php
bp_the_profile_field_name();
?>
<?php
if (bp_get_the_profile_field_is_required()) {
_e('(required)', 'buddypress');
}
?>
</label>
<?php
do_action(bp_get_the_profile_field_errors_action());
?>
<select name="<?php
bp_the_profile_field_input_name();
?>
" id="<?php
bp_the_profile_field_input_name();
?>
">
<?php
bp_the_profile_field_options();
?>
</select>
<?php
} elseif ('multiselectbox' == bp_get_the_profile_field_type()) {
?>
<label for="<?php
bp_the_profile_field_input_name();
?>
"><?php
bp_the_profile_field_name();
?>
<?php
if (bp_get_the_profile_field_is_required()) {
_e('(required)', 'buddypress');
}
?>
</label>
<?php
//.........这里部分代码省略.........
开发者ID:jsandlin85,项目名称:SkylineSports,代码行数:101,代码来源:class-ms-addon-profilefields.php
示例13: edit_field_html
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
}
开发者ID:baden03,项目名称:buddypress-xprofile-custom-fields-type,代码行数:50,代码来源:Bxcft_Field_Type_Birthdate.php
示例14: while
?>
<div class="clear"></div>
<?php
while (bp_profile_fields()) {
bp_the_profile_field();
?>
<div<?php
bp_field_css_class('editfield');
?>
>
<?php
$field_type = bp_xprofile_create_field_type(bp_get_the_profile_field_type());
$field_type->edit_field_html();
/**
* Fires before the display of visibility options for the field.
*
* @since 1.7.0
*/
do_action('bp_custom_profile_edit_fields_pre_visibility');
?>
<?php
if (bp_current_user_can('bp_xprofile_change_field_visibility')) {
?>
<p class="field-visibility-settings-toggle" id="field-visibility-settings-toggle-<?php
bp_the_profile_field_id();
?>
开发者ID:CompositeUK,项目名称:clone.BuddyPress,代码行数:31,代码来源:edit.php
示例15: render_bp_field
/**
* 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
}
//.........这里部分代码省略.........
开发者ID:Finzy,项目名称:stageDB,代码行数:101,代码来源:buddypress.php
示例16: do_action
</span>
<?php
do_action('bp_' . bp_get_the_profile_field_input_name() . '_errors');
?>
<?php
bp_the_profile_field_options();
?>
</div>
<?php
}
?>
<?php
if ('datebox' == bp_get_the_profile_field_type()) {
?>
<div class="datebox">
<label for="<?php
bp_the_profile_field_input_name();
?>
_day"><?php
bp_the_profile_field_name();
?>
<?php
if (bp_get_the_profile_field_is_required()) {
_e('(required)', 'buddypress');
}
?>
</label>
开发者ID:igniterealtime,项目名称:community-plugins,代码行数:31,代码来源:register.php
示例17: user_admin_profile_metaboxes
/**
* Render the xprofile metabox for Community Profile screen.
*
* @access public
* @since BuddyPress (2.0.0)
*
* @param WP_User $user The WP_User object for the user being edited.
*/
public function user_admin_profile_metaboxes($user = null, $args = array())
{
if (empty($user->ID)) {
return;
}
$r = bp_parse_args($args['args'], array('profile_group_id' => 0, 'user_id' => $user->ID), 'bp_xprofile_user_admin_profile_loop_args');
// We really need these args
if (empty($r['profile_group_id']) || empty($r['user_id'])) {
return;
}
if (bp_has_profile($r)) {
while (bp_profile_groups()) {
bp_the_profile_group();
?>
<input type="hidden" name="field_ids[]" id="<?php
echo esc_attr('field_ids_' . bp_get_the_profile_group_slug());
?>
" value="<?php
echo esc_attr(bp_get_the_profile_group_field_ids());
?>
" />
<?php
if (bp_get_the_profile_group_description()) {
?>
<p class="description"><?php
bp_the_profile_group_description();
?>
</p>
<?php
}
while (bp_profile_fields()) {
bp_the_profile_field();
?>
<div<?php
bp_field_css_class('bp-profile-field');
?>
>
<?php
$field_type = bp_xprofile_create_field_type(bp_get_the_profile_field_type());
$field_type->edit_field_html(array('user_id' => $r['user_id']));
if (bp_get_the_profile_field_description()) {
?>
<p class="description"><?php
bp_the_profile_field_description();
?>
</p>
<?php
}
do_action('bp_custom_profile_edit_fields_pre_visibility');
$can_change_visibility = bp_current_user_can('bp_xprofile_change_field_visibility');
?>
<p class="field-visibility-settings-<?php
echo $can_change_visibility ? 'toggle' : 'notoggle';
?>
" id="field-visibility-settings-toggle-<?php
bp_the_profile_field_id();
?>
">
<?php
printf(__('This field can be seen by: <span class="%s">%s</span>', 'buddypress'), esc_attr('current-visibility-level'), bp_get_the_profile_field_visibility_level_label());
if ($can_change_visibility) {
?>
<a href="#" class="button visibility-toggle-link"><?php
_e('Change', 'buddypress');
?>
</a>
<?php
}
?>
</p>
<?php
if ($can_change_visibility) {
?>
<div class="field-visibility-settings" id="field-visibility-settings-<?php
bp_the_profile_field_id();
?>
">
<fieldset>
<legend><?php
_e('Who can see this field?', 'buddypress');
?>
</legend>
<?php
bp_profile_visibility_radio_buttons();
?>
</fieldset>
<a class="button field-visibility-settings-close" href="#"><?php
_e('Close', 'buddypress');
//.........这里部分代码省略.........
开发者ID:danielcoats,项目名称:schoolpress,代码行数:101,代码来源:bp-xprofile-admin.php
注:本文中的bp_get_the_profile_field_type函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论