本文整理汇总了PHP中xprofile_get_field_data函数的典型用法代码示例。如果您正苦于以下问题:PHP xprofile_get_field_data函数的具体用法?PHP xprofile_get_field_data怎么用?PHP xprofile_get_field_data使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了xprofile_get_field_data函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: test_xprofile_sync_bp_profile_new_user
/**
* @group xprofile_set_field_data
* @ticket BP5836
*/
public function test_xprofile_sync_bp_profile_new_user()
{
$post_vars = $_POST;
$_POST = array('user_login' => 'foobar', 'pass1' => 'password', 'pass2' => 'password', 'role' => 'subscriber', 'email' => '[email protected]', 'first_name' => 'Foo', 'last_name' => 'Bar');
$id = add_user();
$display_name = 'Bar Foo';
$_POST = array('display_name' => $display_name, 'email' => '[email protected]', 'nickname' => 'foobar');
$id = edit_user($id);
// clean up post vars
$_POST = $post_vars;
$this->assertEquals($display_name, xprofile_get_field_data(bp_xprofile_fullname_field_id(), $id));
}
开发者ID:dcavins,项目名称:buddypress-svn,代码行数:16,代码来源:functions.php
示例2: cfbgr_migrate_xprofile_as_member_types
function cfbgr_migrate_xprofile_as_member_types()
{
global $wpdb;
$buddypress = buddypress();
// Description of this tool, displayed to the user
$statement = __('Migrating/Resetting xProfile data as member types: %s', 'buddypress-group-restrictions');
// Default to failure text
$result = __('No xProfile data needs to be migrated or reset.', 'buddypress-group-restrictions');
// Default to unrepaired
$repair = 0;
$field = (int) bp_get_option('cfbgr_xfield_id', 0);
if (empty($field)) {
return array(0, sprintf($statement, $result));
}
$member_types = bp_get_member_types();
// Walk through all users on the site
$user_ids = $wpdb->get_col("SELECT ID FROM {$wpdb->users}");
foreach ($user_ids as $user_id) {
$value = sanitize_key(xprofile_get_field_data($field, $user_id));
// Do we have a matching member type ?
if (isset($member_types[$value])) {
// Set member types if empty or different
if ($value !== bp_get_member_type($user_id)) {
bp_set_member_type($user_id, $value);
$repair += 1;
}
}
}
$result = sprintf(__('%d migrated or reset', 'buddypress-group-restrictions'), $repair);
// All done!
return array(0, sprintf($statement, $result));
}
开发者ID:WeFoster,项目名称:buddypress-group-restrictions,代码行数:32,代码来源:migrate.php
示例3: openlab_user_is_admin
function openlab_user_is_admin($is_admin)
{
$account_type = xprofile_get_field_data('Account Type', get_current_user_id());
if ($account_type && 'Faculty' == $account_type) {
$is_admin = true;
}
return $is_admin;
}
开发者ID:livinglab,项目名称:webwork-for-wordpress,代码行数:8,代码来源:openlab.php
示例4: display_user_color_pref
/**
* Adiciona campos no perfil do usuário
*
* @param void
* @return string
*/
function display_user_color_pref()
{
$bp_profissao = xprofile_get_field_data('profissão');
$bp_cidade = xprofile_get_field_data('cidade');
$bp_estado = xprofile_get_field_data('estado');
echo '<p class="field-data">' . $bp_profissao . '</p>';
echo '<p class="field-data">' . $bp_cidade . ' - ' . $bp_estado . '</p>';
}
开发者ID:CoordCulturaDigital-Minc,项目名称:cdigital2014,代码行数:14,代码来源:functions.php
示例5: rtmedia_api_user_data_from_id
function rtmedia_api_user_data_from_id($user_id, $width = 80, $height = 80, $type = 'thumb')
{
if (empty($user_id)) {
return false;
}
$user_data = array();
$user_data['id'] = $user_id;
$user_data['name'] = xprofile_get_field_data('Name', $user_id);
$avatar_args = array('item_id' => $user_id, 'width' => $width, 'height' => $height, 'html' => false, 'alt' => '', 'type' => $type);
$user_data['avatar'] = bp_core_fetch_avatar($avatar_args);
return $user_data;
}
开发者ID:fs-contributor,项目名称:rtMedia,代码行数:12,代码来源:RTMediaJsonApiFunctions.php
示例6: xprofile_sync_wp_profile
function xprofile_sync_wp_profile()
{
global $bp, $wpdb;
if ((int) get_site_option('bp-disable-profile-sync')) {
return true;
}
$fullname = xprofile_get_field_data(BP_XPROFILE_FULLNAME_FIELD_NAME, $bp->loggedin_user->id);
$space = strpos($fullname, ' ');
if (false === $space) {
$firstname = $fullname;
$lastname = '';
} else {
$firstname = substr($fullname, 0, $space);
$lastname = trim(substr($fullname, $space, strlen($fullname)));
}
update_usermeta($bp->loggedin_user->id, 'nickname', $fullname);
update_usermeta($bp->loggedin_user->id, 'first_name', $firstname);
update_usermeta($bp->loggedin_user->id, 'last_name', $lastname);
$wpdb->query($wpdb->prepare("UPDATE {$wpdb->users} SET display_name = %s WHERE ID = %d", $fullname, $bp->loggedin_user->id));
$wpdb->query($wpdb->prepare("UPDATE {$wpdb->users} SET user_url = %s WHERE ID = %d", bp_core_get_user_domain($bp->loggedin_user->id), $bp->loggedin_user->id));
}
开发者ID:alvaropereyra,项目名称:shrekcms,代码行数:21,代码来源:bp-xprofile-filters.php
示例7: xprofile_screen_edit_profile
/**
* Handles the display of the profile edit page by loading the correct template file.
* Also checks to make sure this can only be accessed for the logged in users profile.
*
* @package BuddyPress XProfile
* @uses bp_is_my_profile() Checks to make sure the current user being viewed equals the logged in user
* @uses bp_core_load_template() Looks for and loads a template file within the current member theme (folder/filename)
*/
function xprofile_screen_edit_profile()
{
if (!bp_is_my_profile() && !bp_current_user_can('bp_moderate')) {
return false;
}
$bp = buddypress();
// Make sure a group is set.
if (!bp_action_variable(1)) {
bp_core_redirect(trailingslashit(bp_displayed_user_domain() . $bp->profile->slug . '/edit/group/1'));
}
// Check the field group exists
if (!bp_is_action_variable('group') || !xprofile_get_field_group(bp_action_variable(1))) {
bp_do_404();
return;
}
// No errors
$errors = false;
// Check to see if any new information has been submitted
if (isset($_POST['field_ids'])) {
// Check the nonce
check_admin_referer('bp_xprofile_edit');
// Check we have field ID's
if (empty($_POST['field_ids'])) {
bp_core_redirect(trailingslashit(bp_displayed_user_domain() . $bp->profile->slug . '/edit/group/' . bp_action_variable(1)));
}
// Explode the posted field IDs into an array so we know which
// fields have been submitted
$posted_field_ids = wp_parse_id_list($_POST['field_ids']);
$is_required = array();
// Loop through the posted fields formatting any datebox values
// then validate the field
foreach ((array) $posted_field_ids as $field_id) {
if (!isset($_POST['field_' . $field_id])) {
if (!empty($_POST['field_' . $field_id . '_day']) && !empty($_POST['field_' . $field_id . '_month']) && !empty($_POST['field_' . $field_id . '_year'])) {
// Concatenate the values
$date_value = $_POST['field_' . $field_id . '_day'] . ' ' . $_POST['field_' . $field_id . '_month'] . ' ' . $_POST['field_' . $field_id . '_year'];
// Turn the concatenated value into a timestamp
$_POST['field_' . $field_id] = date('Y-m-d H:i:s', strtotime($date_value));
}
}
$is_required[$field_id] = xprofile_check_is_required_field($field_id);
if ($is_required[$field_id] && empty($_POST['field_' . $field_id])) {
$errors = true;
}
}
// There are errors
if (!empty($errors)) {
bp_core_add_message(__('Please make sure you fill in all required fields in this profile field group before saving.', 'buddypress'), 'error');
// No errors
} else {
// Reset the errors var
$errors = false;
// Now we've checked for required fields, lets save the values.
$old_values = $new_values = array();
foreach ((array) $posted_field_ids as $field_id) {
// Certain types of fields (checkboxes, multiselects) may come through empty. Save them as an empty array so that they don't get overwritten by the default on the next edit.
$value = isset($_POST['field_' . $field_id]) ? $_POST['field_' . $field_id] : '';
$visibility_level = !empty($_POST['field_' . $field_id . '_visibility']) ? $_POST['field_' . $field_id . '_visibility'] : 'public';
// Save the old and new values. They will be
// passed to the filter and used to determine
// whether an activity item should be posted
$old_values[$field_id] = array('value' => xprofile_get_field_data($field_id, bp_displayed_user_id()), 'visibility' => xprofile_get_field_visibility_level($field_id, bp_displayed_user_id()));
// Update the field data and visibility level
xprofile_set_field_visibility_level($field_id, bp_displayed_user_id(), $visibility_level);
$field_updated = xprofile_set_field_data($field_id, bp_displayed_user_id(), $value, $is_required[$field_id]);
$value = xprofile_get_field_data($field_id, bp_displayed_user_id());
$new_values[$field_id] = array('value' => $value, 'visibility' => xprofile_get_field_visibility_level($field_id, bp_displayed_user_id()));
if (!$field_updated) {
$errors = true;
} else {
/**
* Fires on each iteration of an XProfile field being saved with no error.
*
* @since BuddyPress (1.1.0)
*
* @param int $field_id ID of the field that was saved.
* @param string $value Value that was saved to the field.
*/
do_action('xprofile_profile_field_data_updated', $field_id, $value);
}
}
/**
* Fires after all XProfile fields have been saved for the current profile.
*
* @since BuddyPress (1.0.0)
*
* @param int $value Displayed user ID.
* @param array $posted_field_ids Array of field IDs that were edited.
* @param bool $errors Whether or not any errors occurred.
* @param array $old_values Array of original values before updated.
* @param array $new_values Array of newly saved values after update.
*/
//.........这里部分代码省略.........
开发者ID:kosir,项目名称:thatcamp-org,代码行数:101,代码来源:bp-xprofile-screens.php
示例8: bp_core_get_user_displayname
/**
* Fetch the display name for a user. This will use the "Name" field in xprofile if it is installed.
* Otherwise, it will fall back to the normal WP display_name, or user_nicename, depending on what has been set.
*
* @package BuddyPress Core
* @global object $bp Global BuddyPress settings object
* @uses wp_cache_get() Will try and fetch the value from the cache, rather than querying the DB again.
* @uses get_userdata() Fetches the WP userdata for a specific user.
* @uses xprofile_set_field_data() Will update the field data for a user based on field name and user id.
* @uses wp_cache_set() Adds a value to the cache.
* @return str The display name for the user in question.
*/
function bp_core_get_user_displayname($user_id_or_username)
{
global $bp;
$fullname = '';
if (!$user_id_or_username) {
return false;
}
if (!is_numeric($user_id_or_username)) {
$user_id = bp_core_get_userid($user_id_or_username);
} else {
$user_id = $user_id_or_username;
}
if (!$user_id) {
return false;
}
if (!($fullname = wp_cache_get('bp_user_fullname_' . $user_id, 'bp'))) {
if (bp_is_active('xprofile')) {
$fullname = xprofile_get_field_data(stripslashes($bp->site_options['bp-xprofile-fullname-field-name']), $user_id);
if (empty($fullname)) {
$ud = bp_core_get_core_userdata($user_id);
if (!empty($ud->display_name)) {
$fullname = $ud->display_name;
} elseif (!empty($ud->user_nicename)) {
$fullname = $ud->user_nicename;
}
xprofile_set_field_data(1, $user_id, $fullname);
}
} else {
$ud = bp_core_get_core_userdata($user_id);
if (!empty($ud->display_name)) {
$fullname = $ud->display_name;
} elseif (!empty($ud->user_nicename)) {
$fullname = $ud->user_nicename;
}
}
if (!empty($fullname)) {
wp_cache_set('bp_user_fullname_' . $user_id, $fullname, 'bp');
}
}
return apply_filters('bp_core_get_user_displayname', $fullname, $user_id);
}
开发者ID:hornetalcala,项目名称:trunk,代码行数:53,代码来源:bp-members-functions.php
示例9: get_fullname
public static function get_fullname($user_id = 0)
{
if (empty($user_id)) {
$user_id = bp_displayed_user_id();
}
$data = xprofile_get_field_data(bp_xprofile_fullname_field_id(), $user_id);
return $data[$field_name];
}
开发者ID:kd5ytx,项目名称:Empirical-Wordpress,代码行数:8,代码来源:bp-xprofile-classes.php
示例10: test_bp_core_get_user_displayname_xprofile_does_not_exist
/**
* @group bp_core_get_user_displayname
*/
public function test_bp_core_get_user_displayname_xprofile_does_not_exist()
{
$bp = buddypress();
$xprofile_is_active = bp_is_active('xprofile');
$bp->active_components['xprofile'] = '1';
$u = $this->factory->user->create(array('display_name' => 'Foo Foo'));
// Delete directly because BP won't let you delete a required
// field through the API
global $wpdb;
$wpdb->query($wpdb->prepare("DELETE FROM {$bp->profile->table_name_data} WHERE user_id = %d AND field_id = 1", $u));
wp_cache_delete('bp_user_fullname_' . $u, 'bp');
wp_cache_delete("{$u}:1", 'bp_xprofile_data');
$this->assertSame('', xprofile_get_field_data(1, $u));
$this->assertSame('Foo Foo', bp_core_get_user_displayname($u));
$this->assertSame('Foo Foo', xprofile_get_field_data(1, $u));
if (!$xprofile_is_active) {
unset($bp->active_components['xprofile']);
}
}
开发者ID:CompositeUK,项目名称:clone.BuddyPress,代码行数:22,代码来源:functions.php
示例11: xprofile_sync_wp_profile
/**
* Syncs Xprofile data to the standard built in WordPress profile data.
*
* @since 1.0.0
*
* @param int $user_id ID of the user to sync.
* @return bool
*/
function xprofile_sync_wp_profile($user_id = 0)
{
// Bail if profile syncing is disabled.
if (bp_disable_profile_sync()) {
return true;
}
if (empty($user_id)) {
$user_id = bp_loggedin_user_id();
}
if (empty($user_id)) {
return false;
}
$fullname = xprofile_get_field_data(bp_xprofile_fullname_field_id(), $user_id);
$space = strpos($fullname, ' ');
if (false === $space) {
$firstname = $fullname;
$lastname = '';
} else {
$firstname = substr($fullname, 0, $space);
$lastname = trim(substr($fullname, $space, strlen($fullname)));
}
bp_update_user_meta($user_id, 'nickname', $fullname);
bp_update_user_meta($user_id, 'first_name', $firstname);
bp_update_user_meta($user_id, 'last_name', $lastname);
wp_update_user(array('ID' => $user_id, 'display_name' => $fullname));
wp_cache_delete('bp_core_userdata_' . $user_id, 'bp');
}
开发者ID:CompositeUK,项目名称:clone.BuddyPress,代码行数:35,代码来源:bp-xprofile-functions.php
示例12: xprofile_sync_nxt_profile
/**
* Syncs Xprofile data to the standard built in NXTClass profile data.
*
* @package BuddyPress Core
*/
function xprofile_sync_nxt_profile($user_id = 0)
{
global $bp, $nxtdb;
if (!empty($bp->site_options['bp-disable-profile-sync']) && (int) $bp->site_options['bp-disable-profile-sync']) {
return true;
}
if (empty($user_id)) {
$user_id = $bp->loggedin_user->id;
}
if (empty($user_id)) {
return false;
}
$fullname = xprofile_get_field_data(bp_xprofile_fullname_field_name(), $user_id);
$space = strpos($fullname, ' ');
if (false === $space) {
$firstname = $fullname;
$lastname = '';
} else {
$firstname = substr($fullname, 0, $space);
$lastname = trim(substr($fullname, $space, strlen($fullname)));
}
update_user_meta($user_id, 'nickname', $fullname);
update_user_meta($user_id, 'first_name', $firstname);
update_user_meta($user_id, 'last_name', $lastname);
$nxtdb->query($nxtdb->prepare("UPDATE {$nxtdb->users} SET display_name = %s WHERE ID = %d", $fullname, $user_id));
}
开发者ID:nxtclass,项目名称:NXTClass,代码行数:31,代码来源:bp-xprofile-functions.php
示例13: bp_get_profile_field_data
/**
* Return XProfile field data.
*
* @since 1.2.0
*
* @param string|array $args {
* Array of arguments for field data.
*
* @type string|int|bool $field Field identifier.
* @type int $user_id ID of the user to get field data for.
* }
* @return mixed|void
*/
function bp_get_profile_field_data($args = '')
{
$r = wp_parse_args($args, array('field' => false, 'user_id' => bp_displayed_user_id()));
/**
* Filters the profile field data.
*
* @since 1.2.0
* @since 2.6.0 Added the `$r` parameter.
*
* @param mixed $value Profile data for a specific field for the user.
* @param array $r Array of parsed arguments.
*/
return apply_filters('bp_get_profile_field_data', xprofile_get_field_data($r['field'], $r['user_id']), $r);
}
开发者ID:CompositeUK,项目名称:clone.BuddyPress,代码行数:27,代码来源:bp-xprofile-template.php
示例14: has_student_caps
/**
* has_student_caps( $user_id )
*
* Checks if $user_id has response management capabilities
*
* @param Int $user_id ID of the user capabilities to be checked, default null
* @return True if $user_id is eligible and False if not.
*/
function has_student_caps($user_id = null)
{
global $bp;
if (!$user_id) {
$user_id = $bp->loggedin_user->id;
}
$user_role = xprofile_get_field_data(__('Role'), $user_id);
// Go away teacher
if (__('Student', 'bpsp') != $user_role && !empty($user_role)) {
return false;
}
// Treat super admins
if (is_super_admin($user_id)) {
$this->add_response_caps($user_id);
}
$user = new WP_User($user_id);
foreach ($this->students_caps as $c) {
if (!$user->has_cap($c)) {
$user->add_cap($c);
}
}
return true;
}
开发者ID:Nuttify,项目名称:buddypress-courseware,代码行数:31,代码来源:bpsp-responses.class.php
示例15: rw_boss_social_header
function rw_boss_social_header()
{
?>
<div class="btn-group social">
<?php
foreach (rw_boss_get_user_social_array() as $social => $arr) {
$url = xprofile_get_field_data($social, bp_displayed_user_id(), 'comma');
$ico = empty($arr['icon-url']) ? '<i class="alt-social-icon alt-' . $social . '"></i>' : '<img class="user-social-icons-btn" src="' . $arr['icon-url'] . '">';
if (!empty($url)) {
?>
<a class="btn" href="<?php
echo $url;
?>
" title="<?php
echo esc_attr($arr['title']);
?>
"><?php
echo $ico;
?>
</a>
<?php
}
?>
<?php
}
?>
</div>
<?php
}
开发者ID:rpi-virtuell,项目名称:rw-social-learner,代码行数:29,代码来源:rw_functions.php
示例16: bp_profile_updated
/**
* Handles BP profile saving action
*
* @global object $current_user
* @param int $user_id
* @param array $posted_field_ids
* @param array $errors
* @author korotkov@UD
*/
static function bp_profile_updated($user_id, $posted_field_ids, $errors)
{
global $current_user, $bp;
if (is_admin()) {
return;
}
//** Get new user_data from POST */
$user_data = $_REQUEST['wp_crm']['user_data'];
//** user_id is required */
$user_data['user_id'][0]['value'] = $user_id;
//** user_email is required */
if (!array_key_exists('user_email', $user_data)) {
$user_data['user_email'][0]['value'] = $current_user->user_email;
}
//** Change display name if xprofile full name exists */
$fullname_field_name = bp_xprofile_fullname_field_name();
$fullname_field_id = xprofile_get_field_id_from_name($fullname_field_name);
if (in_array($fullname_field_id, $posted_field_ids)) {
$display_name = xprofile_get_field_data($fullname_field_name, $user_id);
$user_data['display_name'] = $display_name;
}
//** Save user data */
$user_id = wp_crm_save_user_data($user_data);
//** Determine if user changed nicename (display name in URL). peshkov@UD */
if ($user_id && isset($user_data['user_nicename'])) {
$user_domain = bp_displayed_user_domain();
$userdata = get_userdata($user_id);
$user_nicename = $userdata->data->user_nicename;
$needle = bp_get_members_root_slug() . '/' . $user_nicename . '/';
$pos = strpos($user_domain, $needle);
if ($pos === false) {
//** Looks like user_nicename was changed so redirect to the new profile's URL. */
$user_domain = str_replace($bp->displayed_user->userdata->user_nicename, $user_nicename, $user_domain);
if ($errors) {
bp_core_add_message(__('There was a problem updating some of your profile information, please try again.', ud_get_wp_crm()->domain), 'error');
} else {
bp_core_add_message(__('Changes saved.', ud_get_wp_crm()->domain));
}
//* Redirect back to the edit screen to display the updates and message */
bp_core_redirect(trailingslashit($user_domain . $bp->profile->slug . '/edit/group/' . bp_action_variable(1)));
}
}
}
开发者ID:Finzy,项目名称:stageDB,代码行数:52,代码来源:buddypress.php
示例17: add_bulk_students
function add_bulk_students()
{
$course_id = $_POST['course'];
if (!isset($_POST['security']) || !wp_verify_nonce($_POST['security'], 'security' . $course_id)) {
echo 'Security check failed !';
die;
}
$members = $_POST['members'];
$member_ids = array();
if (!is_Array($members)) {
$members = stripslashes($members);
if (strpos($members, ',')) {
$members = explode(',', $members);
} else {
$members = array($members);
}
}
$html = '';
foreach ($members as $member) {
if (is_numeric($member)) {
$user_id = $member;
} else {
if (filter_var($member, FILTER_VALIDATE_EMAIL)) {
$user_id = email_exists($member);
} else {
$user_id = bp_core_get_userid_from_nicename($member);
}
}
if (!empty($user_id)) {
$force_flag = apply_filters('wplms_force_flag_bulk_add_students', 1, $course_id, $user_id);
$check = bp_course_add_user_to_course($user_id, $course_id, '', $force_flag);
if ($check) {
$field = vibe_get_option('student_field');
if (!isset($field) || !$field) {
$field = 'Location';
}
$html .= '<li id="s' . $user_id . '">
<input type="checkbox" class="member" value="' . $user_id . '">
' . bp_core_fetch_avatar(array('item_id' => $user_id, 'type' => 'full')) . '
<h6>' . bp_core_get_userlink($user_id) . '</h6><span>' . (function_exists('xprofile_get_field_data') ? xprofile_get_field_data($field, $user_id) : '') . '</span><ul>
<li><a class="tip reset_course_user" data-course="' . $course_id . '" data-user="' . $user_id . '" title="" data-original-title="' . __('Reset Course for User', 'vibe') . '"><i class="icon-reload"></i></a></li>
<li><a class="tip course_stats_user" data-course="' . $course_id . '" data-user="' . $user_id . '" title="" data-original-title="' . __('See Course stats for User', 'vibe') . '"><i class="icon-bars"></i></a></li>
<li><a class="tip remove_user_course" data-course="' . $course_id . '" data-user="' . $user_id . '" title="" data-original-title="' . __('Remove User from this Course', 'vibe') . '"><i class="icon-x"></i></a></li>
</ul></li>';
$member_ids[] = $user_id;
}
}
}
echo $html;
if (!empty($member_ids)) {
foreach ($member_ids as $member_id) {
do_action('wplms_course_subscribed', $course_id, $user_id);
}
do_action('wplms_bulk_action', 'added_students', $course_id, $member_ids);
}
die;
}
开发者ID:nikitansk,项目名称:devschool,代码行数:57,代码来源:bp-course-ajax.php
示例18: td_bpxps_xprofile_shortcode
function td_bpxps_xprofile_shortcode($attributes)
{
global $wpdb;
if (empty($attributes['field'])) {
return false;
}
extract($attributes);
$urlWithOutSlash = 'http://' . $_SERVER['HTTP_HOST'];
$thisUserId = $wpdb->get_var($wpdb->prepare("SELECT ID FROM {$wpdb->users} WHERE user_url = %s LIMIT 1", $urlWithOutSlash));
// $user_id = (isset($user)) ? $user : false;
$user_id = $thisUserId;
global $bp;
if (!empty($user_id) && intval($user_id) === 0) {
// shortcode-defined username
$user_id = get_user_id_from_string(get_blog_option($thisblog, 'admin_email'));
}
if (isset($user) && $user == 'displayed' || empty($user_id) && isset($bp->displayed_user->id)) {
// On profile page, show the displayed user's information
$user_id = $bp->displayed_user->id;
}
global $post;
if (isset($user) && $user == 'author' || empty($user_id) && !empty($post->post_author)) {
// On author or single post page, show the author's information
$user_id = $post->post_author;
}
if (isset($user) && $user == 'current' || empty($user_id) && is_user_logged_in()) {
// Show the currently logged in user's information
$user_id = get_current_user_id();
}
if (empty($user_id)) {
return false;
}
return xprofile_get_field_data($field, $user_id);
}
开发者ID:novichkovv,项目名称:candoweightloss,代码行数:34,代码来源:mako-user-blogs.php
示例19: get_users_by_date
break;
}
}
}
// Processing users count by gender and age groups
$users = get_users_by_date($date, $lesson_id);
foreach ($users as $user) {
$gender = xprofile_get_field_data('gender', $user['user_id']);
if ($gender == "male" || $gender == "муж") {
$days[$date->format('Y-m-d')]['male']++;
} else {
if ($gender == "female" || $gender == "жен" || $gender == "женский" || $gender == "F") {
$days[$date->format('Y-m-d')]['female']++;
}
}
$age = xprofile_get_field_data('age', $user['user_id']);
if ($age >= 18 && $age <= 24) {
$days[$date->format('Y-m-d')]['18-24']++;
} elseif ($age >= 25 && $age <= 34) {
$days[$date->format('Y-m-d')]['25-34']++;
} elseif ($age >= 35 && $age <= 44) {
$days[$date->format('Y-m-d')]['35-44']++;
} elseif ($age >= 45 && $age <= 54) {
$days[$date->format('Y-m-d')]['45-54']++;
} elseif ($age >= 55) {
$days[$date->format('Y-m-d')]['55plus']++;
}
}
$total_forum += $days[$date->format('Y-m-d')]['forum'];
$total_archive += $days[$date->format('Y-m-d')]['archive'];
$total_webinarTT += $days[$date->format('Y-m-d')]['webinarTT'];
开发者ID:Bnei-Baruch,项目名称:namaste-reports-csv,代码行数:31,代码来源:all-reports.php
示例20: getUserFieldList
public static function getUserFieldList($user_id = 0)
{
$user_id = $user_id == 0 ? get_current_user_id() : $user_id;
$fieldList = array('first_name' => array('val' => '', 'type' => 'wp', 'translate' => __('Your First Name', 'cfef')), 'last_name' => array('val' => '', 'type' => 'wp', 'translate' => __('Last Name', 'cfef')), 'display_name' => array('val' => '', 'type' => 'wp', 'translate' => __('Display Name', 'cfef')), 'user_email' => array('val' => '', 'type' => 'wp', 'translate' => __('Email', 'cfef')));
foreach (get_option('mailChimpFieldList') as $key => $val) {
$fieldVal = $user_id == -1 ? "" : xprofile_get_field_data($val, $user_id);
$fieldList[$val] = array('val' => $fieldVal, 'type' => 'bp', 'translate' => __($val, 'cfef'));
}
if ($user_id == -1) {
return $fieldList;
}
$currentUser = get_user_by("id", $user_id);
$fieldList['last_name']['val'] = get_userdata($user_id)->last_name;
$fieldList['first_name']['val'] = get_userdata($user_id)->first_name;
$fieldList['display_name']['val'] = $currentUser->data->display_name;
$fieldList['user_email']['val'] = $currentUser->data->user_email;
return $fieldList;
}
开发者ID:Bnei-Baruch,项目名称:mailchimpNamasteIntegration,代码行数:18,代码来源:RregistrationFormShortcode.php
注:本文中的xprofile_get_field_data函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论