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;
}
 private function tracking_allowed()
 {
     if (!um_get_option('allow_tracking')) {
         return 0;
     }
     return 1;
 }
示例#3
0
 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);
         }
     }
 }
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;
        }
    }
}
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;
}
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
0
 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">&bull;</span>';
         }
     }
     if (isset($items)) {
         array_pop($items);
         foreach ($items as $item) {
             $output .= $item;
         }
     }
     return $output;
 }
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()));
            }
        }
    }
}
 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')));
     }
 }
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;
}
 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
0
 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
0
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
0
 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
0
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;
}
示例#16
0
function um_whitelisted_wpadmin_access($allowed)
{
    $ips = um_get_option('wpadmin_allow_ips');
    if (!$ips) {
        return $allowed;
    }
    $ips = array_map("rtrim", explode("\n", $ips));
    $user_ip = um_user_ip();
    if (in_array($user_ip, $ips)) {
        $allowed = 1;
    }
    return $allowed;
}
 function load_addons()
 {
     global $ultimatemember;
     if (isset($ultimatemember->addons) && is_array($ultimatemember->addons)) {
         foreach ($ultimatemember->addons as $addon => $name) {
             if (um_get_option('addon_' . $addon) == 1) {
                 if (file_exists(um_path . 'addons/' . $addon . '.php')) {
                     include_once um_path . 'addons/' . $addon . '.php';
                 }
             }
         }
     }
 }
function um_new_user_via_wpadmin($user_id)
{
    if (is_admin()) {
        global $ultimatemember;
        if (isset($_POST['um_role'])) {
            $args['role'] = $_POST['um_role'];
        } else {
            $args['role'] = um_get_option('default_role');
        }
        do_action('um_after_new_user_register', $user_id, $args);
        do_action('um_update_profile_full_name', $_POST);
    }
}
 /**
  * Define the core functionality of the plugin.
  *
  * Set the plugin name and the plugin version that can be used throughout the plugin.
  * Load the dependencies, define the locale, and set the hooks for the admin area and
  * the public-facing side of the site.
  *
  * @since    1.0.0
  */
 public function admin_bar_ultimate_member_user_menu()
 {
     global $wp_admin_bar;
     global $ultimatemember;
     if (!um_get_option('profile_menu')) {
         return;
     }
     // get active tabs
     $tabs = $ultimatemember->profile->tabs_active();
     // need enough tabs to continue
     if (count($tabs) <= 1) {
         return;
     }
     $active_tab = $ultimatemember->profile->active_tab();
     if (!isset($tabs[$active_tab])) {
         $active_tab = 'main';
     }
     // move default tab priority
     $default_tab = um_get_option('profile_menu_default_tab');
     $dtab = isset($tabs[$default_tab]) ? $tabs[$default_tab] : 'main';
     if (isset($tabs[$default_tab])) {
         unset($tabs[$default_tab]);
         $dtabs[$default_tab] = $dtab;
         $tabs = $dtabs + $tabs;
     }
     $nav_links = array();
     foreach ($tabs as $id => $tab) {
         if (isset($tab['hidden'])) {
             continue;
         }
         $nav_link = $ultimatemember->permalinks->profile_url();
         $nav_link = remove_query_arg('um_action', $nav_link);
         $nav_link = remove_query_arg('subnav', $nav_link);
         $nav_link = add_query_arg('profiletab', $id, $nav_link);
         $nav_link = apply_filters("um_profile_menu_link_{$id}", $nav_link);
         $nav_links[] = array('parent' => 'my-account-ultimate-member', 'id' => "um_profile_menu_link_{$id}", 'title' => $tab['name'], 'href' => $nav_link);
         if (isset($tab['subnav'])) {
             foreach ($tab['subnav'] as $subid => $subtab) {
                 $sub_nav_link = add_query_arg('subnav', $subid, $nav_link);
                 $nav_links[] = array('parent' => "um_profile_menu_link_{$id}", 'id' => "um_profile_menu_link_{$subid}", 'title' => $subtab, 'href' => $sub_nav_link);
             }
         }
     }
     // add each menu itens into admin_bar
     foreach ($nav_links as $admin_menu) {
         $wp_admin_bar->add_menu($admin_menu);
     }
 }
示例#20
0
function um_add_custom_user_profile_fields()
{
    global $ultimatemember, $pagenow;
    if ($pagenow !== 'user-new.php') {
        return;
    }
    if (!current_user_can('manage_options')) {
        return false;
    }
    ?>
	<table id="table_my_custom_field" style="display:none;">
		<tr>
			<th><label for="um_role"><?php 
    _e('Community Role', 'ultimatemember');
    ?>
</label></th>
			<td>
				<select name="um_role" id="um_role">
				<?php 
    foreach ($ultimatemember->query->get_roles() as $key => $value) {
        ?>
					<option value="<?php 
        echo $key;
        ?>
" <?php 
        selected(um_get_option('default_role'), $key);
        ?>
 ><?php 
        echo $value;
        ?>
</option>
				<?php 
    }
    ?>
				</select>
			</td>
		</tr>
	</table>
	<script>
	jQuery(function($){
		$('#table_my_custom_field tr').insertAfter($('#role').parentsUntil('tr').parent());
	});
	</script>
	<?php 
}
示例#21
0
 function locate_user_profile()
 {
     global $post, $ultimatemember;
     if (um_queried_user() && um_is_core_page('user')) {
         if (um_get_option('permalink_base') == 'user_login') {
             $user_id = username_exists(um_queried_user());
             // Try nice name
             if (!$user_id) {
                 $slug = um_queried_user();
                 $slug = str_replace('.', '-', $slug);
                 $the_user = get_user_by('slug', $slug);
                 if (isset($the_user->ID)) {
                     $user_id = $the_user->ID;
                 }
             }
         }
         if (um_get_option('permalink_base') == 'user_id') {
             $user_id = $ultimatemember->user->user_exists_by_id(um_queried_user());
         }
         if (um_get_option('permalink_base') == 'name') {
             $user_id = $ultimatemember->user->user_exists_by_name(um_queried_user());
         }
         /** USER EXISTS SET USER AND CONTINUE **/
         if ($user_id) {
             um_set_requested_user($user_id);
         } else {
             exit(wp_redirect(um_get_core_page('user')));
         }
     } else {
         if (um_is_core_page('user')) {
             // just base64_decode
             if (is_user_logged_in()) {
                 // just redirect to their profile
                 $query = $ultimatemember->permalinks->get_query_array();
                 $url = um_user_profile_url();
                 if ($query) {
                     foreach ($query as $key => $val) {
                         $url = add_query_arg($key, $val, $url);
                     }
                 }
                 exit(wp_redirect($url));
             }
         }
     }
 }
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']);
    }
}
function um_add_user_role($args)
{
    global $ultimatemember;
    if (isset($args['custom_fields']['role_select']) || isset($args['custom_fields']['role_radio'])) {
        return;
    }
    if (isset($args['role']) && !empty($args['role'])) {
        $role = $args['role'];
    } else {
        $role = um_get_option('default_role');
    }
    echo '<input type="hidden" name="role" id="role" value="' . $role . '" />';
}
示例#24
0
 function set_predefined_fields()
 {
     global $ultimatemember;
     if (class_exists('UM_Query')) {
         $um_roles = $ultimatemember->query->get_roles(false, array('admin'));
     } else {
         $um_roles = array();
     }
     $profile_privacy = apply_filters('um_profile_privacy_options', array(__('Everyone', 'ultimatemember'), __('Only me', 'ultimatemember')));
     $this->predefined_fields = array('user_login' => array('title' => __('Username', 'ultimatemember'), 'metakey' => 'user_login', 'type' => 'text', 'label' => __('Username', 'ultimatemember'), 'required' => 1, 'public' => 1, 'editable' => 0, 'validate' => 'unique_username', 'min_chars' => 3, 'max_chars' => 24), 'username' => array('title' => __('Username or E-mail', 'ultimatemember'), 'metakey' => 'username', 'type' => 'text', 'label' => __('Username or E-mail', 'ultimatemember'), 'required' => 1, 'public' => 1, 'editable' => 0, 'validate' => 'unique_username_or_email'), 'user_password' => array('title' => __('Password', 'ultimatemember'), 'metakey' => 'user_password', 'type' => 'password', 'label' => __('Password', 'ultimatemember'), 'required' => 1, 'public' => 1, 'editable' => 1, 'min_chars' => 8, 'max_chars' => 30, 'force_good_pass' => 1, 'force_confirm_pass' => 1), 'first_name' => array('title' => __('First Name', 'ultimatemember'), 'metakey' => 'first_name', 'type' => 'text', 'label' => __('First Name', 'ultimatemember'), 'required' => 0, 'public' => 1, 'editable' => 1), 'last_name' => array('title' => __('Last Name', 'ultimatemember'), 'metakey' => 'last_name', 'type' => 'text', 'label' => __('Last Name', 'ultimatemember'), 'required' => 0, 'public' => 1, 'editable' => 1), 'user_registered' => array('title' => __('Registration Date', 'ultimatemember'), 'metakey' => 'user_registered', 'type' => 'text', 'label' => __('Registration Date', 'ultimatemember'), 'required' => 0, 'public' => 1, 'editable' => 1, 'edit_forbidden' => 1), 'last_login' => array('title' => __('Last Login', 'ultimatemember'), 'metakey' => 'last_login', 'type' => 'text', 'label' => __('Last Login', 'ultimatemember'), 'required' => 0, 'public' => 1, 'editable' => 1, 'edit_forbidden' => 1), 'display_name' => array('title' => __('Display Name', 'ultimatemember'), 'metakey' => 'display_name', 'type' => 'text', 'label' => __('Display Name', 'ultimatemember'), 'required' => 0, 'public' => 1, 'editable' => 1), 'user_email' => array('title' => __('E-mail Address', 'ultimatemember'), 'metakey' => 'user_email', 'type' => 'text', 'label' => __('E-mail Address', 'ultimatemember'), 'required' => 0, 'public' => 1, 'editable' => 1, 'validate' => 'unique_email'), 'description' => array('title' => __('Biography', 'ultimatemember'), 'metakey' => 'description', 'type' => 'textarea', 'label' => __('Biography', 'ultimatemember'), 'html' => 0, 'required' => 0, 'public' => 1, 'editable' => 1, 'max_words' => 40, 'placeholder' => 'Enter a bit about yourself...'), 'birth_date' => array('title' => __('Birth Date', 'ultimatemember'), 'metakey' => 'birth_date', 'type' => 'date', 'label' => __('Birth Date', 'ultimatemember'), 'required' => 0, 'public' => 1, 'editable' => 1, 'pretty_format' => 1, 'years' => 115, 'years_x' => 'past', 'icon' => 'um-faicon-calendar'), 'gender' => array('title' => __('Gender', 'ultimatemember'), 'metakey' => 'gender', 'type' => 'radio', 'label' => __('Gender', 'ultimatemember'), 'required' => 0, 'public' => 1, 'editable' => 1, 'options' => array(__('Male', 'ultimatemember'), __('Female', 'ultimatemember'))), 'country' => array('title' => __('Country', 'ultimatemember'), 'metakey' => 'country', 'type' => 'select', 'label' => __('Country', 'ultimatemember'), 'placeholder' => __('Choose a Country', 'ultimatemember'), 'required' => 0, 'public' => 1, 'editable' => 1, 'options' => $this->get('countries')), 'facebook' => array('title' => __('Facebook', 'ultimatemember'), 'metakey' => 'facebook', 'type' => 'url', 'label' => __('Facebook', 'ultimatemember'), 'required' => 0, 'public' => 1, 'editable' => 1, 'url_target' => '_blank', 'url_rel' => 'nofollow', 'icon' => 'um-faicon-facebook', 'validate' => 'facebook_url', 'url_text' => 'Facebook', 'advanced' => 'social', 'color' => '#3B5999', 'match' => 'https://facebook.com/'), 'twitter' => array('title' => __('Twitter', 'ultimatemember'), 'metakey' => 'twitter', 'type' => 'url', 'label' => __('Twitter', 'ultimatemember'), 'required' => 0, 'public' => 1, 'editable' => 1, 'url_target' => '_blank', 'url_rel' => 'nofollow', 'icon' => 'um-faicon-twitter', 'validate' => 'twitter_url', 'url_text' => 'Twitter', 'advanced' => 'social', 'color' => '#4099FF', 'match' => 'https://twitter.com/'), 'linkedin' => array('title' => __('LinkedIn', 'ultimatemember'), 'metakey' => 'linkedin', 'type' => 'url', 'label' => __('LinkedIn', 'ultimatemember'), 'required' => 0, 'public' => 1, 'editable' => 1, 'url_target' => '_blank', 'url_rel' => 'nofollow', 'icon' => 'um-faicon-linkedin', 'validate' => 'linkedin_url', 'url_text' => 'LinkedIn', 'advanced' => 'social', 'color' => '#0976b4', 'match' => 'https://linkedin.com/in/'), 'googleplus' => array('title' => __('Google+', 'ultimatemember'), 'metakey' => 'googleplus', 'type' => 'url', 'label' => __('Google+', 'ultimatemember'), 'required' => 0, 'public' => 1, 'editable' => 1, 'url_target' => '_blank', 'url_rel' => 'nofollow', 'icon' => 'um-faicon-google-plus', 'validate' => 'google_url', 'url_text' => 'Google+', 'advanced' => 'social', 'color' => '#dd4b39', 'match' => 'https://google.com/+'), 'instagram' => array('title' => __('Instagram', 'ultimatemember'), 'metakey' => 'instagram', 'type' => 'url', 'label' => __('Instagram', 'ultimatemember'), 'required' => 0, 'public' => 1, 'editable' => 1, 'url_target' => '_blank', 'url_rel' => 'nofollow', 'icon' => 'um-faicon-instagram', 'validate' => 'instagram_url', 'url_text' => 'Instagram', 'advanced' => 'social', 'color' => '#3f729b', 'match' => 'https://instagram.com/'), 'skype' => array('title' => __('Skype ID', 'ultimatemember'), 'metakey' => 'skype', 'type' => 'url', 'label' => __('Skype ID', 'ultimatemember'), 'required' => 0, 'public' => 1, 'editable' => 1, 'url_target' => '_blank', 'url_rel' => 'nofollow', 'icon' => 'um-faicon-skype', 'validate' => 'skype', 'url_text' => 'Skype'), 'youtube' => array('title' => __('YouTube', 'ultimatemember'), 'metakey' => 'youtube', 'type' => 'url', 'label' => __('YouTube', 'ultimatemember'), 'required' => 0, 'public' => 1, 'editable' => 1, 'url_target' => '_blank', 'url_rel' => 'nofollow', 'icon' => 'um-faicon-youtube', 'validate' => 'youtube_url', 'url_text' => 'YouTube', 'advanced' => 'social', 'color' => '#e52d27', 'match' => 'https://youtube.com/'), 'soundcloud' => array('title' => __('SoundCloud', 'ultimatemember'), 'metakey' => 'soundcloud', 'type' => 'url', 'label' => __('SoundCloud', 'ultimatemember'), 'required' => 0, 'public' => 1, 'editable' => 1, 'url_target' => '_blank', 'url_rel' => 'nofollow', 'icon' => 'um-faicon-soundcloud', 'validate' => 'soundcloud_url', 'url_text' => 'SoundCloud', 'advanced' => 'social', 'color' => '#f50', 'match' => 'https://soundcloud.com/'), 'role_select' => array('title' => __('Roles (Dropdown)', 'ultimatemember'), 'metakey' => 'role_select', 'type' => 'select', 'label' => __('Account Type', 'ultimatemember'), 'placeholder' => 'Choose account type', 'required' => 0, 'public' => 1, 'editable' => 1, 'options' => $um_roles), 'role_radio' => array('title' => __('Roles (Radio)', 'ultimatemember'), 'metakey' => 'role_radio', 'type' => 'radio', 'label' => __('Account Type', 'ultimatemember'), 'required' => 0, 'public' => 1, 'editable' => 1, 'options' => $um_roles), 'languages' => array('title' => __('Languages', 'ultimatemember'), 'metakey' => 'languages', 'type' => 'multiselect', 'label' => __('Languages Spoken', 'ultimatemember'), 'placeholder' => __('Select languages', 'ultimatemember'), 'required' => 0, 'public' => 1, 'editable' => 1, 'options' => $this->get('languages')), 'phone_number' => array('title' => __('Phone Number', 'ultimatemember'), 'metakey' => 'phone_number', 'type' => 'text', 'label' => __('Phone Number', 'ultimatemember'), 'required' => 0, 'public' => 1, 'editable' => 1, 'validate' => 'phone_number', 'icon' => 'um-faicon-phone'), 'mobile_number' => array('title' => __('Mobile Number', 'ultimatemember'), 'metakey' => 'mobile_number', 'type' => 'text', 'label' => __('Mobile Number', 'ultimatemember'), 'required' => 0, 'public' => 1, 'editable' => 1, 'validate' => 'phone_number', 'icon' => 'um-faicon-mobile'), 'profile_photo' => array('title' => __('Profile Photo', 'ultimatemember'), 'metakey' => 'profile_photo', 'type' => 'image', 'label' => __('Change your profile photo', 'ultimatemember'), 'upload_text' => __('Upload your photo here', 'ultimatemember'), 'icon' => 'um-faicon-camera', 'crop' => 1, 'max_size' => um_get_option('profile_photo_max_size') ? um_get_option('profile_photo_max_size') : 999999999, 'min_width' => str_replace('px', '', um_get_option('profile_photosize')), 'min_height' => str_replace('px', '', um_get_option('profile_photosize')), 'private_use' => true), 'cover_photo' => array('title' => __('Cover Photo', 'ultimatemember'), 'metakey' => 'cover_photo', 'type' => 'image', 'label' => __('Change your cover photo', 'ultimatemember'), 'upload_text' => __('Upload profile cover here', 'ultimatemember'), 'icon' => 'um-faicon-picture-o', 'crop' => 2, 'max_size' => um_get_option('cover_photo_max_size') ? um_get_option('cover_photo_max_size') : 999999999, 'modal_size' => 'large', 'ratio' => str_replace(':1', '', um_get_option('profile_cover_ratio')), 'min_width' => um_get_option('cover_min_width'), 'private_use' => true), 'password_reset_text' => array('title' => __('Password Reset', 'ultimatemember'), 'type' => 'block', 'content' => '<div style="text-align:center">' . __('To reset your password, please enter your email address or username below', 'ultimatemember') . '</div>', 'private_use' => true), 'username_b' => array('title' => __('Username or E-mail', 'ultimatemember'), 'metakey' => 'username_b', 'type' => 'text', 'placeholder' => __('Enter your username or email', 'ultimatemember'), 'required' => 1, 'public' => 1, 'editable' => 0, 'private_use' => true), 'profile_privacy' => array('title' => __('Profile Privacy', 'ultimatemember'), 'metakey' => 'profile_privacy', 'type' => 'select', 'label' => __('Profile Privacy', 'ultimatemember'), 'help' => __('Who can see your public profile?', 'ultimatemember'), 'required' => 0, 'public' => 1, 'editable' => 1, 'default' => __('Everyone', 'ultimatemember'), 'options' => $profile_privacy, 'allowclear' => 0, 'account_only' => true, 'required_perm' => 'can_make_private_profile'), 'hide_in_members' => array('title' => __('Hide my profile from directory', 'ultimatemember'), 'metakey' => 'hide_in_members', 'type' => 'radio', 'label' => __('Hide my profile from directory', 'ultimatemember'), 'help' => __('Here you can hide yourself from appearing in public directory', 'ultimatemember'), 'required' => 0, 'public' => 1, 'editable' => 1, 'default' => __('No', 'ultimatemember'), 'options' => array(__('No', 'ultimatemember'), __('Yes', 'ultimatemember')), 'account_only' => true, 'required_opt' => array('members_page', 1)), 'delete_account' => array('title' => __('Delete Account', 'ultimatemember'), 'metakey' => 'delete_account', 'type' => 'radio', 'label' => __('Delete Account', 'ultimatemember'), 'help' => __('If you confirm, everything related to your profile will be deleted permanently from the site', 'ultimatemember'), 'required' => 0, 'public' => 1, 'editable' => 1, 'default' => __('No', 'ultimatemember'), 'options' => array(__('Yes', 'ultimatemember'), __('No', 'ultimatemember')), 'account_only' => true), 'single_user_password' => array('title' => __('Password', 'ultimatemember'), 'metakey' => 'single_user_password', 'type' => 'password', 'label' => __('Password', 'ultimatemember'), 'required' => 1, 'public' => 1, 'editable' => 1, 'account_only' => true));
     $this->predefined_fields = apply_filters('um_predefined_fields_hook', $this->predefined_fields);
 }
示例#25
0
 function new_user_upload($user_id, $source, $key)
 {
     // if he does not have uploads dir yet
     $this->new_user($user_id);
     // name and extension stuff
     $source_name = basename($source);
     if ($key == 'profile_photo') {
         $source_name = 'profile_photo.jpg';
     }
     if ($key == 'cover_photo') {
         $source_name = 'cover_photo.jpg';
     }
     $ext = '.' . pathinfo($source_name, PATHINFO_EXTENSION);
     $name = str_replace($ext, '', $source_name);
     $filename = $name . $ext;
     // copy & overwrite file
     if (file_exists($this->upload_basedir . $user_id . '/' . $filename)) {
         unlink($this->upload_basedir . $user_id . '/' . $filename);
     }
     copy($source, $this->upload_basedir . $user_id . '/' . $filename);
     // thumbs
     if ($key == 'profile_photo') {
         list($w, $h) = @getimagesize($source);
         $sizes = um_get_option('photo_thumb_sizes');
         foreach ($sizes as $size) {
             if (file_exists($this->upload_basedir . $user_id . '/' . $name . '-' . $size . $ext)) {
                 unlink($this->upload_basedir . $user_id . '/' . $name . '-' . $size . $ext);
             }
             if ($size < $w) {
                 $thumb_s = imagecreatefromjpeg($source);
                 $thumb = imagecreatetruecolor($size, $size);
                 imagecopyresampled($thumb, $thumb_s, 0, 0, 0, 0, $size, $size, $w, $h);
                 imagejpeg($thumb, $this->upload_basedir . $user_id . '/' . $name . '-' . $size . $ext, 100);
             }
         }
         // removes a synced profile photo
         delete_user_meta($user_id, 'synced_profile_photo');
     }
     if ($key == 'cover_photo') {
         list($w, $h) = @getimagesize($source);
         $sizes = um_get_option('cover_thumb_sizes');
         foreach ($sizes as $size) {
             $ratio = round($w / $h, 2);
             $height = round($size / $ratio, 2);
             if (file_exists($this->upload_basedir . $user_id . '/' . $name . '-' . $size . $ext)) {
                 unlink($this->upload_basedir . $user_id . '/' . $name . '-' . $size . $ext);
             }
             if ($size < $w) {
                 $thumb_s = imagecreatefromjpeg($source);
                 $thumb = imagecreatetruecolor($size, $height);
                 imagecopyresampled($thumb, $thumb_s, 0, 0, 0, 0, $size, $height, $w, $h);
                 imagejpeg($thumb, $this->upload_basedir . $user_id . '/' . $name . '-' . $size . $ext, 100);
             }
         }
     }
     // clean up temp
     $dir = dirname($source);
     unlink($source);
     rmdir($dir);
     // update user's meta
     do_action('um_before_upload_db_meta', $user_id, $key);
     do_action("um_before_upload_db_meta_{$key}", $user_id);
     update_user_meta($user_id, $key, $filename);
     // the url of upload
     return $this->upload_baseurl . $user_id . '/' . $filename;
 }
示例#26
0
***	@
***/
$this->sections[] = array('icon' => 'um-faicon-cloud-upload', 'title' => __('Uploads', 'ultimatemember'), 'fields' => array(array('id' => 'profile_photo_max_size', 'type' => 'text', 'title' => __('Profile Photo Maximum File Size (bytes)', 'ultimatemember'), 'desc' => __('Sets a maximum size for the uploaded photo', 'ultimatemember'), 'validate' => 'numeric'), array('id' => 'cover_photo_max_size', 'type' => 'text', 'title' => __('Cover Photo Maximum File Size (bytes)', 'ultimatemember'), 'desc' => __('Sets a maximum size for the uploaded cover', 'ultimatemember'), 'validate' => 'numeric'), array('id' => 'photo_thumb_sizes', 'type' => 'multi_text', 'title' => __('Profile Photo Thumbnail Sizes (px)', 'ultimatemember'), 'desc' => __('Here you can define which thumbnail sizes will be created for each profile photo upload.', 'ultimatemember'), 'default' => array(40, 80, 190), 'validate' => 'numeric', 'add_text' => __('Add New Size', 'ultimatemember')), array('id' => 'cover_thumb_sizes', 'type' => 'multi_text', 'title' => __('Cover Photo Thumbnail Sizes (px)', 'ultimatemember'), 'desc' => __('Here you can define which thumbnail sizes will be created for each cover photo upload.', 'ultimatemember'), 'default' => array(300, 600), 'validate' => 'numeric', 'add_text' => __('Add New Size', 'ultimatemember')), array('id' => 'image_compression', 'type' => 'text', 'title' => __('Image Quality', 'ultimatemember'), 'desc' => __('Quality is used to determine quality of image uploads, and ranges from 0 (worst quality, smaller file) to 100 (best quality, biggest file). The default range is 60.', 'ultimatemember'), 'default' => 60, 'validate' => 'numeric'), array('id' => 'image_max_width', 'type' => 'text', 'title' => __('Image Upload Maximum Width (px)', 'ultimatemember'), 'desc' => __('Any image upload above this width will be resized to this limit automatically.', 'ultimatemember'), 'default' => 1000, 'validate' => 'numeric'), array('id' => 'cover_min_width', 'type' => 'text', 'title' => __('Cover Photo Minimum Width (px)', 'ultimatemember'), 'desc' => __('This will be the minimum width for cover photo uploads', 'ultimatemember'), 'default' => 1000, 'validate' => 'numeric')));
/***
***	@
***/
$this->sections[] = array('icon' => 'um-faicon-search', 'title' => __('SEO', 'ultimatemember'), 'fields' => array(array('id' => 'profile_title', 'type' => 'text', 'title' => __('User Profile Title', 'ultimatemember'), 'default' => '{display_name} | ' . get_bloginfo('name'), 'desc' => __('This is the title that is displayed on a specific user profile', 'ultimatemember')), array('id' => 'profile_desc', 'type' => 'textarea', 'default' => '{display_name} is on {site_name}. Join {site_name} to view {display_name}\'s profile', 'title' => __('User Profile Dynamic Meta Description', 'ultimatemember'), 'desc' => __('This will be used in the meta description that is available for search-engines.', 'ultimatemember'))));
/***
***	@
***/
$this->sections[] = array('icon' => 'um-faicon-paint-brush', 'title' => __('Appearance', 'ultimatemember'), 'fields' => array());
$this->sections[] = array('subsection' => true, 'title' => __('General', 'ultimatemember'), 'fields' => array(array('id' => 'directory_template', 'type' => 'select', 'select2' => array('allowClear' => 0, 'minimumResultsForSearch' => -1), 'title' => __('Members Default Template', 'ultimatemember'), 'desc' => __('This will be the default template to output member directory', 'ultimatemember'), 'default' => um_get_metadefault('directory_template'), 'options' => $ultimatemember->shortcodes->get_templates('members'), 'required' => array('xxxxxxxxxxxxx', '=', 'sssssssssssssssss')), array('id' => 'active_color', 'type' => 'color', 'default' => um_get_metadefault('active_color'), 'title' => __('General Active Color', 'ultimatemember'), 'validate' => 'color', 'desc' => __('Active color is used commonly with many plugin elements as highlighted color or active selection for example. This color demonstrates the primary active color of the plugin', 'ultimatemember'), 'transparent' => false), array('id' => 'secondary_color', 'type' => 'color', 'default' => um_get_metadefault('secondary_color'), 'title' => __('General Secondary Color', 'ultimatemember'), 'validate' => 'color', 'desc' => __('Secondary color is used for hovers, or active state for some elements of the plugin', 'ultimatemember'), 'transparent' => false), array('id' => 'primary_btn_color', 'type' => 'color', 'default' => um_get_metadefault('primary_btn_color'), 'title' => __('Default Primary Button Color', 'ultimatemember'), 'validate' => 'color', 'transparent' => false), array('id' => 'primary_btn_hover', 'type' => 'color', 'default' => um_get_metadefault('primary_btn_hover'), 'title' => __('Default Primary Button Hover Color', 'ultimatemember'), 'validate' => 'color', 'transparent' => false), array('id' => 'primary_btn_text', 'type' => 'color', 'default' => um_get_metadefault('primary_btn_text'), 'title' => __('Default Primary Button Text Color', 'ultimatemember'), 'validate' => 'color', 'transparent' => false), array('id' => 'secondary_btn_color', 'type' => 'color', 'default' => um_get_metadefault('secondary_btn_color'), 'title' => __('Default Secondary Button Color', 'ultimatemember'), 'validate' => 'color', 'transparent' => false), array('id' => 'secondary_btn_hover', 'type' => 'color', 'default' => um_get_metadefault('secondary_btn_hover'), 'title' => __('Default Secondary Button Hover Color', 'ultimatemember'), 'validate' => 'color', 'transparent' => false), array('id' => 'secondary_btn_text', 'type' => 'color', 'default' => um_get_metadefault('secondary_btn_text'), 'title' => __('Default Secondary Button Text Color', 'ultimatemember'), 'validate' => 'color', 'transparent' => false), array('id' => 'help_tip_color', 'type' => 'color', 'default' => um_get_metadefault('help_tip_color'), 'title' => __('Default Help Icon Color', 'ultimatemember'), 'validate' => 'color', 'transparent' => false)));
$this->sections[] = array('subsection' => true, 'title' => __('Form Inputs', 'ultimatemember'), 'fields' => array(array('id' => 'form_field_label', 'type' => 'color', 'default' => um_get_metadefault('form_field_label'), 'title' => __('Field Label Color', 'ultimatemember'), 'validate' => 'color', 'transparent' => false), array('id' => 'form_border', 'type' => 'text', 'title' => __('Field Border', 'ultimatemember'), 'default' => um_get_metadefault('form_border'), 'desc' => __('The default border-style for input/fields in UM forms', 'ultimatemember')), array('id' => 'form_border_hover', 'type' => 'text', 'title' => __('Field Border on Focus', 'ultimatemember'), 'default' => um_get_metadefault('form_border_hover'), 'desc' => __('The default border style for fields on hover state', 'ultimatemember')), array('id' => 'form_bg_color', 'type' => 'color', 'default' => um_get_metadefault('form_bg_color'), 'title' => __('Field Background Color', 'ultimatemember'), 'validate' => 'color', 'transparent' => false), array('id' => 'form_bg_color_focus', 'type' => 'color', 'default' => um_get_metadefault('form_bg_color_focus'), 'title' => __('Field Background Color on Focus', 'ultimatemember'), 'validate' => 'color', 'transparent' => false), array('id' => 'form_text_color', 'type' => 'color', 'default' => um_get_metadefault('form_text_color'), 'title' => __('Field Text Color'), 'validate' => 'color', 'transparent' => false), array('id' => 'form_placeholder', 'type' => 'color', 'default' => um_get_metadefault('form_placeholder'), 'title' => __('Field Placeholder Color', 'ultimatemember'), 'validate' => 'color', 'transparent' => false), array('id' => 'form_icon_color', 'type' => 'color', 'default' => um_get_metadefault('form_icon_color'), 'title' => __('Field Font Icon Color', 'ultimatemember'), 'validate' => 'color', 'transparent' => false), array('id' => 'form_asterisk', 'type' => 'switch', 'title' => __('Show an asterisk for required fields', 'ultimatemember'), 'default' => 0, 'on' => __('Yes', 'ultimatemember'), 'off' => __('No', 'ultimatemember')), array('id' => 'form_asterisk_color', 'type' => 'color', 'default' => um_get_metadefault('form_asterisk_color'), 'title' => __('Field Required Asterisk Color', 'ultimatemember'), 'validate' => 'color', 'transparent' => false, 'required' => array('form_asterisk', '=', '1'))));
$this->sections[] = array('subsection' => true, 'title' => __('Profile', 'ultimatemember'), 'fields' => array(array('id' => 'profile_template', 'type' => 'select', 'select2' => array('allowClear' => 0, 'minimumResultsForSearch' => -1), 'title' => __('Profile Default Template', 'ultimatemember'), 'desc' => __('This will be the default template to output profile', 'ultimatemember'), 'default' => um_get_metadefault('profile_template'), 'options' => $ultimatemember->shortcodes->get_templates('profile')), array('id' => 'profile_max_width', 'type' => 'text', 'title' => __('Profile Maximum Width', 'ultimatemember'), 'default' => um_get_metadefault('profile_max_width'), 'desc' => 'The maximum width this shortcode can take from the page width'), array('id' => 'profile_area_max_width', 'type' => 'text', 'title' => __('Profile Area Maximum Width', 'ultimatemember'), 'default' => um_get_metadefault('profile_area_max_width'), 'desc' => __('The maximum width of the profile area inside profile (below profile header)', 'ultimatemember')), array('id' => 'profile_align', 'type' => 'select', 'select2' => array('allowClear' => 0, 'minimumResultsForSearch' => -1), 'title' => __('Profile Shortcode Alignment', 'ultimatemember'), 'desc' => __('The shortcode is centered by default unless you specify otherwise here'), 'default' => um_get_metadefault('profile_align'), 'options' => array('center' => __('Centered', 'ultimatemember'), 'left' => __('Left aligned', 'ultimatemember'), 'right' => __('Right aligned', 'ultimatemember'))), array('id' => 'profile_icons', 'type' => 'select', 'select2' => array('allowClear' => 0, 'minimumResultsForSearch' => -1), 'title' => __('Profile Field Icons'), 'desc' => __('This is applicable for edit mode only', 'ultimatemember'), 'default' => um_get_metadefault('profile_icons'), 'options' => array('field' => __('Show inside text field', 'ultimatemember'), 'label' => __('Show with label', 'ultimatemember'), 'off' => __('Turn off', 'ultimatemember'))), array('id' => 'profile_primary_btn_word', 'type' => 'text', 'title' => __('Profile Primary Button Text', 'ultimatemember'), 'default' => um_get_metadefault('profile_primary_btn_word'), 'desc' => __('The text that is used for updating profile button', 'ultimatemember')), array('id' => 'profile_secondary_btn', 'type' => 'switch', 'title' => __('Profile Secondary Button', 'ultimatemember'), 'default' => 1, 'desc' => __('Switch on/off the secondary button display in the form', 'ultimatemember'), 'on' => __('On', 'ultimatemember'), 'off' => __('Off', 'ultimatemember')), array('id' => 'profile_secondary_btn_word', 'type' => 'text', 'title' => __('Profile Secondary Button Text', 'ultimatemember'), 'default' => um_get_metadefault('profile_secondary_btn_word'), 'desc' => __('The text that is used for cancelling update profile button', 'ultimatemember'), 'required' => array('profile_secondary_btn', '=', 1)), array('id' => 'profile_role', 'type' => 'select', 'select2' => array('allowClear' => 0, 'minimumResultsForSearch' => -1), 'title' => __('Profile Associated Role', 'ultimatemember'), 'desc' => __('Normally, you can leave this to default as this restricts the profile per specified role only', 'ultimatemember'), 'default' => um_get_metadefault('profile_role'), 'options' => $ultimatemember->query->get_roles($add_default = 'Not specific')), array('id' => 'profile_main_bg', 'type' => 'color', 'default' => um_get_metadefault('profile_main_bg'), 'title' => __('Profile Base Background Color', 'ultimatemember'), 'validate' => 'color', 'transparent' => false), array('id' => 'profile_header_bg', 'type' => 'color', 'default' => um_get_metadefault('profile_header_bg'), 'title' => __('Profile Header Background Color', 'ultimatemember'), 'validate' => 'color', 'transparent' => false), array('id' => 'default_avatar', 'type' => 'media', 'title' => __('Default Profile Photo', 'ultimatemember'), 'desc' => __('You can change the default profile picture globally here. Please make sure that the photo is 300x300px.', 'ultimatemember'), 'default' => array('url' => um_url . 'assets/img/default_avatar.jpg')), array('id' => 'default_cover', 'type' => 'media', 'url' => true, 'preview' => false, 'title' => __('Default Cover Photo', 'ultimatemember'), 'desc' => __('You can change the default cover photo globally here. Please make sure that the default cover is large enough and respects the ratio you are using for cover photos.', 'ultimatemember')), array('id' => 'profile_photosize', 'type' => 'text', 'title' => __('Profile Photo Size', 'ultimatemember'), 'default' => um_get_metadefault('profile_photosize'), 'desc' => __('The global default of profile photo size. This can be overridden by individual form settings', 'ultimatemember')), array('id' => 'profile_photocorner', 'type' => 'select', 'select2' => array('allowClear' => 0, 'minimumResultsForSearch' => -1), 'title' => __('Profile Photo Style', 'ultimatemember'), 'desc' => __('Whether to have rounded profile images, rounded corners, or none for the profile photo', 'ultimatemember'), 'default' => um_get_metadefault('profile_photocorner'), 'options' => array('1' => __('Circle', 'ultimatemember'), '2' => __('Rounded Corners', 'ultimatemember'), '3' => __('Square', 'ultimatemember'))), array('id' => 'profile_cover_enabled', 'type' => 'switch', 'title' => __('Profile Cover Photos', 'ultimatemember'), 'default' => 1, 'desc' => __('Switch on/off the profile cover photos', 'ultimatemember'), 'on' => __('On', 'ultimatemember'), 'off' => __('Off', 'ultimatemember')), array('id' => 'profile_cover_ratio', 'type' => 'select', 'select2' => array('allowClear' => 0, 'minimumResultsForSearch' => -1), 'title' => __('Profile Cover Ratio', 'ultimatemember'), 'desc' => __('Choose global ratio for cover photos of profiles', 'ultimatemember'), 'default' => um_get_metadefault('profile_cover_ratio'), 'options' => array('2.7:1' => '2.7:1', '2.2:1' => '2.2:1', '3.2:1' => '3.2:1'), 'required' => array('profile_cover_enabled', '=', 1)), array('id' => 'profile_show_metaicon', 'type' => 'switch', 'title' => __('Profile Header Meta Text Icon', 'ultimatemember'), 'default' => 0, 'desc' => __('Display field icons for related user meta fields in header or not', 'ultimatemember'), 'on' => __('On', 'ultimatemember'), 'off' => __('Off', 'ultimatemember')), array('id' => 'profile_header_text', 'type' => 'color', 'default' => um_get_metadefault('profile_header_text'), 'title' => __('Profile Header Meta Text Color', 'ultimatemember'), 'validate' => 'color', 'transparent' => false), array('id' => 'profile_header_link_color', 'type' => 'color', 'default' => um_get_metadefault('profile_header_link_color'), 'title' => __('Profile Header Link Color', 'ultimatemember'), 'validate' => 'color', 'transparent' => false), array('id' => 'profile_header_link_hcolor', 'type' => 'color', 'default' => um_get_metadefault('profile_header_link_hcolor'), 'title' => __('Profile Header Link Hover', 'ultimatemember'), 'validate' => 'color', 'transparent' => false), array('id' => 'profile_header_icon_color', 'type' => 'color', 'default' => um_get_metadefault('profile_header_icon_color'), 'title' => __('Profile Header Icon Link Color', 'ultimatemember'), 'validate' => 'color', 'transparent' => false), array('id' => 'profile_header_icon_hcolor', 'type' => 'color', 'default' => um_get_metadefault('profile_header_icon_hcolor'), 'title' => __('Profile Header Icon Link Hover', 'ultimatemember'), 'validate' => 'color', 'transparent' => false), array('id' => 'profile_show_name', 'type' => 'switch', 'title' => __('Show display name in profile header', 'ultimatemember'), 'default' => um_get_metadefault('profile_show_name'), 'desc' => __('Switch on/off the user name on profile header', 'ultimatemember'), 'on' => __('On', 'ultimatemember'), 'off' => __('Off', 'ultimatemember')), array('id' => 'profile_show_social_links', 'type' => 'switch', 'title' => __('Show social links in profile header', 'ultimatemember'), 'default' => um_get_metadefault('profile_show_social_links'), 'desc' => __('Switch on/off the social links on profile header', 'ultimatemember'), 'on' => __('On', 'ultimatemember'), 'off' => __('Off', 'ultimatemember')), array('id' => 'profile_show_bio', 'type' => 'switch', 'title' => __('Show user description in header', 'ultimatemember'), 'default' => um_get_metadefault('profile_show_bio'), 'desc' => __('Switch on/off the user description on profile header', 'ultimatemember'), 'on' => __('On', 'ultimatemember'), 'off' => __('Off', 'ultimatemember')), array('id' => 'profile_bio_maxchars', 'type' => 'text', 'title' => __('User description maximum chars', 'ultimatemember'), 'default' => um_get_metadefault('profile_bio_maxchars'), 'desc' => __('Maximum number of characters to allow in user description field in header.', 'ultimatemember'), 'required' => array('profile_show_bio', '=', 1)), array('id' => 'profile_header_menu', 'type' => 'select', 'title' => __('Profile Header Menu Position', 'ultimatemember'), 'default' => um_get_metadefault('profile_header_menu'), 'desc' => __('For incompatible themes, please make the menu open from left instead of bottom by default.', 'ultimatemember'), 'select2' => array('allowClear' => 0, 'minimumResultsForSearch' => -1), 'options' => array('bc' => 'Bottom of Icon', 'lc' => 'Left of Icon')), array('id' => 'profile_empty_text', 'type' => 'switch', 'title' => __('Show a custom message if profile is empty', 'ultimatemember'), 'default' => um_get_metadefault('profile_empty_text'), 'desc' => __('Switch on/off the custom message that appears when the profile is empty', 'ultimatemember'), 'on' => __('On', 'ultimatemember'), 'off' => __('Off', 'ultimatemember')), array('id' => 'profile_empty_text_emo', 'type' => 'switch', 'title' => __('Show the emoticon', 'ultimatemember'), 'default' => um_get_metadefault('profile_empty_text_emo'), 'desc' => __('Switch on/off the emoticon (sad face) that appears above the message', 'ultimatemember'), 'on' => __('On', 'ultimatemember'), 'off' => __('Off', 'ultimatemember'), 'required' => array('profile_empty_text', '=', 1))));
$tabs = $ultimatemember->profile->tabs_primary();
$tab_options[] = array('id' => 'profile_menu', 'type' => 'switch', 'title' => __('Enable profile menu', 'ultimatemember'), 'default' => 1, 'on' => __('On', 'ultimatemember'), 'off' => __('Off', 'ultimatemember'));
foreach ($tabs as $id => $tab) {
    $tab_options[] = array('id' => 'profile_tab_' . $id, 'type' => 'switch', 'title' => sprintf(__('%s Tab', 'ultimatemember'), $tab), 'default' => 1, 'required' => array('profile_menu', '=', 1), 'on' => __('On', 'ultimatemember'), 'off' => __('Off', 'ultimatemember'));
}
$tab_options[] = array('id' => 'profile_menu_default_tab', 'type' => 'select', 'select2' => array('allowClear' => 0, 'minimumResultsForSearch' => -1), 'title' => __('Profile menu default tab', 'ultimatemember'), 'desc' => __('This will be the default tab on user profile page', 'ultimatemember'), 'default' => 'main', 'options' => $ultimatemember->profile->tabs_enabled(), 'required' => array('profile_menu', '=', 1));
$tab_options[] = array('id' => 'profile_menu_icons', 'type' => 'switch', 'title' => __('Enable menu icons in desktop view', 'ultimatemember'), 'default' => 1, 'required' => array('profile_menu', '=', 1), 'on' => __('On', 'ultimatemember'), 'off' => __('Off', 'ultimatemember'));
$this->sections[] = array('subsection' => true, 'title' => __('Profile Menu', 'ultimatemember'), 'fields' => $tab_options);
$this->sections[] = array('subsection' => true, 'title' => __('Registration Form', 'ultimatemember'), 'fields' => array(array('id' => 'register_template', 'type' => 'select', 'select2' => array('allowClear' => 0, 'minimumResultsForSearch' => -1), 'title' => __('Registration Default Template', 'ultimatemember'), 'desc' => __('This will be the default template to output registration'), 'default' => um_get_metadefault('register_template'), 'options' => $ultimatemember->shortcodes->get_templates('register')), array('id' => 'register_max_width', 'type' => 'text', 'title' => __('Registration Maximum Width', 'ultimatemember'), 'default' => um_get_metadefault('register_max_width'), 'desc' => __('The maximum width this shortcode can take from the page width', 'ultimatemember')), array('id' => 'register_align', 'type' => 'select', 'select2' => array('allowClear' => 0, 'minimumResultsForSearch' => -1), 'title' => __('Registration Shortcode Alignment', 'ultimatemember'), 'desc' => __('The shortcode is centered by default unless you specify otherwise here', 'ultimatemember'), 'default' => um_get_metadefault('register_align'), 'options' => array('center' => __('Centered'), 'left' => __('Left aligned'), 'right' => __('Right aligned'))), array('id' => 'register_icons', 'type' => 'select', 'select2' => array('allowClear' => 0, 'minimumResultsForSearch' => -1), 'title' => __('Registration Field Icons', 'ultimatemember'), 'desc' => __('This controls the display of field icons in the registration form', 'ultimatemember'), 'default' => um_get_metadefault('register_icons'), 'options' => array('field' => __('Show inside text field'), 'label' => __('Show with label'), 'off' => __('Turn off'))), array('id' => 'register_primary_btn_word', 'type' => 'text', 'title' => __('Registration Primary Button Text', 'ultimatemember'), 'default' => um_get_metadefault('register_primary_btn_word'), 'desc' => __('The text that is used for primary button text', 'ultimatemember')), array('id' => 'register_secondary_btn', 'type' => 'switch', 'title' => __('Registration Secondary Button', 'ultimatemember'), 'default' => 1, 'desc' => __('Switch on/off the secondary button display in the form', 'ultimatemember'), 'on' => __('On', 'ultimatemember'), 'off' => __('Off', 'ultimatemember')), array('id' => 'register_secondary_btn_word', 'type' => 'text', 'title' => __('Registration Secondary Button Text', 'ultimatemember'), 'default' => um_get_metadefault('register_secondary_btn_word'), 'desc' => __('The text that is used for the secondary button text', 'ultimatemember'), 'required' => array('register_secondary_btn', '=', 1)), array('id' => 'register_secondary_btn_url', 'type' => 'text', 'title' => __('Registration Secondary Button URL', 'ultimatemember'), 'default' => um_get_metadefault('register_secondary_btn_url'), 'desc' => __('You can replace default link for this button by entering custom URL', 'ultimatemember'), 'required' => array('login_secondary_btn', '=', 1)), array('id' => 'register_role', 'type' => 'select', 'select2' => array('allowClear' => 0, 'minimumResultsForSearch' => -1), 'title' => __('Registration Default Role', 'ultimatemember'), 'desc' => __('This will be the default role assigned to users registering thru registration form', 'ultimatemember'), 'default' => um_get_metadefault('register_role'), 'options' => $ultimatemember->query->get_roles($add_default = 'Default'))));
$this->sections[] = array('subsection' => true, 'title' => __('Login Form', 'ultimatemember'), 'fields' => array(array('id' => 'login_template', 'type' => 'select', 'select2' => array('allowClear' => 0, 'minimumResultsForSearch' => -1), 'title' => __('Login Default Template', 'ultimatemember'), 'desc' => __('This will be the default template to output login', 'ultimatemember'), 'default' => um_get_metadefault('login_template'), 'options' => $ultimatemember->shortcodes->get_templates('login')), array('id' => 'login_max_width', 'type' => 'text', 'title' => __('Login Maximum Width', 'ultimatemember'), 'default' => um_get_metadefault('login_max_width'), 'desc' => __('The maximum width this shortcode can take from the page width', 'ultimatemember')), array('id' => 'login_align', 'type' => 'select', 'select2' => array('allowClear' => 0, 'minimumResultsForSearch' => -1), 'title' => __('Login Shortcode Alignment', 'ultimatemember'), 'desc' => __('The shortcode is centered by default unless you specify otherwise here', 'ultimatemember'), 'default' => um_get_metadefault('login_align'), 'options' => array('center' => __('Centered', 'ultimatemember'), 'left' => __('Left aligned', 'ultimatemember'), 'right' => __('Right aligned', 'ultimatemember'))), array('id' => 'login_icons', 'type' => 'select', 'select2' => array('allowClear' => 0, 'minimumResultsForSearch' => -1), 'title' => __('Login Field Icons', 'ultimatemember'), 'desc' => __('This controls the display of field icons in the login form', 'ultimatemember'), 'default' => um_get_metadefault('login_icons'), 'options' => array('field' => __('Show inside text field', 'ultimatemember'), 'label' => __('Show with label', 'ultimatemember'), 'off' => __('Turn off', 'ultimatemember'))), array('id' => 'login_primary_btn_word', 'type' => 'text', 'title' => __('Login Primary Button Text', 'ultimatemember'), 'default' => um_get_metadefault('login_primary_btn_word'), 'desc' => __('The text that is used for primary button text', 'ultimatemember')), array('id' => 'login_secondary_btn', 'type' => 'switch', 'title' => __('Login Secondary Button', 'ultimatemember'), 'default' => 1, 'desc' => __('Switch on/off the secondary button display in the form', 'ultimatemember'), 'on' => __('On', 'ultimatemember'), 'off' => __('Off', 'ultimatemember')), array('id' => 'login_secondary_btn_word', 'type' => 'text', 'title' => __('Login Secondary Button Text', 'ultimatemember'), 'default' => um_get_metadefault('login_secondary_btn_word'), 'desc' => __('The text that is used for the secondary button text', 'ultimatemember'), 'required' => array('login_secondary_btn', '=', 1)), array('id' => 'login_secondary_btn_url', 'type' => 'text', 'title' => __('Login Secondary Button URL', 'ultimatemember'), 'default' => um_get_metadefault('login_secondary_btn_url'), 'desc' => __('You can replace default link for this button by entering custom URL', 'ultimatemember'), 'required' => array('login_secondary_btn', '=', 1)), array('id' => 'login_forgot_pass_link', 'type' => 'switch', 'title' => __('Login Forgot Password Link', 'ultimatemember'), 'default' => 1, 'desc' => __('Switch on/off the forgot password link in login form', 'ultimatemember'), 'on' => __('On', 'ultimatemember'), 'off' => __('Off', 'ultimatemember')), array('id' => 'login_show_rememberme', 'type' => 'switch', 'title' => __('Show "Remember Me"', 'ultimatemember'), 'default' => 1, 'desc' => __('Allow users to choose If they want to stay signed in even after closing the browser. If you do not show this option, the default will be to not remember login session.', 'ultimatemember'), 'on' => __('On', 'ultimatemember'), 'off' => __('Off', 'ultimatemember'))));
if (um_get_option('enable_custom_css')) {
    $this->sections[] = array('subsection' => true, 'title' => __('Custom CSS', 'ultimatemember'), 'fields' => array(array('id' => 'custom_css', 'type' => 'textarea', 'title' => __('Custom CSS', 'ultimatemember'), 'desc' => __('Any custom css rules that you specify here will be applied globally to the plugin.', 'ultimatemember'), 'rows' => 20)));
}
/***
***	@
***/
$this->sections[] = array('icon' => 'um-faicon-wrench', 'title' => __('Advanced', 'ultimatemember'), 'fields' => array(array('id' => 'import_export', 'type' => 'import_export', 'title' => __('Import & Export Settings', 'ultimatemember'), 'full_width' => true), array('id' => 'um_flush_stop', 'type' => 'switch', 'title' => __('Stop rewriting rules on every load', 'ultimatemember'), 'default' => 0, 'desc' => __('Turn on If you have performance issue and are not getting 404 error/conflicts with other plugins/themes.', 'ultimatemember'), 'on' => __('On', 'ultimatemember'), 'off' => __('Off', 'ultimatemember')), array('id' => 'current_url_method', 'type' => 'select', 'select2' => array('allowClear' => 0, 'minimumResultsForSearch' => -1), 'title' => __('Current URL Method', 'ultimatemember'), 'desc' => __('Change this If you are having conflicts with profile links or redirections.', 'ultimatemember'), 'default' => 'SERVER_NAME', 'options' => array('SERVER_NAME' => __('Use SERVER_NAME', 'ultimatemember'), 'HTTP_HOST' => __('Use HTTP_HOST', 'ultimatemember'))), array('id' => 'advanced_denied_roles', 'type' => 'text', 'title' => __('Do not allow registering these roles', 'ultimatemember'), 'default' => '', 'desc' => __('Comma seperate roles (role slugs) that can not be registered from frontend ever for security.', 'ultimatemember')), array('id' => 'enable_timebot', 'type' => 'switch', 'title' => __('Enable Time Check Security', 'ultimatemember'), 'default' => 1, 'desc' => __('Turn this option off if you have a conflict with other plugins causing a spam bot message to appear unexpectedly.', 'ultimatemember'), 'on' => __('On', 'ultimatemember'), 'off' => __('Off', 'ultimatemember')), array('id' => 'disable_minify', 'type' => 'switch', 'title' => __('Disable JS/CSS Compression', 'ultimatemember'), 'default' => 0, 'desc' => __('Not recommended. This will load all plugin js and css files separately and may slow down your website. Use this setting for development or debugging purposes only.', 'ultimatemember'), 'on' => __('On', 'ultimatemember'), 'off' => __('Off', 'ultimatemember')), array('id' => 'disable_menu', 'type' => 'switch', 'title' => __('Disable Nav Menu Settings', 'ultimatemember'), 'default' => 0, 'desc' => __('This can disable the settings that appear in nav menus to apply custom access settings to nav items.', 'ultimatemember'), 'on' => __('On', 'ultimatemember'), 'off' => __('Off', 'ultimatemember')), array('id' => 'js_css_exlcude_home', 'type' => 'switch', 'title' => __('Never load plugin JS and CSS on homepage', 'ultimatemember'), 'default' => 0, 'desc' => __('This can disable loading plugin js and css files on home page.', 'ultimatemember'), 'on' => __('On', 'ultimatemember'), 'off' => __('Off', 'ultimatemember')), array('id' => 'js_css_exclude', 'type' => 'multi_text', 'default' => array(), 'title' => __('Never load plugin JS and CSS on the following pages', 'ultimatemember'), 'desc' => __('Enter a url or page slug (e.g /about/) to disable loading the plugin\'s css and js on that page.', 'ultimatemember'), 'add_text' => __('Add New Page', 'ultimatemember')), array('id' => 'js_css_include', 'type' => 'multi_text', 'default' => array(), 'title' => __('Only load plugin JS and CSS on the following pages', 'ultimatemember'), 'desc' => __('Enter a url or page slug (e.g /about/) to enable loading the plugin\'s css and js on that page.', 'ultimatemember'), 'add_text' => __('Add New Page', 'ultimatemember')), array('id' => 'enable_custom_css', 'type' => 'switch', 'title' => __('Enable custom css tab?', 'ultimatemember'), 'default' => 0, 'on' => __('On', 'ultimatemember'), 'off' => __('Off', 'ultimatemember')), array('id' => 'allow_tracking', 'type' => 'switch', 'title' => __('Allow Tracking', 'ultimatemember'), 'default' => 0, 'on' => __('On', 'ultimatemember'), 'off' => __('Off', 'ultimatemember'))));
示例#27
0
 function profile_url()
 {
     global $ultimatemember;
     $page_id = $this->core['user'];
     $profile_url = get_permalink($page_id);
     if (function_exists('icl_get_current_language') && icl_get_current_language() != icl_get_default_language()) {
         if (get_the_ID() > 0 && get_post_meta(get_the_ID(), '_um_wpml_user', true) == 1) {
             $profile_url = get_permalink(get_the_ID());
         }
     }
     // WPML compatibility
     if (function_exists('icl_object_id')) {
         $language_code = ICL_LANGUAGE_CODE;
         $lang_post_id = icl_object_id($page_id, 'page', true, $language_code);
         if ($lang_post_id != 0) {
             $profile_url = get_permalink($lang_post_id);
         } else {
             // No page found, it's most likely the homepage
             global $sitepress;
             $profile_url = $sitepress->language_url($language);
         }
     }
     if (um_get_option('permalink_base') == 'user_login') {
         $user_in_url = um_user('user_login');
         if (is_email($user_in_url)) {
             $user_in_url = str_replace('@', '', $user_in_url);
             if (($pos = strrpos($user_in_url, '.')) !== false) {
                 $search_length = strlen('.');
                 $user_in_url = substr_replace($user_in_url, '-', $pos, $search_length);
             }
         } else {
             $user_in_url = sanitize_title($user_in_url);
         }
     }
     if (um_get_option('permalink_base') == 'user_id') {
         $user_in_url = um_user('ID');
     }
     if (um_get_option('permalink_base') == 'name') {
         $user_in_url = rawurlencode(strtolower(str_replace(" ", ".", um_user('full_name'))));
     }
     if (um_get_option('permalink_base') == 'name_dash') {
         $user_in_url = rawurlencode(strtolower(str_replace(" ", "-", um_user('full_name'))));
     }
     if (um_get_option('permalink_base') == 'name_plus') {
         $user_in_url = strtolower(str_replace(" ", "+", um_user('full_name')));
     }
     if (get_option('permalink_structure')) {
         $profile_url = trailingslashit(untrailingslashit($profile_url));
         $profile_url = $profile_url . $user_in_url . '/';
     } else {
         $profile_url = add_query_arg('um_user', $user_in_url, $profile_url);
     }
     return $profile_url;
 }
示例#28
0
 function add_metabox_form()
 {
     global $ultimatemember;
     if (um_get_option('access_widget_admin_only') && !current_user_can('edit_users')) {
         return;
     }
     $types = $ultimatemember->query->get_post_types;
     foreach ($types as $post_type) {
         if (!$this->core_post_type($post_type)) {
             add_meta_box('um-admin-access-settings', __('Ultimate Member'), array(&$this, 'load_metabox_form'), $post_type, 'side', 'default');
         }
         do_action('um_admin_custom_access_metaboxes');
     }
 }
function um_add_user_role($args)
{
    global $ultimatemember;
    if (isset($args['custom_fields']['role_select']) || isset($args['custom_fields']['role_radio'])) {
        return;
    }
    $use_global_settings = get_post_meta($args['form_id'], '_um_register_use_globals', true);
    if (isset($args['role']) && !empty($args['role']) && $use_global_settings == 0) {
        $role = $args['role'];
    } else {
        if ($use_global_settings == 1) {
            $role = um_get_option('default_role');
        }
    }
    $role = apply_filters('um_register_hidden_role_field', $role);
    if ($role) {
        echo '<input type="hidden" name="role" id="role" value="' . $role . '" />';
    }
}
示例#30
0
 function display_view($mode, $args)
 {
     global $ultimatemember;
     $output = null;
     $this->global_args = $args;
     $ultimatemember->form->form_suffix = '-' . $this->global_args['form_id'];
     $this->set_mode = $mode;
     $this->set_id = $this->global_args['form_id'];
     $this->field_icons = isset($this->global_args['icons']) ? $this->global_args['icons'] : 'label';
     // start output here
     $this->get_fields = $this->get_fields();
     if (um_get_option('profile_empty_text')) {
         $emo = um_get_option('profile_empty_text_emo');
         if ($emo) {
             $emo = '<i class="um-faicon-frown-o"></i>';
         } else {
             $emo = false;
         }
         if (um_is_myprofile()) {
             $output .= '<p class="um-profile-note">' . $emo . '<span>' . sprintf(__('Your profile is looking a little empty. Why not <a href="%s">add</a> some information!', 'ultimatemember'), um_edit_profile_url()) . '</span></p>';
         } else {
             $output .= '<p class="um-profile-note">' . $emo . '<span>' . __('This user has not added any information to their profile yet.', 'ultimatemember') . '</span></p>';
         }
     }
     if (!empty($this->get_fields)) {
         // find rows
         foreach ($this->get_fields as $key => $array) {
             if ($array['type'] == 'row') {
                 $this->rows[$key] = $array;
                 unset($this->get_fields[$key]);
                 // not needed anymore
             }
         }
         // rows fallback
         if (!isset($this->rows)) {
             $this->rows = array('_um_row_1' => array('type' => 'row', 'id' => '_um_row_1', 'sub_rows' => 1, 'cols' => 1));
         }
         // master rows
         foreach ($this->rows as $row_id => $row_array) {
             $row_fields = $this->get_fields_by_row($row_id);
             if ($row_fields) {
                 $output .= $this->new_row_output($row_id, $row_array);
                 $sub_rows = isset($row_array['sub_rows']) ? $row_array['sub_rows'] : 1;
                 for ($c = 0; $c < $sub_rows; $c++) {
                     // cols
                     $cols = isset($row_array['cols']) ? $row_array['cols'] : 1;
                     if (strstr($cols, ':')) {
                         $col_split = explode(':', $cols);
                     } else {
                         $col_split = array($cols);
                     }
                     $cols_num = $col_split[$c];
                     // sub row fields
                     $subrow_fields = null;
                     $subrow_fields = $this->get_fields_in_subrow($row_fields, $c);
                     if (is_array($subrow_fields)) {
                         $subrow_fields = $this->array_sort_by_column($subrow_fields, 'position');
                         if ($cols_num == 1) {
                             $output .= '<div class="um-col-1">';
                             $col1_fields = $this->get_fields_in_column($subrow_fields, 1);
                             if ($col1_fields) {
                                 foreach ($col1_fields as $key => $data) {
                                     $output .= $this->view_field($key, $data);
                                 }
                             }
                             $output .= '</div>';
                         } else {
                             if ($cols_num == 2) {
                                 $output .= '<div class="um-col-121">';
                                 $col1_fields = $this->get_fields_in_column($subrow_fields, 1);
                                 if ($col1_fields) {
                                     foreach ($col1_fields as $key => $data) {
                                         $output .= $this->view_field($key, $data);
                                     }
                                 }
                                 $output .= '</div>';
                                 $output .= '<div class="um-col-122">';
                                 $col2_fields = $this->get_fields_in_column($subrow_fields, 2);
                                 if ($col2_fields) {
                                     foreach ($col2_fields as $key => $data) {
                                         $output .= $this->view_field($key, $data);
                                     }
                                 }
                                 $output .= '</div><div class="um-clear"></div>';
                             } else {
                                 $output .= '<div class="um-col-131">';
                                 $col1_fields = $this->get_fields_in_column($subrow_fields, 1);
                                 if ($col1_fields) {
                                     foreach ($col1_fields as $key => $data) {
                                         $output .= $this->view_field($key, $data);
                                     }
                                 }
                                 $output .= '</div>';
                                 $output .= '<div class="um-col-132">';
                                 $col2_fields = $this->get_fields_in_column($subrow_fields, 2);
                                 if ($col2_fields) {
                                     foreach ($col2_fields as $key => $data) {
                                         $output .= $this->view_field($key, $data);
                                     }
                                 }
                                 $output .= '</div>';
                                 $output .= '<div class="um-col-133">';
                                 $col3_fields = $this->get_fields_in_column($subrow_fields, 3);
                                 if ($col3_fields) {
                                     foreach ($col3_fields as $key => $data) {
                                         $output .= $this->view_field($key, $data);
                                     }
                                 }
                                 $output .= '</div><div class="um-clear"></div>';
                             }
                         }
                     }
                 }
                 $output .= '</div>';
             }
         }
     }
     return $output;
 }