本文整理汇总了PHP中bp_has_profile函数的典型用法代码示例。如果您正苦于以下问题:PHP bp_has_profile函数的具体用法?PHP bp_has_profile怎么用?PHP bp_has_profile使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bp_has_profile函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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');
?>
//.........这里部分代码省略.........
示例2: test_bp_has_profile_meta_cache_update_meta_cache_false
/**
* @group bp_xprofile_update_meta_cache
* @group bp_has_profile
*/
public function test_bp_has_profile_meta_cache_update_meta_cache_false()
{
$u = $this->factory->user->create();
$g = $this->factory->xprofile_group->create();
$f = $this->factory->xprofile_field->create(array('field_group_id' => $g));
$d = new BP_XProfile_ProfileData($f, $u);
$d->user_id = $u;
$d->field_id = $f;
$d->value = 'foo';
$d->last_updated = bp_core_current_time();
$d->save();
bp_xprofile_add_meta($g, 'group', 'group_foo', 'group_bar');
bp_xprofile_add_meta($f, 'field', 'field_foo', 'field_bar');
bp_xprofile_add_meta($d->id, 'data', 'data_foo', 'data_bar');
// prime cache
bp_has_profile(array('user_id' => $u, 'profile_group_id' => $g, 'update_meta_cache' => false));
$this->assertFalse(wp_cache_get($g, 'xprofile_group_meta'));
$this->assertFalse(wp_cache_get($f, 'xprofile_field_meta'));
$this->assertFalse(wp_cache_get($d->id, 'xprofile_data_meta'));
}
示例3: bp_xprofile_get_settings_fields
/**
* Query all profile fields and their visibility data for display in settings.
*
* @since 2.0.0
*
* @param array|string $args Array of args for the settings fields.
* @return array
*/
function bp_xprofile_get_settings_fields($args = '')
{
// Parse the possible arguments.
$r = bp_parse_args($args, array('user_id' => bp_displayed_user_id(), 'profile_group_id' => false, 'hide_empty_groups' => false, 'hide_empty_fields' => false, 'fetch_fields' => true, 'fetch_field_data' => false, 'fetch_visibility_level' => true, 'exclude_groups' => false, 'exclude_fields' => false), 'xprofile_get_settings_fields');
return bp_has_profile($r);
}
示例4: 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;
}
示例5: 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;
}
示例6: do_action
do_action('bp_before_signup_profile_fields');
?>
<div class="register-section" id="profile-details-section">
<h4><?php
_e('Profile Details', 'buddypress');
?>
</h4>
<?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(array('profile_group_id' => 1, 'fetch_field_data' => false))) {
while (bp_profile_groups()) {
bp_the_profile_group();
?>
<?php
while (bp_profile_fields()) {
bp_the_profile_field();
?>
<div class="editfield">
<?php
if ('textbox' == bp_get_the_profile_field_type()) {
?>
示例7: wsl_component_buddypress_setup_profile_mapping
//.........这里部分代码省略.........
}
?>
">
<h3>
<label><?php
_wsl_e("Fields Map", 'wordpress-social-login');
?>
</label>
</h3>
<div class="inside">
<p>
<?php
_wsl_e("Here you can create a new map by placing WSL users profiles fields to the appropriate destination fields", 'wordpress-social-login');
?>
.
<?php
_wsl_e('The left column shows the available <b>WSL users profiles fields</b>: These select boxes are called <b>source</b> fields', 'wordpress-social-login');
?>
.
<?php
_wsl_e('The right column shows the list of <b>Buddypress profiles fields</b>: Those are the <b>destination</b> fields', 'wordpress-social-login');
?>
.
<?php
_wsl_e('If you don\'t want to map a particular Buddypress field, then leave the source for that field blank', 'wordpress-social-login');
?>
.
</p>
<hr />
<?php
if (bp_has_profile()) {
while (bp_profile_groups()) {
global $group;
bp_the_profile_group();
?>
<h4><?php
echo sprintf(_wsl__("Fields Group '%s'", 'wordpress-social-login'), $group->name);
?>
:</h4>
<table width="100%" border="0" cellpadding="5" cellspacing="2" style="border-top:1px solid #ccc;">
<?php
while (bp_profile_fields()) {
global $field;
bp_the_profile_field();
?>
<tr>
<td width="270" align="right" valign="top">
<?php
$map = isset($wsl_settings_buddypress_xprofile_map[$field->id]) ? $wsl_settings_buddypress_xprofile_map[$field->id] : 0;
$can_map_it = true;
if (!in_array($field->type, array('textarea', 'textbox', 'url', 'datebox', 'number'))) {
$can_map_it = false;
}
?>
<select name="wsl_settings_buddypress_xprofile_map[<?php
echo $field->id;
?>
]" style="width:255px" id="bb_profile_mapping_selector_<?php
echo $field->id;
?>
" onChange="showMappingConfirm( <?php
echo $field->id;
示例8: do_action
<?php
do_action('bp_before_profile_loop_content');
?>
<?php
if (bp_has_profile()) {
?>
<?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();
?>
">
<div class="entry-content">
<table class="forum">
<tr>
示例9: do_action
<?php do_action( 'bp_before_profile_loop_content' ) ?>
<?php if ( function_exists('xprofile_get_profile') ) : ?>
<?php if ( bp_has_profile() ) : ?>
<?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>
示例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: buatp_generate_fields
function buatp_generate_fields($query = '')
{
$html = '';
ob_start();
if (bp_has_profile($query)) {
while (bp_profile_groups()) {
bp_the_profile_group();
while (bp_profile_fields()) {
bp_the_profile_field();
?>
<div class="editfield">
<?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('(required)', 'buddypress');
}
?>
</label>
<?php
do_action(bp_get_the_profile_field_errors_action());
?>
<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
}
?>
<?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
}
?>
<?php
if ('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
//.........这里部分代码省略.........
示例13: bp_mtc_screen_two_content
function bp_mtc_screen_two_content()
{
global $bp, $wpdb, $creds, $profile_template, $groups;
?>
<p>Please select any tags that you would like to include in your followed content.</p>
<?php
if (bp_has_profile()) {
while (bp_profile_groups()) {
bp_the_profile_group();
if ('mtc' == bp_get_the_profile_group_name()) {
?>
<form action="<?php
bp_the_profile_group_edit_form_action();
?>
" method="post" id="profile-edit-form" class="standard-form <?php
bp_the_profile_group_slug();
?>
">
<?php
while (bp_profile_fields()) {
bp_the_profile_field();
?>
<fieldset<?php
bp_field_css_class('editfield');
?>
>
<div class="checkbox">
<span class="label"><?php
bp_the_profile_field_name();
?>
<?php
if (bp_get_the_profile_field_is_required()) {
_e('(required)', 'buddypress');
}
?>
</span>
<?php
bp_the_profile_field_options();
?>
</div>
<?php
do_action('bp_custom_profile_edit_fields');
?>
<p class="description"><?php
bp_the_profile_field_description();
?>
</p>
</fieldset>
<?php
}
?>
<div class="submit">
<input type="submit" name="profile-group-edit-submit" id="profile-group-edit-submit" value="<?php
_e('Save selection', 'buddypress');
?>
" />
</div>
<input type="hidden" name="field_ids" id="field_ids" value="<?php
bp_the_profile_group_field_ids();
?>
" />
<?php
wp_nonce_field('bp_xprofile_edit');
?>
</form>
<?php
}
}
}
?>
<?php
/*
if ( function_exists('xprofile_get_profile') ) :
if ( bp_has_profile() ) :
while ( bp_profile_groups() ) : bp_the_profile_group();
print_r(bp_get_the_profile_group_name());
//.........这里部分代码省略.........
示例14: 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');
//.........这里部分代码省略.........
示例15: 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;
}
}