本文整理汇总了PHP中um_get_option函数的典型用法代码示例。如果您正苦于以下问题:PHP um_get_option函数的具体用法?PHP um_get_option怎么用?PHP um_get_option使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了um_get_option函数的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 . '&s=' . $size . $rating . '" class="gravatar avatar avatar-' . $size . ' um-avatar" width="' . $size . '" height="' . $size . '" alt="" />';
}
return $avatar;
}
示例2: tracking_allowed
private function tracking_allowed()
{
if (!um_get_option('allow_tracking')) {
return 0;
}
return 1;
}
示例3: form_init
function form_init()
{
global $ultimatemember;
$http_post = 'POST' == $_SERVER['REQUEST_METHOD'];
if ($http_post && !is_admin() && isset($_POST['form_id']) && is_numeric($_POST['form_id'])) {
$this->form_id = $_POST['form_id'];
$this->form_status = get_post_status($this->form_id);
if ($this->form_status == 'publish') {
/* save entire form as global */
$this->post_form = $_POST;
$this->post_form = $this->beautify($this->post_form);
$this->form_data = $ultimatemember->query->post_data($this->form_id);
$this->post_form['submitted'] = $this->post_form;
$this->post_form = array_merge($this->form_data, $this->post_form);
if ($_POST[$ultimatemember->honeypot] != '') {
wp_die('Hello, spam bot!');
}
if (!in_array($this->form_data['mode'], array('login'))) {
$form_timestamp = trim($_POST['timestamp']);
$live_timestamp = current_time('timestamp');
if ($form_timestamp == '' && um_get_option('enable_timebot') == 1) {
wp_die(__('Hello, spam bot!'));
}
if ($live_timestamp - $form_timestamp < 6 && um_get_option('enable_timebot') == 1) {
wp_die(__('Whoa, slow down! You\'re seeing this message because you tried to submit a form too fast and we think you might be a spam bot. If you are a real human being please wait a few seconds before submitting the form. Thanks!'));
}
}
/* Continue based on form mode - pre-validation */
do_action('um_submit_form_errors_hook', $this->post_form);
do_action("um_submit_form_{$this->post_form['mode']}", $this->post_form);
}
}
}
示例4: um_access_global_settings
function um_access_global_settings()
{
global $post, $ultimatemember;
$access = um_get_option('accessible');
if ($access == 2 && !is_user_logged_in()) {
$redirect = um_get_option('access_redirect');
if (!$redirect) {
$redirect = um_get_core_page('login');
}
$redirects[] = untrailingslashit(um_get_core_page('login'));
$redirects[] = untrailingslashit(um_get_option('access_redirect'));
$exclude_uris = um_get_option('access_exclude_uris');
if ($exclude_uris) {
$redirects = array_merge($redirects, $exclude_uris);
}
$redirects = array_unique($redirects);
$current_url = $ultimatemember->permalinks->get_current_url(get_option('permalink_structure'));
$current_url = untrailingslashit($current_url);
$current_url_slash = trailingslashit($current_url);
if ((isset($post->ID) || is_home()) && (in_array($current_url, $redirects) || in_array($current_url_slash, $redirects))) {
// allow
} else {
$ultimatemember->access->redirect_handler = $redirect;
}
}
}
示例5: 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;
}
示例6: um_pre_get_posts
function um_pre_get_posts($query)
{
if (!is_admin() && $query->is_main_query()) {
// Incompatibility with The Events Calendar
if (isset($query->query['post_type']) && $query->query['post_type'] == 'tribe_events') {
return;
}
if ($query->is_search || $query->is_archive() || $query->is_home) {
if ($query->is_home && !um_get_option('exclude_from_main_loop')) {
return;
}
if ($query->is_archive && !um_get_option('exclude_from_archive_loop')) {
return;
}
if ($query->is_search && !um_get_option('exclude_from_search_loop')) {
return;
}
if (is_user_logged_in()) {
$meta_query['relation'] = 'OR';
$meta_query[] = array('key' => '_um_accessible', 'value' => '1', 'compare' => '!=');
$meta_query[] = array('key' => '_um_accessible', 'compare' => 'NOT EXISTS');
$query->set('meta_query', $meta_query);
}
if (!is_user_logged_in()) {
$meta_query['relation'] = 'OR';
$meta_query[] = array('key' => '_um_accessible', 'value' => '2', 'compare' => '!=');
$meta_query[] = array('key' => '_um_accessible', 'compare' => 'NOT EXISTS');
$query->set('meta_query', $meta_query);
}
}
}
}
示例7: show_meta
function show_meta($array)
{
global $ultimatemember;
$output = '';
foreach ($array as $key) {
$data = '';
if ($key && um_filtered_value($key)) {
if (isset($ultimatemember->builtin->all_user_fields[$key]['icon'])) {
$icon = $ultimatemember->builtin->all_user_fields[$key]['icon'];
} else {
$icon = '';
}
$icon = isset($icon) && !empty($icon) ? '<i class="' . $icon . '"></i>' : '';
if (!um_get_option('profile_show_metaicon')) {
$icon = '';
}
$value = um_filtered_value($key);
$items[] = '<span>' . $icon . $value . '</span>';
$items[] = '<span class="b">•</span>';
}
}
if (isset($items)) {
array_pop($items);
foreach ($items as $item) {
$output .= $item;
}
}
return $output;
}
示例8: um_block_wpadmin_for_guests
function um_block_wpadmin_for_guests()
{
global $pagenow;
if (isset($_REQUEST['um_panic_key']) && $_REQUEST['um_panic_key'] == um_get_option('panic_key')) {
exit(wp_redirect(add_query_arg('_verified_key', $_REQUEST['um_panic_key'], wp_login_url())));
}
if (!isset($_REQUEST['_verified_key']) || $_REQUEST['_verified_key'] != um_get_option('panic_key')) {
// Logout screen
if (isset($pagenow) && $pagenow == 'wp-login.php' && is_user_logged_in() && isset($_REQUEST['action']) && $_REQUEST['action'] == 'logout') {
$redirect = um_get_core_page('logout');
if (isset($_REQUEST['redirect_to']) && !empty($_REQUEST['redirect_to'])) {
$redirect = add_query_arg('redirect_to', $_REQUEST['redirect_to'], $redirect);
}
exit(wp_redirect($redirect));
}
// Login screen
if (isset($pagenow) && $pagenow == 'wp-login.php' && !is_user_logged_in() && !isset($_REQUEST['action'])) {
$allowed = um_get_option('wpadmin_login');
$allowed = apply_filters('um_whitelisted_wpadmin_access', $allowed);
if (!$allowed) {
$act = um_get_option('wpadmin_login_redirect');
$custom_url = um_get_option('wpadmin_login_redirect_url');
if ($act == 'um_login_page' || !$custom_url) {
$redirect = um_get_core_page('login');
} else {
$redirect = $custom_url;
}
exit(wp_redirect($redirect));
}
}
// Register screen
if (isset($pagenow) && $pagenow == 'wp-login.php' && !is_user_logged_in() && isset($_REQUEST['action']) && $_REQUEST['action'] == 'register') {
$allowed = um_get_option('wpadmin_register');
$allowed = apply_filters('um_whitelisted_wpadmin_access', $allowed);
if (!$allowed) {
$act = um_get_option('wpadmin_register_redirect');
$custom_url = um_get_option('wpadmin_register_redirect_url');
if ($act == 'um_register_page' || !$custom_url) {
$redirect = um_get_core_page('register');
} else {
$redirect = $custom_url;
}
exit(wp_redirect($redirect));
}
}
// Lost password page
if (isset($pagenow) && $pagenow == 'wp-login.php' && isset($_REQUEST['action']) && $_REQUEST['action'] == 'lostpassword') {
exit(wp_redirect(um_get_core_page('password-reset')));
}
// Prevention for logged in user
if (isset($pagenow) && $pagenow == 'wp-login.php' && is_user_logged_in() && isset($_REQUEST['action']) && $_REQUEST['action'] != 'postpass') {
if (!um_user('can_access_wpadmin')) {
exit(wp_redirect(home_url()));
} else {
exit(wp_redirect(admin_url()));
}
}
}
}
示例9: create_taxonomies
function create_taxonomies()
{
register_post_type('um_form', array('labels' => array('name' => __('Forms'), 'singular_name' => __('Form'), 'add_new' => __('Add New'), 'add_new_item' => __('Add New Form'), 'edit_item' => __('Edit Form'), 'not_found' => __('You did not create any forms yet'), 'not_found_in_trash' => __('Nothing found in Trash'), 'search_items' => __('Search Forms')), 'show_ui' => true, 'show_in_menu' => false, 'public' => false, 'supports' => array('title')));
register_post_type('um_role', array('labels' => array('name' => __('User Roles'), 'singular_name' => __('User Role'), 'add_new' => __('Add New'), 'add_new_item' => __('Add New User Role'), 'edit_item' => __('Edit User Role'), 'not_found' => __('You did not create any user roles yet'), 'not_found_in_trash' => __('Nothing found in Trash'), 'search_items' => __('Search User Roles')), 'show_ui' => true, 'show_in_menu' => false, 'public' => false, 'supports' => array('title')));
if (um_get_option('members_page') || !get_option('um_options')) {
register_post_type('um_directory', array('labels' => array('name' => __('Member Directories'), 'singular_name' => __('Member Directory'), 'add_new' => __('Add New'), 'add_new_item' => __('Add New Member Directory'), 'edit_item' => __('Edit Member Directory'), 'not_found' => __('You did not create any member directories yet'), 'not_found_in_trash' => __('Nothing found in Trash'), 'search_items' => __('Search Member Directories')), 'show_ui' => true, 'show_in_menu' => false, 'public' => false, 'supports' => array('title')));
}
}
示例10: um_edit_label_all_fields
function um_edit_label_all_fields($label, $data)
{
$asterisk = um_get_option('form_asterisk');
if ($asterisk && isset($data['required']) && $data['required'] == 1) {
$label = $label . '<span class="um-req" title="' . __('Required', 'ultimatemember') . '">*</span>';
}
return $label;
}
示例11: secondary_menu_items
function secondary_menu_items()
{
add_submenu_page($this->slug, __('Forms', $this->slug), __('Forms', $this->slug), 'manage_options', 'edit.php?post_type=um_form', '', '');
add_submenu_page($this->slug, __('User Roles', $this->slug), __('User Roles', $this->slug), 'manage_options', 'edit.php?post_type=um_role', '', '');
if (um_get_option('members_page') || !get_option('um_options')) {
add_submenu_page($this->slug, __('Member Directories', $this->slug), __('Member Directories', $this->slug), 'manage_options', 'edit.php?post_type=um_directory', '', '');
}
do_action('um_extend_admin_menu');
}
示例12: load_addons
function load_addons()
{
global $ultimatemember;
foreach ($ultimatemember->addons as $addon => $name) {
if (um_get_option('addon_' . $addon) == 1) {
include_once um_path . 'addons/' . $addon . '.php';
}
}
}
示例13: um_option_field_callback
function um_option_field_callback($field)
{
$field_name = $field['name'];
$field['key'] = $field_name;
$field['name'] = $field['option'] . '[' . $field_name . ']';
$options = um_get_option($field['option']);
$field['value'] = isset($options[$field_name]) ? $options[$field_name] : '';
echo um_admin_get_field_html($field);
}
示例14: wp_enqueue_scripts
function wp_enqueue_scripts()
{
global $ultimatemember;
$exclude_home = um_get_option('js_css_exlcude_home');
if ($exclude_home && (is_home() || is_front_page())) {
return;
}
$exclude = um_get_option('js_css_exclude');
if ($exclude && !is_admin() && is_array($exclude)) {
$c_url = $ultimatemember->permalinks->get_current_url(get_option('permalink_structure'));
foreach ($exclude as $match) {
if (strstr($c_url, untrailingslashit($match))) {
return;
}
}
}
$include = um_get_option('js_css_include');
if ($include && !is_admin() && is_array($include)) {
$c_url = $ultimatemember->permalinks->get_current_url(get_option('permalink_structure'));
foreach ($include as $match) {
if (strstr($c_url, untrailingslashit($match))) {
$force_load = true;
} else {
if (!isset($force_load)) {
$force_load = false;
}
}
}
}
if (isset($force_load) && $force_load == false) {
return;
}
// enqueue styles
if (um_get_option('disable_minify')) {
$this->load_original();
wp_localize_script('um_scripts', 'um_scripts', array('ajaxurl' => admin_url('admin-ajax.php'), 'fileupload' => um_url . 'core/lib/upload/um-file-upload.php', 'imageupload' => um_url . 'core/lib/upload/um-image-upload.php'));
} else {
wp_register_script('um_minified', um_url . 'assets/js/um.min.js', array('jquery'), ultimatemember_version, true);
wp_enqueue_script('um_minified');
wp_localize_script('um_minified', 'um_scripts', array('ajaxurl' => admin_url('admin-ajax.php'), 'fileupload' => um_url . 'core/lib/upload/um-file-upload.php', 'imageupload' => um_url . 'core/lib/upload/um-image-upload.php'));
wp_register_style('um_minified', um_url . 'assets/css/um.min.css', '', ultimatemember_version, 'all');
wp_enqueue_style('um_minified');
}
// rtl style
if (is_rtl()) {
wp_register_style('um_rtl', um_url . 'assets/css/um.rtl.css', '', ultimatemember_version, 'all');
wp_enqueue_style('um_rtl');
}
// load a localized version for date/time
$locale = get_option('WPLANG');
if ($locale && file_exists(um_path . 'assets/js/pickadate/translations/' . $locale . '.js')) {
wp_register_script('um_datetime_locale', um_url . 'assets/js/pickadate/translations/' . $locale . '.js', '', ultimatemember_version, true);
wp_enqueue_script('um_datetime_locale');
}
}
示例15: 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;
}