本文整理汇总了PHP中bp_get_the_profile_field_id函数的典型用法代码示例。如果您正苦于以下问题:PHP bp_get_the_profile_field_id函数的具体用法?PHP bp_get_the_profile_field_id怎么用?PHP bp_get_the_profile_field_id使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bp_get_the_profile_field_id函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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
示例2: bp_xprofile_map_meta_caps
/**
* 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);
}
示例3: bp_xprofile_grant_bp_xprofile_change_field_visibility_for_logged_out_users
/**
* 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;
}
示例4: bp_xprofile_map_meta_caps
/**
* 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);
}
示例5: 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
}
示例6: 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
示例7: 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
}
示例8: printf
?>
">
<?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');
?>
示例9: 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
}
}
}
示例10: while
?>
</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();
示例11: bp_profile_get_settings_visibility_select
/**
* 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);
}
示例12: buddyboss_customizer_xprofile_field_choices
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;
}
示例13: edit_field_html
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());
}
示例14: bp_get_the_profile_field_required_label
/**
* 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;
}
示例15: bp_the_profile_field_id
function bp_the_profile_field_id()
{
echo bp_get_the_profile_field_id();
}