本文整理汇总了PHP中bp_field_has_data函数的典型用法代码示例。如果您正苦于以下问题:PHP bp_field_has_data函数的具体用法?PHP bp_field_has_data怎么用?PHP bp_field_has_data使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bp_field_has_data函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: while
<?php while ( bp_profile_groups() ) : bp_the_profile_group(); ?>
<?php if ( bp_profile_group_has_fields() ) : ?>
<?php do_action( 'bp_before_profile_field_content' ) ?>
<div class="bp-widget <?php bp_the_profile_group_slug() ?>">
<?php if ( 1 != bp_get_the_profile_group_id() ) : ?>
<h4><?php bp_the_profile_group_name() ?></h4>
<?php endif; ?>
<table class="profile-fields zebra">
<?php while ( bp_profile_fields() ) : bp_the_profile_field(); ?>
<?php if ( bp_field_has_data() ) : ?>
<tr<?php bp_field_css_class() ?>>
<td class="label">
<?php bp_the_profile_field_name() ?>
</td>
<td class="data">
<?php bp_the_profile_field_value() ?>
</td>
</tr>
<?php endif; ?>
<?php do_action( 'bp_profile_field_item' ) ?>
示例2: bp_the_profile_group_name
</td>
</tr>
<tr>
<td>Profile</td>
<td><?php
bp_the_profile_group_name();
?>
</td>
</tr>
<?php
while (bp_profile_fields()) {
bp_the_profile_field();
?>
<?php
if (bp_field_has_data()) {
?>
<tr>
<td><?php
bp_the_profile_field_name();
?>
</td>
<td><?php
bp_the_profile_field_value();
?>
</td>
</tr>
示例3: 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;
}
示例4: 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;
}
示例5: 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));
}
示例6: evaluate
public function evaluate($user_id, $from_time)
{
global $wpdb, $bp, $creds;
$questionsAsked = 0;
$questionsAnswered = 0;
$requiredAsked = 0;
$RequiredAnswered = 0;
if (function_exists('xprofile_get_profile')) {
if (bp_has_profile('user_id=' . $bp->loggedin_user->id)) {
while (bp_profile_groups()) {
bp_the_profile_group();
while (bp_profile_fields()) {
bp_the_profile_field();
$questionsAsked++;
if (bp_get_the_profile_field_is_required()) {
$requiredAsked++;
}
if (bp_field_has_data()) {
if (bp_get_the_profile_field_is_required()) {
$requiredAnswered++;
}
$questionsAnswered++;
}
}
}
}
}
if ($questionsAnswered >= ($questionsAsked - 2) / $questionsAsked) {
return True;
} else {
return False;
}
}
示例7: 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;
}