• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP um_user函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中um_user函数的典型用法代码示例。如果您正苦于以下问题:PHP um_user函数的具体用法?PHP um_user怎么用?PHP um_user使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了um_user函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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 (!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 . '&amp;s=' . $size . $rating . '" class="gravatar avatar avatar-' . $size . ' um-avatar" width="' . $size . '" height="' . $size . '" alt="" />';
    }
    return $avatar;
}
开发者ID:BurlesonBrad,项目名称:ultimatemember,代码行数:32,代码来源:um-filters-avatars.php


示例2: 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;
}
开发者ID:emaxees,项目名称:elpandecadadia,代码行数:33,代码来源:um-filters-user.php


示例3: 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();
}
开发者ID:Ksajikyan,项目名称:poiskuslug,代码行数:7,代码来源:um-actions-password.php


示例4: um_control_admin_bar

function um_control_admin_bar($content)
{
    if (um_user('can_not_see_adminbar')) {
        return false;
    }
    return $content;
}
开发者ID:CoolWP,项目名称:ultimatemember,代码行数:7,代码来源:um-actions-wpadmin.php


示例5: custom_update_profile

function custom_update_profile($user_id)
{
    global $ultimatemember;
    um_fetch_user($user_id);
    $profilefirstname = um_user('first_name');
    update_user_meta($user_id, 'billing_first_name', $profilefirstname);
    update_user_meta($user_id, 'shipping_first_name', $profilefirstname);
    $profilelastname = um_user('last_name');
    update_user_meta($user_id, 'billing_last_name', $profilelastname);
    update_user_meta($user_id, 'shipping_last_name', $profilelastname);
    $profileaddress1 = um_user('street_address');
    update_user_meta($user_id, 'billing_address_1', $profileaddress1);
    update_user_meta($user_id, 'shipping_address_1', $profileaddress1);
    $profileaddress2 = um_user('address2');
    update_user_meta($user_id, 'billing_address_2', $address2);
    update_user_meta($user_id, 'shipping_address_2', $address2);
    $profilecity = um_user('city');
    update_user_meta($user_id, 'billing_city', $profilecity);
    update_user_meta($user_id, 'shipping_city', $profilecity);
    $profilezip_code = um_user('zip_code');
    update_user_meta($user_id, 'billing_postcode', $profilezip_code);
    update_user_meta($user_id, 'shipping_postcode', $profilezip_code);
    $profileemail = um_user('user_email');
    update_user_meta($user_id, 'billing_email', $profileemail);
    $profilephone = um_user('phone_number');
    update_user_meta($user_id, 'billing_phone', $profilephone);
    return $user_id;
}
开发者ID:keyshames,项目名称:tcm2016,代码行数:28,代码来源:functions.20151230.php


示例6: 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 = "&amp;r={$rating}";
        }
        $avatar_url = um_get_domain_protocol() . 'gravatar.com/avatar/' . um_user('synced_gravatar_hashed_id');
        $avatar = '<img src="' . $avatar_url . '?d=' . $default . '&amp;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;
}
开发者ID:CoolWP,项目名称:ultimatemember,代码行数:33,代码来源:um-filters-avatars.php


示例7: um_profile_content_edudash_default

function um_profile_content_edudash_default($args)
{
    // Admin Role Check
    if (um_user('role_name') == 'EM Faculty') {
        get_template_part('edudash');
    } else {
        echo "Sorry but you need to have educator access to view this tab.";
    }
}
开发者ID:Cgaafary,项目名称:ALiEMU-Child-Theme-Repository,代码行数:9,代码来源:functions.php


示例8: reset_url

 function reset_url()
 {
     global $ultimatemember;
     if (!um_user('reset_pass_hash')) {
         return false;
     }
     $url = add_query_arg('act', 'reset_password', um_get_core_page('password-reset'));
     $url = add_query_arg('hash', esc_attr(um_user('reset_pass_hash')), $url);
     $url = add_query_arg('user_id', esc_attr(um_user('ID')), $url);
     return $url;
 }
开发者ID:Zurtr,项目名称:ultimatemember,代码行数:11,代码来源:um-password.php


示例9: 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;
    }
}
开发者ID:Zurtr,项目名称:ultimatemember,代码行数:12,代码来源:um-actions-wpadmin.php


示例10: 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;
}
开发者ID:dracudakid,项目名称:WP_TrungTamTinHoc,代码行数:15,代码来源:um-filters-commenting.php


示例11: um_shortcode_args_filter

function um_shortcode_args_filter($args)
{
    global $ultimatemember;
    if ($ultimatemember->shortcodes->message_mode == true) {
        $args['template'] = 'message';
        $ultimatemember->shortcodes->custom_message = um_user(um_user('status') . '_message');
        um_reset_user();
    }
    foreach ($args as $k => $v) {
        if ($ultimatemember->validation->is_serialized($args[$k])) {
            if (!empty($args[$k])) {
                $args[$k] = unserialize($args[$k]);
            }
        }
    }
    return $args;
}
开发者ID:smithsa,项目名称:daily-job-hunter,代码行数:17,代码来源:um-filters-arguments.php


示例12: um_account_page_default_tabs_hook

function um_account_page_default_tabs_hook($tabs)
{
    global $ultimatemember;
    foreach ($tabs as $k => $arr) {
        foreach ($arr as $id => $info) {
            $output = $ultimatemember->account->get_tab_output($id);
            if (!$output) {
                unset($tabs[$k][$id]);
            }
            if ($id == 'delete') {
                if (!um_user('can_delete_profile') && !um_user('can_delete_everyone')) {
                    unset($tabs[$k][$id]);
                }
            }
        }
    }
    return $tabs;
}
开发者ID:dracudakid,项目名称:WP_TrungTamTinHoc,代码行数:18,代码来源:um-filters-account.php


示例13: um_conditional_nav_menu

 function um_conditional_nav_menu($items, $menu, $args)
 {
     $hide_children_of = array();
     foreach ($items as $key => $item) {
         $mode = get_post_meta($item->ID, 'menu-item-um_nav_public', true);
         $roles = get_post_meta($item->ID, 'menu-item-um_nav_roles', true);
         $visible = true;
         // hide any item that is the child of a hidden item
         if (in_array($item->menu_item_parent, $hide_children_of)) {
             $visible = false;
             $hide_children_of[] = $item->ID;
             // for nested menus
         }
         if (isset($mode) && $visible) {
             switch ($mode) {
                 case 2:
                     if (is_user_logged_in() && isset($roles) && !empty($roles)) {
                         if (in_array(um_user('role'), (array) $roles)) {
                             $visible = true;
                         } else {
                             $visible = false;
                         }
                     } else {
                         $visible = is_user_logged_in() ? true : false;
                     }
                     break;
                 case 1:
                     $visible = !is_user_logged_in() ? true : false;
                     break;
             }
         }
         // add filter to work with plugins that don't use traditional roles
         $visible = apply_filters('um_nav_menu_roles_item_visibility', $visible, $item);
         // unset non-visible item
         if (!$visible) {
             $hide_children_of[] = $item->ID;
             // store ID of item
             unset($items[$key]);
         }
     }
     return $items;
 }
开发者ID:Zurtr,项目名称:ultimatemember,代码行数:42,代码来源:um-filters-navmenu.php


示例14: logout_page

 function logout_page()
 {
     if (um_is_core_page('logout')) {
         if (is_user_logged_in()) {
             if (isset($_REQUEST['redirect_to']) && $_REQUEST['redirect_to'] !== '') {
                 $redirect_to = $_REQUEST['redirect_to'];
             } else {
                 if (um_user('after_logout') == 'redirect_home') {
                     $redirect_to = home_url();
                 } else {
                     $redirect_to = um_user('logout_redirect_url');
                 }
             }
             wp_logout();
             exit(wp_redirect($redirect_to));
         } else {
             um_redirect_home();
         }
     }
 }
开发者ID:BurlesonBrad,项目名称:ultimatemember,代码行数:20,代码来源:um-logout.php


示例15: um_update_profile_full_name

function um_update_profile_full_name($changes)
{
    global $ultimatemember;
    if (isset($changes['first_name']) && isset($changes['last_name'])) {
        if ($changes['first_name'] && $changes['last_name'] && um_get_option('display_name') != 'public_name') {
            wp_update_user(array('ID' => $ultimatemember->user->id, 'display_name' => $changes['first_name'] . ' ' . $changes['last_name']));
            $full_name = $changes['first_name'] . '.' . $changes['last_name'];
        } else {
            $full_name = $ultimatemember->user->profile['display_name'];
        }
        $full_name = $ultimatemember->validation->safe_name_in_url($full_name);
        /* duplicate or not */
        if ($ultimatemember->user->user_has_metadata('full_name', $full_name)) {
            $duplicates = $ultimatemember->user->user_has_metadata('full_name', $full_name);
            if (!get_option("um_duplicate_name_{$full_name}")) {
                update_option("um_duplicate_name_{$full_name}", $duplicates);
                $full_name = $full_name . '.' . $duplicates;
            } else {
                if (um_user('_duplicate_id')) {
                    $duplicates = um_user('_duplicate_id');
                } else {
                    $duplicates = get_option("um_duplicate_name_{$full_name}") + 1;
                    update_option("um_duplicate_name_{$full_name}", $duplicates);
                    update_user_meta($ultimatemember->user->id, '_duplicate_id', $duplicates);
                }
                $full_name = $full_name . '.' . $duplicates;
            }
        } else {
            if (um_user('_duplicate_id') && $full_name != str_replace('.' . um_user('_duplicate_id'), '', um_user('full_name'))) {
                $duplicates = um_user('_duplicate_id');
                $full_name = str_replace('.' . um_user('_duplicate_id'), '', $full_name);
            }
        }
        update_user_meta($ultimatemember->user->id, 'full_name', $full_name);
    }
    if (um_get_option('display_name') === 'public_name') {
        update_user_meta($ultimatemember->user->id, 'display_name', $changes['display_name']);
    }
}
开发者ID:Zurtr,项目名称:ultimatemember,代码行数:39,代码来源:um-actions-save-profile.php


示例16: um_wp_form_errors_hook_logincheck

function um_wp_form_errors_hook_logincheck($user, $username, $password)
{
    remove_filter('authenticate', 'wp_authenticate_username_password', 20, 3);
    if (isset($user->ID)) {
        um_fetch_user($user->ID);
        $status = um_user('account_status');
        switch ($status) {
            case 'inactive':
                return new WP_Error($status, __('Ваш аккаунт был отключен.', 'ultimatemember'));
                break;
            case 'awaiting_admin_review':
                return new WP_Error($status, __('Ваш аккаунт не был одобрен еще.', 'ultimatemember'));
                break;
            case 'awaiting_email_confirmation':
                return new WP_Error($status, __('Ваша учетная запись ожидает проверки электронной почты.', 'ultimatemember'));
                break;
            case 'rejected':
                return new WP_Error($status, __('Ваш запрос на вступление была отклонена.', 'ultimatemember'));
                break;
        }
    }
    return wp_authenticate_username_password(null, $username, $password);
}
开发者ID:Ksajikyan,项目名称:poiskuslug,代码行数:23,代码来源:um-filters-login.php


示例17: um_wp_form_errors_hook_logincheck

function um_wp_form_errors_hook_logincheck($user, $username, $password)
{
    remove_filter('authenticate', 'wp_authenticate_username_password', 20, 3);
    if (isset($user->ID)) {
        um_fetch_user($user->ID);
        $status = um_user('account_status');
        switch ($status) {
            case 'inactive':
                return new WP_Error($status, __('Your account has been disabled.', 'ultimatemember'));
                break;
            case 'awaiting_admin_review':
                return new WP_Error($status, __('Your account has not been approved yet.', 'ultimatemember'));
                break;
            case 'awaiting_email_confirmation':
                return new WP_Error($status, __('Your account is awaiting e-mail verification.', 'ultimatemember'));
                break;
            case 'rejected':
                return new WP_Error($status, __('Your membership request has been rejected.', 'ultimatemember'));
                break;
        }
    }
    return wp_authenticate_username_password($user, $username, $password);
}
开发者ID:Zurtr,项目名称:ultimatemember,代码行数:23,代码来源:um-filters-login.php


示例18: logout_page

 function logout_page()
 {
     if (um_is_core_page('logout')) {
         if (is_user_logged_in()) {
             if (isset($_REQUEST['redirect_to']) && $_REQUEST['redirect_to'] !== '') {
                 wp_logout();
                 session_unset();
                 exit(wp_redirect($_REQUEST['redirect_to']));
             } else {
                 if (um_user('after_logout') == 'redirect_home') {
                     wp_logout();
                     session_unset();
                     um_redirect_home();
                 } else {
                     wp_logout();
                     session_unset();
                     exit(wp_redirect(um_user('logout_redirect_url')));
                 }
             }
         } else {
             um_redirect_home();
         }
     }
 }
开发者ID:TeamSubjectMatter,项目名称:juddfoundation,代码行数:24,代码来源:um-logout.php


示例19: um_user

<div class="um <?php 
echo $this->get_class($mode);
?>
 um-<?php 
echo $form_id;
?>
 um-role-<?php 
echo um_user('role');
?>
 ">

	<div class="um-form">
	
		<?php 
do_action('um_profile_before_header', $args);
?>
		
		<?php 
if (um_is_on_edit_profile()) {
    ?>
<form method="post" action=""><?php 
}
?>
		
			<?php 
do_action('um_profile_header_cover_area', $args);
?>
			
			<?php 
do_action('um_profile_header', $args);
?>
开发者ID:vanlong200880,项目名称:tmdt,代码行数:31,代码来源:profile.php


示例20: um_access_post_settings

function um_access_post_settings()
{
    global $post, $ultimatemember;
    // woo commerce shop ID
    if (function_exists('is_shop') && is_shop()) {
        $post_id = get_option('woocommerce_shop_page_id');
    } else {
        if (is_archive() || is_front_page() || is_search() || in_the_loop()) {
            return;
        } else {
            if (!get_post_type() || !isset($post->ID)) {
                return;
            }
        }
    }
    if (!isset($post_id)) {
        $post_id = $post->ID;
    }
    $args = $ultimatemember->access->get_meta($post_id);
    extract($args);
    if (!isset($args['custom_access_settings']) || $args['custom_access_settings'] == 0) {
        $post_id = apply_filters('um_access_control_for_parent_posts', $post_id);
        $args = $ultimatemember->access->get_meta($post_id);
        extract($args);
        if (!isset($args['custom_access_settings']) || $args['custom_access_settings'] == 0) {
            return;
        }
    }
    $redirect_to = null;
    if (!isset($accessible)) {
        return;
    }
    switch ($accessible) {
        case 0:
            $ultimatemember->access->allow_access = true;
            $ultimatemember->access->redirect_handler = false;
            // open to everyone
            break;
        case 1:
            if (is_user_logged_in()) {
                $redirect_to = $access_redirect2;
            }
            if (!is_user_logged_in()) {
                $ultimatemember->access->allow_access = true;
            }
            break;
        case 2:
            if (!is_user_logged_in()) {
                if (!$access_redirect) {
                    $access_redirect = um_get_core_page('login');
                }
                $redirect_to = $access_redirect;
            }
            if (is_user_logged_in() && isset($access_roles) && !empty($access_roles)) {
                if (!in_array(um_user('role'), unserialize($access_roles))) {
                    if (!$access_redirect) {
                        if (is_user_logged_in()) {
                            $access_redirect = home_url();
                        } else {
                            $access_redirect = um_get_core_page('login');
                        }
                    }
                    $redirect_to = $access_redirect;
                }
            }
            break;
    }
    if ($redirect_to) {
        if (is_feed()) {
        } else {
            $ultimatemember->access->allow_access = false;
            $ultimatemember->access->redirect_handler = $redirect_to;
        }
    }
}
开发者ID:Zurtr,项目名称:ultimatemember,代码行数:75,代码来源:um-actions-access.php



注:本文中的um_user函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP um_user_can函数代码示例发布时间:2022-05-23
下一篇:
PHP um_reset_user函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap