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 }
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 }
do_action('bp_before_profile_field_content'); $str_echo1 .= '<div class="bp-widget ' . bp_get_the_profile_group_slug() . '">'; $str_echo1 .= '<h4>' . bp_get_the_profile_group_name() . '</h4>'; $str_echo2 = ''; while (bp_profile_fields()) { bp_the_profile_field(); // field ID $int_field_id = esc_html($field->id); // use our (custom) method to get the fields' vibility level $str_field_ev = $obj_bp_ev->ez_bp_get_the_profile_field_visibility_level(); // get the visible value $str_field_visible = $obj_bp_ev->get_level_visible($str_field_ev); // is the field's visibile okay for this visitor? if (isset($arr_current_visitor_has_permissions[$str_field_visible])) { $str_echo2 .= '<div class="viewfield field_' . $int_field_id . ' field_' . strtolower(sanitize_file_name($field->name)) . ' field_type_' . esc_html($field->type) . '">'; $str_echo2 .= '<label for="field_' . $int_field_id . '">' . bp_get_the_profile_field_name(); // $str_echo2 .= ' [' . $str_field_ev . ' - (TODO remove)]'; $str_echo2 .= '</label>'; $str_echo2 .= '<div class="bp-view-the-field">' . bp_get_the_profile_field_value() . '</div>'; $str_echo2 .= '</div>'; $str_echo2 .= '</div>'; } else { // TODO REMOVE echo '<br>' . $int_field_id . ' - display = false - ' . $str_field_ev . ' [TODO - remove from profile-loop.php]<br>'; } ?> <?php do_action('bp_profile_field_item'); ?> <?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 } else { if (bp_get_the_profile_field_name() == "Professional Affiliation: Title of your position/role") { ?> <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_name() == "Research Description") { ?> <h2>Research</h2> <?php } else { if (bp_get_the_profile_field_name() == "Mailing Address: Street") { ?> <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');
</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(); ?>
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; }
/** * Returns an object with profile information * @return Object Profile Fields */ public function get_profile() { /* Possible parameters: * String username: the username you want information from (required) */ $this->initVars('profile'); $oReturn = new stdClass(); if ($this->username === false || !username_exists($this->username)) { return $this->error('profile', 1); } $oUser = get_user_by('login', $this->username); if (!bp_has_profile(array('user_id' => $oUser->data->ID))) { return $this->error('profile', 0); } while (bp_profile_groups(array('user_id' => $oUser->data->ID))) { bp_the_profile_group(); if (bp_profile_group_has_fields()) { $sGroupName = bp_get_the_profile_group_name(); while (bp_profile_fields()) { bp_the_profile_field(); $sFieldName = bp_get_the_profile_field_name(); if (bp_field_has_data()) { $sFieldValue = bp_get_the_profile_field_value(); } $oReturn->groups->{$sGroupName}->{$sFieldName} = $sFieldValue; } } } return $oReturn; }
/** * 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 bp_the_profile_field_name(); ?> <?php } ?> </label> <?php do_action("bp_{$field_name}_errors"); ?> <textarea rows="5" cols="40" name="<?php echo $field_name_esc; ?> " id="<?php echo $field_name_esc; ?> "><?php bp_the_profile_field_edit_value(); ?> </textarea> <?php } ?> <?php if ('selectbox' == $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"); ?> <select name="<?php echo $field_name_esc; ?> " id="<?php echo $field_name_esc; ?> "> <?php bp_the_profile_field_options(); ?> </select> <?php } ?> <?php if ('multiselectbox' == $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"); ?> <select name="<?php echo $field_name_esc; ?> " id="<?php echo $field_name_esc; ?> " multiple="multiple"> <?php bp_the_profile_field_options(); ?> </select> <?php } ?> <?php if ('radio' == $field_type) { ?> <div class="radio"> <span class="label"> <?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 } ?> </span> <?php do_action("bp_{$field_name}_errors"); ?> <?php bp_the_profile_field_options(); ?> <?php if (!bp_get_the_profile_field_is_required()) { ?> <a class="clear-value" href="javascript:clear( '<?php echo $field_name_esc; ?> ' );"><?php _e('Clear', 'membership'); ?> </a> <?php } ?> </div> <?php } ?> <?php if ('checkbox' == $field_type) { ?> <div class="checkbox"> <span class="label"> <?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 } ?> </span> <?php do_action("bp_{$field_name}_errors"); ?> <?php bp_the_profile_field_options(); ?> </div> <?php } ?> <?php if ('datebox' == $field_type) { ?> <div class="datebox"> <label for="<?php echo $field_name_esc; ?> _day"> <?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"); ?> <select name="<?php echo $field_name_esc; ?> _day" id="<?php echo $field_name_esc; ?> _day"> <?php bp_the_profile_field_options('type=day'); ?> </select> <select name="<?php echo $field_name_esc; ?> _month" id="<?php echo $field_name_esc; ?> _month"> <?php bp_the_profile_field_options('type=month'); ?> </select> <select name="<?php echo $field_name_esc; ?> _year" id="<?php echo $field_name_esc; ?> _year"> <?php bp_the_profile_field_options('type=year'); ?> </select> </div> <?php } ?> <?php 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(); ?> "> <?php printf(_x('This field can be seen by: %s', 'This field can be seen by: {Administrator}', 'membership'), '<span class="current-visibility-level">' . bp_get_the_profile_field_visibility_level_label() . '</span>'); ?> <a href="#" class="visibility-toggle-link"><?php _ex('Change', 'Change profile field visibility level', 'membership'); ?> </a> </p> <div class="field-visibility-settings" id="field-visibility-settings-<?php bp_the_profile_field_id(); ?> "> <fieldset> <legend><?php _e('Who can see this field?', 'membership'); ?> </legend> <?php bp_profile_visibility_radio_buttons(); ?> </fieldset> <a class="field-visibility-settings-close" href="#"><?php _e('Close', 'membership'); ?> </a> </div> <?php } else { ?> <p class="field-visibility-settings-notoggle" id="field-visibility-settings-toggle-<?php bp_the_profile_field_id(); ?> "> <?php printf(__('This field can be seen by: <span class="current-visibility-level">%s</span>', 'membership'), bp_get_the_profile_field_visibility_level_label()); ?> </p> <?php } ?> <?php do_action('bp_custom_profile_edit_fields'); ?> <p class="description"><?php bp_the_profile_field_description(); ?> </p> </div> <?php } ?> <input type="hidden" name="signup_profile_field_ids" id="signup_profile_field_ids" value="<?php bp_the_profile_group_field_ids(); ?> "> <?php } ?> <?php } ?> </div><!-- #profile-details-section --><?php do_action('bp_after_signup_profile_fields'); }
function rtmedia_api_process_bp_get_profile_request() { $this->rtmediajsonapifunction->rtmedia_api_verfiy_token(); //Errors $ec_no_fields = 400001; $msg_no_fields = esc_html__('no profile found', 'buddypress-media'); $ec_profile_fields = 400002; $msg_profile_fields = esc_html__('profile fields', 'buddypress-media'); $profile_fields = array(); $user_id = $loggedin_user_id = ''; $user_id = filter_input(INPUT_POST, 'user_id', FILTER_SANITIZE_NUMBER_INT); $loggedin_user_id = filter_input(INPUT_POST, 'loggedin_user_id', FILTER_SANITIZE_NUMBER_INT); if (empty($user_id)) { $user_id = $this->user_id; } else { $loggedin_user_id = $this->user_id; } $user = get_userdata($user_id); if (empty($user)) { wp_send_json($this->rtmedia_api_response_object('TRUE', $ec_no_fields, $msg_no_fields)); } $user_data = $this->rtmediajsonapifunction->rtmedia_api_user_data_from_id($user_id, 250, 250, 'full'); $profile_fields['id'] = $user_id; $profile_fields['avatar']['src'] = esc_url($user_data['avatar']); $profile_fields['avatar']['width'] = 250; $profile_fields['avatar']['height'] = 250; if (bp_has_profile(array('user_id' => $user_id))) { while (bp_profile_groups()) { bp_the_profile_group(); if (bp_profile_group_has_fields()) { while (bp_profile_fields()) { bp_the_profile_field(); if (bp_field_has_data()) { $profile_fields['fields'][bp_get_the_profile_field_name()] = array('value' => strip_tags(bp_get_the_profile_field_value()), 'privacy' => bp_get_the_profile_field_visibility_level()); } } } } } else { wp_send_json($this->rtmedia_api_response_object('FALSE', $ec_no_fields, $msg_no_fields)); } //If followers plugin exists if (function_exists('rtmedia_api_followers')) { $followers = rtmedia_api_followers($user_id); $following = $this->rtmediajsonapifunction->rtmedia_api_following($user_id); foreach ($followers as $follower) { $follower_data = $this->rtmediajsonapifunction->rtmedia_api_user_data_from_id($follower, 66, 66); $profile_fields['follower'][] = array('id' => $follower, 'name' => $follower_data['name'], 'avatar' => $follower_data['avatar']); } foreach ($following as $follow) { $follow_data = $this->rtmediajsonapifunction->rtmedia_api_user_data_from_id($follow, 66, 66); $profile_fields['following'][] = array('id' => $follow, 'name' => $follow_data['name'], 'avatar' => $follow_data['avatar']); } } if (!empty($user_id) && intval($loggedin_user_id) !== intval($user_id)) { $args = array('leader_id' => $user_id, 'follower_id' => $loggedin_user_id); if (function_exists('bp_follow_is_following')) { $profile_fields['loggedin_user']['following'] = 'FALSE'; if (bp_follow_is_following($args)) { $profile_fields['loggedin_user']['following'] = 'TRUE'; } $args = array('leader_id' => $loggedin_user_id, 'follower_id' => $user_id); $profile_fields['loggedin_user']['followed'] = 'FALSE'; if (bp_follow_is_following($args)) { $profile_fields['loggedin_user']['followed'] = 'TRUE'; } } } wp_send_json($this->rtmedia_api_response_object('TRUE', $ec_profile_fields, $msg_profile_fields, $profile_fields)); }
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 }
function user_buddypress_form($content) { // displays badge list in user profile global $qa_request; $userid = $content['raw']['userid']; $handles = qa_userids_to_handles(array($userid)); $handle = $handles[$userid]; if (!$handle) { return; } global $bp; if (qa_opt('buddypress_enable_profile')) { $idx = 1; if (bp_has_profile(array('user_id' => $userid))) { while (bp_profile_groups()) { bp_the_profile_group(); if (bp_profile_group_has_fields()) { $fields[] = array('label' => '<span class="qa-bp-profile-group-title">' . bp_get_the_profile_group_name() . '</span>', 'type' => 'static', 'value' => qa_get_logged_in_userid() === $userid ? ' <a class="qa-bp-profile-group-edit" href="' . bp_loggedin_user_domain() . $bp->profile->slug . '/edit/group/' . $idx++ . '">' . qa_lang_html('question/edit_button') . '</a>' : ''); while (bp_profile_fields()) { bp_the_profile_field(); if (bp_field_has_data()) { $fields[] = array('label' => bp_get_the_profile_field_name(), 'type' => 'static', 'value' => preg_replace('|</*p>|', '', bp_get_the_profile_field_value())); } } } } } $ok = null; $tags = null; $buttons = array(); $title = '<a href="' . bp_core_get_user_domain($userid) . $bp->profile->slug . '/">' . qa_opt('buddypress_integration_title') . '</a>'; $content = array_merge(array('form-buddypress-list' => array('ok' => $ok && !isset($error) ? $ok : null, 'style' => 'wide', 'tags' => $tags, 'title' => $title, 'fields' => $fields, 'buttons' => $buttons)), $content); } if (qa_opt('buddypress_integration_priv_message') && qa_get_logged_in_userid() && $userid != qa_get_logged_in_userid()) { $content = array_merge(array('form-buddypress-message' => array('fields' => array('field' => array('label' => '<a href="' . wp_nonce_url($bp->loggedin_user->domain . $bp->messages->slug . '/compose/?r=' . $handle) . '">' . qa_lang('misc/private_message_title') . '</a>', 'type' => 'static')), 'style' => 'wide')), $content); } return $content; }
function bp_the_profile_field_name() { echo bp_get_the_profile_field_name(); }
function rtmedia_api_process_bp_get_profile_request() { $this->rtmediajsonapifunction->rtmedia_api_verfiy_token(); //Errors $ec_no_fields = 400001; $msg_no_fields = __('no profile found', 'rtmedia'); $ec_profile_fields = 400002; $msg_profile_fields = __('profile fields', 'rtmedia'); $profile_fields = array(); $user_id = $loggedin_user_id = ''; extract($_REQUEST); if (empty($user_id)) { $user_id = $this->user_id; } else { $loggedin_user_id = $this->user_id; } $user = get_userdata($user_id); if (empty($user)) { echo $this->rtmedia_api_response_object('TRUE', $ec_no_fields, $msg_no_fields); exit; } $user_data = $this->rtmediajsonapifunction->rtmedia_api_user_data_from_id($user_id, 250, 250, 'full'); $profile_fields['id'] = $user_id; $profile_fields['avatar']['src'] = $user_data['avatar']; $profile_fields['avatar']['width'] = 250; $profile_fields['avatar']['height'] = 250; if (bp_has_profile(array('user_id' => $user_id))) { while (bp_profile_groups()) { bp_the_profile_group(); if (bp_profile_group_has_fields()) { while (bp_profile_fields()) { bp_the_profile_field(); if (bp_field_has_data()) { $profile_fields['fields'][bp_get_the_profile_field_name()] = array('value' => strip_tags(bp_get_the_profile_field_value()), 'privacy' => bp_get_the_profile_field_visibility_level()); } } } } } else { echo $this->rtmedia_api_response_object('FALSE', $ec_no_fields, $msg_no_fields); exit; } //If followers plugin exists if (function_exists('rtmedia_api_followers')) { $followers = rtmedia_api_followers($user_id); $following = rtmedia_api_following($user_id); foreach ($followers as $follower) { $follower_data = $this->rtmediajsonapifunction->rtmedia_api_user_data_from_id($follower, 66, 66); $profile_fields['follower'][] = array('id' => $follower, 'name' => $follower_data['name'], 'avatar' => $follower_data['avatar']); } foreach ($following as $follow) { $follow_data = $this->rtmediajsonapifunction->rtmedia_api_user_data_from_id($follow, 66, 66); $profile_fields['following'][] = array('id' => $follow, 'name' => $follow_data['name'], 'avatar' => $follow_data['avatar']); } } if (!empty($_REQUEST['user_id']) && $loggedin_user_id != $user_id) { $args = array('leader_id' => $user_id, 'follower_id' => $loggedin_user_id); if (function_exists('bp_follow_is_following')) { $profile_fields['loggedin_user']['following'] = 'FALSE'; if (bp_follow_is_following($args)) { $profile_fields['loggedin_user']['following'] = 'TRUE'; } $args = array('leader_id' => $loggedin_user_id, 'follower_id' => $user_id); $profile_fields['loggedin_user']['followed'] = 'FALSE'; if (bp_follow_is_following($args)) { $profile_fields['loggedin_user']['followed'] = 'TRUE'; } } } echo $this->rtmedia_api_response_object('TRUE', $ec_profile_fields, $msg_profile_fields, $profile_fields); exit; }
/** * Get a sanitised and escaped string of the edit field's HTML elements and attributes. * * Must be used inside the {@link bp_profile_fields()} template loop. * This method was intended to be static but couldn't be because php.net/lsb/ requires PHP >= 5.3. * * @since 2.0.0 * * @param array $properties Optional key/value array of attributes for this edit field. * * @return string */ protected function get_edit_field_html_elements(array $properties = array()) { $r = bp_parse_args($properties, array('id' => bp_get_the_profile_field_input_name(), 'name' => bp_get_the_profile_field_input_name())); if (bp_get_the_profile_field_is_required()) { $r['aria-required'] = 'true'; } /** * Filters the edit html elements and attributes. * * @since 2.0.0 * * @param array $r Array of parsed arguments. * @param string $value Class name for the current class instance. */ $r = (array) apply_filters('bp_xprofile_field_edit_html_elements', $r, get_class($this)); return bp_get_form_field_attributes(sanitize_key(bp_get_the_profile_field_name()), $r); }
bp_the_profile_field(); ?> <?php if (bp_field_has_data()) { ?> <tr<?php bp_field_css_class(); ?> > <?php $stripped_string = strip_tags(bp_get_the_profile_field_value()); $found = strpos($stripped_string, 'http'); if ($found === false) { $stripped_string = 'http://' . $stripped_string; } $name = bp_get_the_profile_field_name(); $url = ''; switch ($name) { case 'Facebook': $alt = 'Facebook'; $url = get_field('facebook_icon', 'option'); break; case 'LinkedIn': $alt = 'LinkedIn'; $url = get_field('linkedin_icon', 'option'); break; case 'Twitter': $alt = 'Twitter'; $url = get_field('twitter_icon', 'option'); break; case 'Academia.edu':