当前位置: 首页>>代码示例>>PHP>>正文


PHP um_user函数代码示例

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


在下文中一共展示了um_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 (!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


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