本文整理汇总了PHP中bp_profile_fields函数的典型用法代码示例。如果您正苦于以下问题:PHP bp_profile_fields函数的具体用法?PHP bp_profile_fields怎么用?PHP bp_profile_fields使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bp_profile_fields函数的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: if
<?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>
</tr>
<?php endif; ?>
示例3: 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
}
}
}
示例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 = __('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;
}
示例6: 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;
}
示例7: jfb_output_premium_panel_tease
//.........这里部分代码省略.........
if (!bp_has_profile()) {
echo "Error: BuddyPress Profile Not Found. This should never happen - if you see this message, please report it on the plugin support page.";
} else {
//Present the 3 mapping options: disable mapping, map new users, or map new and returning users
?>
<input <?php
disableatt();
?>
type="radio" name="<?php
echo $opt_jfbp_xprofile_map;
?>
" value="0" <?php
echo get_option($opt_jfbp_xprofile_map) == 0 ? "checked='checked'" : "";
?>
>Disable Mapping
<input <?php
disableatt();
?>
type="radio" name="<?php
echo $opt_jfbp_xprofile_map;
?>
" value="1" <?php
echo get_option($opt_jfbp_xprofile_map) == 1 ? "checked='checked'" : "";
?>
>Map New Users Only
<input <?php
disableatt();
?>
type="radio" name="<?php
echo $opt_jfbp_xprofile_map;
?>
" value="2" <?php
echo get_option($opt_jfbp_xprofile_map) == 2 ? "checked='checked'" : "";
?>
>Map New And Returning Users<br /><?php
//Make a list of which Facebook fields may be mapped to each type of xProfile field. Omitted types (i.e. checkbox) are treated as "unmappable."
//The format is "xprofile_field_type"->"(fbfieldname1, fbfieldDisplayname1), (fbfieldname2, fbfieldDisplayname2), ..."
//(Available FB fields are documented at: https://developers.facebook.com/docs/reference/api/user/)
$allowed_mappings = array('textbox' => array('id' => "ID", 'name' => "Name", 'first_name' => "First Name", 'middle_name' => "Middle Name", 'last_name' => "Last Name", 'username' => "Username", 'gender' => "Gender", 'link' => "Profile URL", "website" => "Website*", 'bio' => "Bio*", 'political' => "Political*", "religion" => "Religion*", 'relationship_status' => "Relationship*", "location" => "City*", 'hometown' => "Hometown*", 'languages' => "Languages*", 'music' => 'Music*', 'interests' => 'Interests*'), 'textarea' => array('id' => "ID", 'name' => "Name", 'first_name' => "First Name", 'middle_name' => "Middle Name", 'last_name' => "Last Name", 'username' => "Username", 'gender' => "Gender", 'link' => "Profile URL", "website" => "Website*", 'bio' => "Bio*", 'political' => "Political*", "religion" => "Religion*", 'relationship_status' => "Relationship*", "location" => "City*", 'hometown' => "Hometown*", 'languages' => "Languages*", 'music' => 'Music*', 'interests' => 'Interests*'), 'datebox' => array('birthday' => 'Birthday*'));
$allowed_mappings = apply_filters('wpfb_xprofile_allowed_mappings', $allowed_mappings);
//Go through all of the XProfile fields and offer possible Facebook mappings for each (in a dropdown).
//(current_mappings is used to set the initial state of the panel, i.e. based on what mappings are already in the db)
$current_mappings = get_option($opt_jfbp_xprofile_mappings);
while (bp_profile_groups()) {
//Create a "box" for each XProfile Group
global $group;
bp_the_profile_group();
?>
<div style="width:420px; padding:5px; margin:2px 0; background-color:#EEEDDA; border:1px solid #CCC;"><?php
echo "Group \"{$group->name}\":<br />";
//And populate the group box with Textarea(xprofile field)->Dropdown(possible facebook mappings)
while (bp_profile_fields()) {
//Output the X-Profile field textarea
global $field;
bp_the_profile_field();
?>
<input disabled='disabled' type="text" size="20" name="<?php
echo $field->name;
?>
" value="<?php
echo $field->name;
?>
" /> ->
<?php
//If there aren't any available Facebook mappings, just put a disabled textbox and "hidden" field that sets this option as '0'
if (!$allowed_mappings[$field->type]) {
echo "<input disabled='disabled' type='text' size='30' name='{$field->name}" . "_unavail" . "' value='(No Mappings Available)' />";
echo "<input type='hidden' name='{$field->id}' value='0' />";
continue;
}
//Otherwise, list all of the available mappings in a dropdown.
?>
<select name="<?php
echo $jfb_xprofile_field_prefix . $field->id;
?>
">
<option value="0">(No Mapping)</option><?php
foreach ($allowed_mappings[$field->type] as $fbname => $userfriendlyname) {
echo "<option " . ($current_mappings[$field->id] == $fbname ? "selected" : "") . " value=\"{$fbname}\">{$userfriendlyname}</option>";
}
?>
</select><br /><?php
}
?>
</div><?php
}
}
}
?>
<input type="hidden" name="prem_opts_updated" value="1" />
<div class="submit"><input <?php
disableatt();
?>
type="submit" name="Submit" value="Save Premium" /></div>
</form>
<?php
}
示例8: _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
//.........这里部分代码省略.........
示例9: bp_ajax_register_form_function
//.........这里部分代码省略.........
<input type="password" name="signup_password_confirm" id="signup_password_confirm" value="" />
</div>
</div><!-- #basic-details-section -->
<?php
do_action('bp_after_account_details_fields');
?>
<?php
/***** Extra Profile Details ******/
?>
<?php
if (bp_is_active('xprofile')) {
?>
<?php
do_action('bp_before_signup_profile_fields');
?>
<div class="register-section ajax-register-section" id="profile-details-section">
<?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('profile_group_id=1&hide_empty_fields=0')) {
while (bp_profile_groups()) {
bp_the_profile_group();
?>
<?php
while (bp_profile_fields()) {
bp_the_profile_field();
?>
<div class="ctrlHolder fullwidth">
<?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('', 'buddypress');
}
?>
</label>
<div id="<?php
bp_the_profile_field_input_name();
?>
_error" class="error"></div>
<input type="text" name="<?php
bp_the_profile_field_input_name();
?>
" id="<?php
bp_the_profile_field_input_name();
?>
" value="<?php
示例10: 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
//.........这里部分代码省略.........
示例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: 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());
//.........这里部分代码省略.........
示例13: 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');
//.........这里部分代码省略.........
示例14: 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;
}
}
示例15: wsl_component_buddypress_setup_profile_mapping
//.........这里部分代码省略.........
<?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;
?>
);" <?php
if (!$can_map_it) {
echo "disabled";
}
?>
>
<option value=""></option>
<?php
if ($can_map_it) {
foreach ($ha_profile_fields as $item) {
?>