本文整理汇总了PHP中um_fetch_user函数的典型用法代码示例。如果您正苦于以下问题:PHP um_fetch_user函数的具体用法?PHP um_fetch_user怎么用?PHP um_fetch_user使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了um_fetch_user函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: um_get_avatar
function um_get_avatar($avatar = '', $id_or_email = '', $size = '96', $avatar_class = '', $default = '', $alt = '')
{
if (is_numeric($id_or_email)) {
$user_id = (int) $id_or_email;
} elseif (is_string($id_or_email) && ($user = get_user_by('email', $id_or_email))) {
$user_id = $user->ID;
} elseif (is_object($id_or_email) && !empty($id_or_email->user_id)) {
$user_id = (int) $id_or_email->user_id;
}
if (empty($user_id)) {
return $avatar;
}
um_fetch_user($user_id);
$avatar = um_user('profile_photo', $size);
if (!$avatar && um_get_option('use_gravatars')) {
$default = get_option('avatar_default', 'mystery');
if ($default == 'gravatar_default') {
$default = '';
}
$rating = get_option('avatar_rating');
if (!empty($rating)) {
$rating = "&r={$rating}";
}
$avatar_url = um_get_domain_protocol() . 'gravatar.com/avatar/' . um_user('synced_gravatar_hashed_id');
$avatar = '<img src="' . $avatar_url . '?d=' . $default . '&s=' . $size . $rating . '" class="func-um_get_avatar gravatar avatar avatar-' . $size . ' um-avatar" width="' . $size . '" height="' . $size . '" alt="" />';
} else {
if (empty($avatar)) {
$default_avatar_uri = um_get_default_avatar_uri();
$avatar = '<img src="' . $default_avatar_uri . '" class="gravatar avatar avatar-' . $size . ' um-avatar" width="' . $size . '" height="' . $size . '" alt="" />';
}
}
return $avatar;
}
示例2: um_get_avatar
function um_get_avatar($avatar = '', $id_or_email = '', $size = '96', $avatar_class = '', $default = '', $alt = '')
{
if (is_numeric($id_or_email)) {
$user_id = (int) $id_or_email;
} elseif (is_string($id_or_email) && ($user = get_user_by('email', $id_or_email))) {
$user_id = $user->ID;
} elseif (is_object($id_or_email) && !empty($id_or_email->user_id)) {
$user_id = (int) $id_or_email->user_id;
}
if (empty($user_id)) {
return $avatar;
}
um_fetch_user($user_id);
$avatar = um_user('profile_photo', $size);
if (!um_profile('profile_photo') && um_get_option('use_gravatars')) {
if (is_ssl()) {
$protocol = 'https://';
} else {
$protocol = 'http://';
}
$default = get_option('avatar_default', 'mystery');
if ($default == 'gravatar_default') {
$default = '';
}
$rating = get_option('avatar_rating');
if (!empty($rating)) {
$rating = "&r={$rating}";
}
$avatar = '<img src="' . $protocol . 'gravatar.com/avatar/' . md5(um_user('user_email')) . '?d=' . $default . '&s=' . $size . $rating . '" class="gravatar avatar avatar-' . $size . ' um-avatar" width="' . $size . '" height="' . $size . '" alt="" />';
}
return $avatar;
}
示例3: um_submit_form_errors_hook_logincheck
function um_submit_form_errors_hook_logincheck($args)
{
global $ultimatemember;
// Logout if logged in
if (is_user_logged_in()) {
wp_logout();
}
$user_id = isset($ultimatemember->login->auth_id) ? $ultimatemember->login->auth_id : '';
um_fetch_user($user_id);
$status = um_user('account_status');
// account status
switch ($status) {
// If user can't login to site...
case 'inactive':
case 'awaiting_admin_review':
case 'awaiting_email_confirmation':
case 'rejected':
um_reset_user();
exit(wp_redirect(add_query_arg('err', esc_attr($status), $ultimatemember->permalinks->get_current_url())));
break;
}
if (isset($args['form_id']) && $args['form_id'] == $ultimatemember->shortcodes->core_login_form() && $ultimatemember->form->errors && !isset($_POST[$ultimatemember->honeypot])) {
exit(wp_redirect(um_get_core_page('login')));
}
}
示例4: um_after_changing_user_password
function um_after_changing_user_password($user_id)
{
global $ultimatemember;
um_fetch_user($user_id);
$ultimatemember->mail->send(um_user('user_email'), 'changedpw_email');
um_reset_user();
}
示例5: um_admin_user_actions_hook
function um_admin_user_actions_hook($actions)
{
$actions = null;
if (!um_user('super_admin')) {
if (um_user('account_status') == 'awaiting_admin_review') {
$actions['um_approve_membership'] = array('label' => __('Approve Membership', 'ultimatemember'));
$actions['um_reject_membership'] = array('label' => __('Reject Membership', 'ultimatemember'));
}
if (um_user('account_status') == 'rejected') {
$actions['um_approve_membership'] = array('label' => __('Approve Membership', 'ultimatemember'));
}
if (um_user('account_status') == 'approved') {
$actions['um_put_as_pending'] = array('label' => __('Put as Pending Review', 'ultimatemember'));
}
if (um_user('account_status') == 'awaiting_email_confirmation') {
$actions['um_resend_activation'] = array('label' => __('Resend Activation E-mail', 'ultimatemember'));
}
if (um_user('account_status') != 'inactive') {
$actions['um_deactivate'] = array('label' => __('Deactivate this account', 'ultimatemember'));
}
if (um_user('account_status') == 'inactive') {
$actions['um_reenable'] = array('label' => __('Reactivate this account', 'ultimatemember'));
}
if (um_current_user_can('delete', um_profile_id())) {
$actions['um_delete'] = array('label' => __('Delete this user', 'ultimatemember'));
}
}
if (current_user_can('delete_users')) {
$actions['um_switch_user'] = array('label' => __('Login as this user', 'ultimatemember'));
}
um_fetch_user(um_profile_id());
return $actions;
}
示例6: redirect_author_page
function redirect_author_page()
{
if (um_get_option('author_redirect') && is_author()) {
$id = get_query_var('author');
um_fetch_user($id);
exit(wp_redirect(um_user_profile_url()));
}
}
示例7: um_send_password_change_email
/**
* Overrides password changed notification
*
*/
function um_send_password_change_email($args)
{
global $ultimatemember;
um_fetch_user($user_id);
$ultimatemember->user->password_changed();
um_reset_user();
return false;
}
示例8: check_for_querystrings
function check_for_querystrings()
{
global $ultimatemember;
if (isset($_REQUEST['message'])) {
$ultimatemember->shortcodes->message_mode = true;
}
if (isset($_REQUEST['message']) && isset($_REQUEST['uid'])) {
um_fetch_user($_REQUEST['uid']);
}
}
示例9: um_display_logout_form
function um_display_logout_form($args)
{
global $ultimatemember;
if (is_user_logged_in() && isset($args['mode']) && $args['mode'] == 'login') {
if (get_current_user_id() != um_user('ID')) {
um_fetch_user(get_current_user_id());
}
$args['template'] = 'logout';
}
return $args;
}
示例10: um_dynamic_user_profile_pagetitle
function um_dynamic_user_profile_pagetitle($title, $sep = '')
{
global $paged, $page, $ultimatemember;
$profile_title = um_get_option('profile_title');
if (um_is_core_page('user') && um_get_requested_user()) {
um_fetch_user(um_get_requested_user());
$profile_title = $ultimatemember->mail->convert_tags($profile_title);
$title = $profile_title;
um_reset_user();
}
return $title;
}
示例11: um_control_admin_bar
function um_control_admin_bar()
{
if (um_user('can_not_see_adminbar')) {
return false;
}
if (!is_admin() && !um_user('can_access_wpadmin')) {
return false;
} else {
um_fetch_user(get_current_user_id());
return true;
}
}
示例12: um_add_custom_message_to_menu
function um_add_custom_message_to_menu($items, $args)
{
global $ultimatemember;
// this feature required logged in user
if (!is_user_logged_in()) {
return $items;
}
um_fetch_user(get_current_user_id());
$items = $ultimatemember->shortcodes->convert_user_tags($items);
um_reset_user();
return $items;
}
示例13: listen_to_password_reset_uri
function listen_to_password_reset_uri()
{
global $ultimatemember;
if (isset($_REQUEST['act']) && $_REQUEST['act'] == 'reset_password' && isset($_REQUEST['hash']) && strlen($_REQUEST['hash']) == 40 && isset($_REQUEST['user_id']) && is_numeric($_REQUEST['user_id'])) {
um_fetch_user($_REQUEST['user_id']);
if ($_REQUEST['hash'] != um_user('reset_pass_hash')) {
wp_die(__('This is not a valid hash, or it has expired.', 'ultimatemember'));
}
$ultimatemember->user->profile['reset_pass_hash_token'] = current_time('timestamp');
$ultimatemember->user->update_usermeta_info('reset_pass_hash_token');
$this->change_password = true;
um_reset_user();
}
}
示例14: um_comment_link_to_profile
function um_comment_link_to_profile($return)
{
global $comment, $ultimatemember;
if (isset($comment->user_id) && !empty($comment->user_id)) {
if (isset($ultimatemember->user->cached_user[$comment->user_id]) && $ultimatemember->user->cached_user[$comment->user_id]) {
$return = '<a href="' . $ultimatemember->user->cached_user[$comment->user_id]['url'] . '">' . $ultimatemember->user->cached_user[$comment->user_id]['name'] . '</a>';
} else {
um_fetch_user($comment->user_id);
$ultimatemember->user->cached_user[$comment->user_id] = array('url' => um_user_profile_url(), 'name' => um_user('display_name'));
$return = '<a href="' . $ultimatemember->user->cached_user[$comment->user_id]['url'] . '">' . $ultimatemember->user->cached_user[$comment->user_id]['name'] . '</a>';
um_reset_user();
}
}
return $return;
}
示例15: um_remove_unused_uploads
function um_remove_unused_uploads($user_id)
{
global $ultimatemember;
um_fetch_user($user_id);
$array = $ultimatemember->user->profile;
$files = glob(um_user_uploads_dir() . '*', GLOB_BRACE);
if (file_exists(um_user_uploads_dir()) && $files && isset($array) && is_array($array)) {
foreach ($files as $file) {
$str = basename($file);
if (!strstr($str, 'profile_photo') && !strstr($str, 'cover_photo') && !strstr($str, 'stream_photo') && !preg_grep('/' . $str . '/', $array)) {
unlink($file);
}
}
}
}