本文整理汇总了PHP中bp_get_the_profile_field_name函数的典型用法代码示例。如果您正苦于以下问题:PHP bp_get_the_profile_field_name函数的具体用法?PHP bp_get_the_profile_field_name怎么用?PHP bp_get_the_profile_field_name使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bp_get_the_profile_field_name函数的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: 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
}
示例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';
}
$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
示例4: do_action
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
开发者ID:WPezClasses,项目名称:class-wp-ezclasses-buddypress-editability-visibility-1,代码行数:31,代码来源:profile-loop.php
示例5: 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
}
示例6: affiliation
<?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');
示例7: 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();
?>
示例8: 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;
}
示例9: get_profile
/**
* 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;
}
示例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
//.........这里部分代码省略.........
示例11: rtmedia_api_process_bp_get_profile_request
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));
}
示例12: 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
示例13: user_buddypress_form
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;
}
示例14: bp_the_profile_field_name
function bp_the_profile_field_name()
{
echo bp_get_the_profile_field_name();
}
示例15: rtmedia_api_process_bp_get_profile_request
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;
}