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()));
            }
        }
    }
}
Example #2
0
 function tab_link($id)
 {
     if (get_option('permalink_structure')) {
         $url = trailingslashit(untrailingslashit(um_get_core_page('account')));
         $url = $url . $id . '/';
     } else {
         $url = add_query_arg('um_tab', $id, um_get_core_page('account'));
     }
     return $url;
 }
Example #3
0
 function reset_url()
 {
     global $ultimatemember;
     if (!um_user('reset_pass_hash')) {
         return false;
     }
     $url = add_query_arg('act', 'reset_password', um_get_core_page('password-reset'));
     $url = add_query_arg('hash', esc_attr(um_user('reset_pass_hash')), $url);
     $url = add_query_arg('user_id', esc_attr(um_user('ID')), $url);
     return $url;
 }
function um_change_password_process_hook($args)
{
    global $ultimatemember;
    wp_set_password($args['user_password'], $args['user_id']);
    delete_user_meta($args['user_id'], 'reset_pass_hash');
    delete_user_meta($args['user_id'], 'reset_pass_hash_token');
    do_action('um_after_changing_user_password', $args['user_id']);
    if (is_user_logged_in()) {
        wp_logout();
    }
    exit(wp_redirect(um_get_core_page('login', 'password_changed')));
}
Example #5
0
function um_convert_tags($content, $args = array())
{
    $search = array('{display_name}', '{first_name}', '{last_name}', '{gender}', '{username}', '{email}', '{password}', '{login_url}', '{site_name}', '{site_url}', '{account_activation_link}', '{password_reset_link}', '{admin_email}', '{user_profile_link}', '{user_account_link}', '{submitted_registration}', '{user_avatar_url}');
    $search = apply_filters('um_template_tags_patterns_hook', $search);
    $replace = array(um_user('display_name'), um_user('first_name'), um_user('last_name'), um_user('gender'), um_user('user_login'), um_user('user_email'), um_user('_um_cool_but_hard_to_guess_plain_pw'), um_get_core_page('login'), um_get_option('site_name'), get_bloginfo('url'), um_user('account_activation_link'), um_user('password_reset_link'), um_admin_email(), um_user_profile_url(), um_get_core_page('account'), um_user_submitted_registration(), um_get_user_avatar_url());
    $replace = apply_filters('um_template_tags_replaces_hook', $replace);
    $content = str_replace($search, $replace, $content);
    if (isset($args['tags']) && isset($args['tags_replace'])) {
        $content = str_replace($args['tags'], $args['tags_replace'], $content);
    }
    return $content;
}
 function template_redirect()
 {
     global $ultimatemember;
     do_action('um_access_homepage_per_role');
     do_action('um_access_global_settings');
     do_action('um_access_post_settings');
     if ($this->redirect_handler && !$this->allow_access) {
         // login page add protected page automatically
         if (strstr($this->redirect_handler, um_get_core_page('login'))) {
             $curr = $ultimatemember->permalinks->get_current_url();
             $this->redirect_handler = esc_url(add_query_arg('redirect_to', $curr, $this->redirect_handler));
         }
         exit(wp_redirect($this->redirect_handler));
     }
 }
 function template_redirect()
 {
     global $post, $ultimatemember;
     do_action('um_access_global_settings');
     do_action('um_access_frontpage_per_role');
     do_action('um_access_homepage_per_role');
     do_action('um_access_category_settings');
     do_action('um_access_post_settings');
     if ($this->redirect_handler && $this->allow_access == false && !um_is_core_page('login')) {
         // login page add protected page automatically
         if (strstr($this->redirect_handler, um_get_core_page('login'))) {
             $curr = $ultimatemember->permalinks->get_current_url();
             $this->redirect_handler = esc_url(add_query_arg('redirect_to', urlencode_deep($curr), $this->redirect_handler));
         }
         wp_redirect($this->redirect_handler);
     }
 }
Example #8
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 activate_account_via_email_link()
 {
     global $ultimatemember;
     if (isset($_REQUEST['act']) && $_REQUEST['act'] == 'activate_via_email' && isset($_REQUEST['hash']) && strlen($_REQUEST['hash']) == 40 && isset($_REQUEST['user_id']) && is_numeric($_REQUEST['user_id'])) {
         // valid token
         um_fetch_user($_REQUEST['user_id']);
         if (um_user('account_status') != 'awaiting_email_confirmation') {
             wp_die('The activation link you used is invalid or has expired.');
         }
         if ($_REQUEST['hash'] != um_user('account_secret_hash')) {
             wp_die('The secret key provided does not match this one for the user.');
         }
         $ultimatemember->user->approve();
         $redirect = um_user('url_email_activate') ? um_user('url_email_activate') : um_get_core_page('login', 'account_active');
         um_reset_user();
         exit(wp_redirect($redirect));
     }
 }
Example #10
0
function um_convert_tags($content, $args = array())
{
    $search = array('{display_name}', '{first_name}', '{last_name}', '{gender}', '{username}', '{email}', '{password}', '{login_url}', '{login_referrer}', '{site_name}', '{site_url}', '{account_activation_link}', '{password_reset_link}', '{admin_email}', '{user_profile_link}', '{user_account_link}', '{submitted_registration}', '{user_avatar_url}');
    $search = apply_filters('um_template_tags_patterns_hook', $search);
    $replace = array(um_user('display_name'), um_user('first_name'), um_user('last_name'), um_user('gender'), um_user('user_login'), um_user('user_email'), um_user('_um_cool_but_hard_to_guess_plain_pw'), um_get_core_page('login'), um_dynamic_login_page_redirect(), um_get_option('site_name'), get_bloginfo('url'), um_user('account_activation_link'), um_user('password_reset_link'), um_admin_email(), um_user_profile_url(), um_get_core_page('account'), um_user_submitted_registration(), um_get_user_avatar_url());
    $replace = apply_filters('um_template_tags_replaces_hook', $replace);
    $content = str_replace($search, $replace, $content);
    if (isset($args['tags']) && isset($args['tags_replace'])) {
        $content = str_replace($args['tags'], $args['tags_replace'], $content);
    }
    $regex = '~\\{([^}]*)\\}~';
    preg_match_all($regex, $content, $matches);
    // Support for all usermeta keys
    if (isset($matches[1]) && is_array($matches[1]) && !empty($matches[1])) {
        foreach ($matches[1] as $match) {
            $strip_key = str_replace('usermeta:', '', $match);
            $content = str_replace('{' . $match . '}', um_user($strip_key), $content);
        }
    }
    return $content;
}
function um_logout_user_links($args)
{
    global $ultimatemember;
    ?>

		<li><a href="<?php 
    echo um_get_core_page('account');
    ?>
"><?php 
    _e('Your account', 'ultimatemember');
    ?>
</a></li>
		<li><a href="<?php 
    echo esc_url(add_query_arg('redirect_to', $ultimatemember->permalinks->get_current_url(true), um_get_core_page('logout')));
    ?>
"><?php 
    _e('Logout', 'ultimatemember');
    ?>
</a></li>

	<?php 
}
Example #12
0
***/
add_filter('redux/options/um_options/compiler', 'um_core_page_setting_saved', 100, 3);
function um_core_page_setting_saved($options, $css, $changed_values)
{
    $core_pages = array('user' => __('User page', 'ultimatemember'), 'account' => __('Account page', 'ultimatemember'), 'members' => __('Members page', 'ultimatemember'), 'register' => __('Register page', 'ultimatemember'), 'login' => __('Login page', 'ultimatemember'), 'logout' => __('Logout page', 'ultimatemember'), 'password-reset' => __('Password reset page', 'ultimatemember'));
    $pages = get_option('um_core_pages');
    $core_pages = apply_filters('um_core_pages', $core_pages);
    foreach ($core_pages as $slug => $page) {
        $pages[$slug] = $options['core_' . $slug];
    }
    update_option('um_core_pages', $pages);
}
/***
***	@
***/
$this->sections[] = array('icon' => 'um-faicon-user', 'title' => __('Users', 'ultimatemember'), 'fields' => array(array('id' => 'default_role', 'type' => 'select', 'select2' => array('allowClear' => 0, 'minimumResultsForSearch' => -1), 'title' => __('Default New User Role', 'ultimatemember'), 'desc' => __('Select the default role that will be assigned to user after registration If you did not specify custom role settings per form.', 'ultimatemember'), 'default' => 'member', 'options' => $ultimatemember->query->get_roles(), 'placeholder' => __('Choose user role...', 'ultimatemember')), array('id' => 'permalink_base', 'type' => 'select', 'select2' => array('allowClear' => 0, 'minimumResultsForSearch' => -1), 'title' => __('Profile Permalink Base', 'ultimatemember'), 'desc' => __('Here you can control the permalink structure of the user profile URL globally', 'ultimatemember'), 'default' => 'user_login', 'desc' => 'e.g. ' . trailingslashit(um_get_core_page('user')) . '<strong>username</strong>/', 'options' => array('user_login' => __('Username', 'ultimatemember'), 'name' => __('First and Last Name with \'.\'', 'ultimatemember'), 'name_dash' => __('First and Last Name with \'-\'', 'ultimatemember'), 'name_plus' => __('First and Last Name with \'+\'', 'ultimatemember'), 'user_id' => __('User ID', 'ultimatemember')), 'placeholder' => __('Select...', 'ultimatemember')), array('id' => 'display_name', 'type' => 'select', 'select2' => array('allowClear' => 0, 'minimumResultsForSearch' => -1), 'title' => __('User Display Name', 'ultimatemember'), 'desc' => __('This is the name that will be displayed for users on the front end of your site. Default setting uses first/last name as display name if it exists', 'ultimatemember'), 'default' => 'full_name', 'options' => array('default' => __('Default WP Display Name', 'ultimatemember'), 'nickname' => __('Nickname', 'ultimatemember'), 'username' => __('Username', 'ultimatemember'), 'full_name' => __('First name & last name', 'ultimatemember'), 'sur_name' => __('Last name & first name', 'ultimatemember'), 'initial_name' => __('First name & first initial of last name', 'ultimatemember'), 'initial_name_f' => __('First initial of first name & last name', 'ultimatemember'), 'first_name' => __('First name only', 'ultimatemember'), 'field' => __('Custom field(s)', 'ultimatemember')), 'placeholder' => __('Select...')), array('id' => 'display_name_field', 'type' => 'text', 'title' => __('Display Name Custom Field(s)', 'ultimatemember'), 'desc' => __('Specify the custom field meta key or custom fields seperated by comma that you want to use to display users name on the frontend of your site', 'ultimatemember'), 'required' => array('display_name', '=', 'field')), array('id' => 'author_redirect', 'type' => 'switch', 'title' => __('Automatically redirect author page to their profile?', 'ultimatemember'), 'default' => 1, 'desc' => __('If enabled, author pages will automatically redirect to the user\'s profile page', 'ultimatemember'), 'on' => __('Yes', 'ultimatemember'), 'off' => __('No', 'ultimatemember')), array('id' => 'members_page', 'type' => 'switch', 'title' => __('Enable Members Directory', 'ultimatemember'), 'default' => 1, 'desc' => __('Control whether to enable or disable member directories on this site', 'ultimatemember'), 'on' => __('Yes', 'ultimatemember'), 'off' => __('No', 'ultimatemember')), array('id' => 'use_gravatars', 'type' => 'switch', 'title' => __('Use Gravatars?', 'ultimatemember'), 'default' => 0, 'desc' => __('Do you want to use gravatars instead of the default plugin profile photo (If the user did not upload a custom profile photo / avatar)', 'ultimatemember'), 'on' => __('Yes', 'ultimatemember'), 'off' => __('No', 'ultimatemember')), array('id' => 'use_um_gravatar_default_builtin_image', 'type' => 'select', 'title' => __('Use Gravatar builtin image', 'ultimatemember'), 'desc' => __('Gravatar has a number of built in options which you can also use as defaults', 'ultimatemember'), 'default' => 'default', 'options' => array('default' => __('Default', 'ultimatemember'), '404' => __('404 ( File Not Found response )', 'ultimatemember'), 'mm' => __('Mystery Man', 'ultimatemember'), 'identicon' => __('Identicon', 'ultimatemember'), 'monsterid' => __('Monsterid', 'ultimatemember'), 'wavatar' => __('Wavatar', 'ultimatemember'), 'retro' => __('Retro', 'ultimatemember'), 'blank' => __('Blank ( a transparent PNG image )', 'ultimatemember')), 'required' => array('use_gravatars', '=', 1), 'select2' => array('allowClear' => 0, 'minimumResultsForSearch' => -1)), array('id' => 'use_um_gravatar_default_image', 'type' => 'switch', 'title' => __('Use Default plugin avatar as Gravatar\'s Default avatar', 'ultimatemember'), 'default' => 0, 'desc' => __('Do you want to use the plugin default avatar instead of the gravatar default photo (If the user did not upload a custom profile photo / avatar)', 'ultimatemember'), 'on' => __('Yes', 'ultimatemember'), 'off' => __('No', 'ultimatemember'), 'required' => array('use_um_gravatar_default_builtin_image', '=', 'default')), array('id' => 'reset_require_strongpass', 'type' => 'switch', 'title' => __('Require a strong password? (when user resets password only)', 'ultimatemember'), 'default' => 0, 'desc' => __('Enable or disable a strong password rules on password reset and change procedure', 'ultimatemember'), 'on' => __('On', 'ultimatemember'), 'off' => __('Off', 'ultimatemember')), array('id' => 'editable_primary_email_in_profile', 'type' => 'switch', 'title' => __('Editable primary email field in profile view', 'ultimatemember'), 'default' => 0, 'desc' => __('Allow users to edit their primary emails in profile view ( when email address field is added only )', 'ultimatemember'), 'on' => __('On', 'ultimatemember'), 'off' => __('Off', 'ultimatemember'))));
/***
***	@
***/
$this->sections[] = array('icon' => 'um-faicon-cog', 'title' => __('Account', 'ultimatemember'), 'fields' => array(array('id' => 'account_tab_password', 'type' => 'switch', 'title' => __('Password Account Tab', 'ultimatemember'), 'default' => 1, 'desc' => 'Enable/disable the Password account tab in account page', 'on' => __('On', 'ultimatemember'), 'off' => __('Off', 'ultimatemember')), array('id' => 'account_tab_privacy', 'type' => 'switch', 'title' => __('Privacy Account Tab', 'ultimatemember'), 'default' => 1, 'desc' => __('Enable/disable the Privacy account tab in account page', 'ultimatemember'), 'on' => __('On', 'ultimatemember'), 'off' => __('Off', 'ultimatemember')), array('id' => 'account_tab_notifications', 'type' => 'switch', 'title' => __('Notifications Account Tab', 'ultimatemember'), 'default' => 1, 'desc' => __('Enable/disable the Notifications account tab in account page', 'ultimatemember'), 'on' => __('On', 'ultimatemember'), 'off' => __('Off', 'ultimatemember')), array('id' => 'account_tab_delete', 'type' => 'switch', 'title' => __('Delete Account Tab', 'ultimatemember'), 'default' => 1, 'desc' => __('Enable/disable the Delete account tab in account page', 'ultimatemember'), 'on' => __('On', 'ultimatemember'), 'off' => __('Off', 'ultimatemember')), array('id' => 'delete_account_text', 'type' => 'textarea', 'title' => __('Account Deletion Custom Text', 'ultimatemember'), 'default' => __('Are you sure you want to delete your account? This will erase all of your account data from the site. To delete your account enter your password below', 'ultimatemember'), 'desc' => __('This is custom text that will be displayed to users before they delete their accounts from your site', 'ultimatemember'), 'args' => array('teeny' => false, 'media_buttons' => false, 'textarea_rows' => 6)), array('id' => 'account_name', 'type' => 'switch', 'title' => __('Add a First & Last Name fields', 'ultimatemember'), 'default' => 1, 'desc' => __('Whether to enable these fields on the user account page by default or hide them.', 'ultimatemember'), 'on' => __('On', 'ultimatemember'), 'off' => __('Off', 'ultimatemember')), array('id' => 'account_email', 'type' => 'switch', 'title' => __('Allow users to change e-mail', 'ultimatemember'), 'default' => 1, 'desc' => __('Whether to allow users changing their email in account page.', 'ultimatemember'), 'on' => __('On', 'ultimatemember'), 'off' => __('Off', 'ultimatemember')), array('id' => 'account_hide_in_directory', 'type' => 'switch', 'title' => __('Allow users to hide their profiles from directory', 'ultimatemember'), 'default' => 1, 'desc' => __('Whether to allow users changing their profile visibility from member directory in account page.', 'ultimatemember'), 'on' => __('On', 'ultimatemember'), 'off' => __('Off', 'ultimatemember')), array('id' => 'account_require_strongpass', 'type' => 'switch', 'title' => __('Require a strong password?', 'ultimatemember'), 'default' => 0, 'desc' => __('Enable or disable a strong password rules on account page / change password tab', 'ultimatemember'), 'on' => __('On', 'ultimatemember'), 'off' => __('Off', 'ultimatemember'))));
/***
***	@
***/
$this->sections[] = array('icon' => 'um-faicon-lock', 'title' => __('Access', 'ultimatemember'), 'fields' => array(array('id' => 'panic_key', 'type' => 'text', 'title' => __('Panic Key', 'ultimatemember'), 'desc' => __('Panic Key is a random generated key that allow you to access the WordPress backend always regardless of backend settings.', 'ultimatemember'), 'default' => $ultimatemember->validation->randomize(), 'desc' => trailingslashit(get_bloginfo('url')) . 'wp-admin/?um_panic_key=<strong>your_panic_key</strong>'), array('id' => 'accessible', 'type' => 'select', 'select2' => array('allowClear' => 0, 'minimumResultsForSearch' => -1), 'title' => __('Global Site Access', 'ultimatemember'), 'default' => 0, 'desc' => __('Globally control the access of your site, you can have seperate restrict options per post/page by editing the desired item.', 'ultimatemember'), 'options' => array(0 => 'Site accessible to Everyone', 2 => 'Site accessible to Logged In Users')), array('id' => 'access_redirect', 'type' => 'text', 'title' => __('Custom Redirect URL', 'ultimatemember'), 'desc' => __('A logged out user will be redirected to this url If he is not permitted to access the site', 'ultimatemember'), 'required' => array('accessible', '=', 2)), array('id' => 'access_exclude_uris', 'type' => 'multi_text', 'default' => array(), 'title' => __('Exclude the following URLs', 'ultimatemember'), 'desc' => __('Here you can exclude URLs beside the redirect URI to be accessible to everyone', 'ultimatemember'), 'add_text' => __('Add New URL', 'ultimatemember'), 'required' => array('accessible', '=', 2)), array('id' => 'wpadmin_login', 'type' => 'switch', 'title' => __('Allow Backend Login Screen for Guests', 'ultimatemember'), 'default' => 1, 'desc' => __('Control whether guests are able to access the WP-admin login screen or not', 'ultimatemember'), 'on' => __('Yes', 'ultimatemember'), 'off' => __('No', 'ultimatemember')), array('id' => 'deny_admin_frontend_login', 'type' => 'switch', 'title' => __('Disable Admin Login via Frontend', 'ultimatemember'), 'default' => 0, 'desc' => __('DO NOT turn this option on if you have set the option  "Allow Backend Login Screen for Guests" to NO. This will result in being locked out of admin.', 'ultimatemember'), 'on' => __('Yes', 'ultimatemember'), 'off' => __('No', 'ultimatemember')), array('id' => 'wpadmin_login_redirect', 'type' => 'select', 'select2' => array('allowClear' => 0, 'minimumResultsForSearch' => -1), 'title' => __('Redirect to alternative login page', 'ultimatemember'), 'desc' => __('If you disable backend access to login screen, specify here where a user will be redirected', 'ultimatemember'), 'required' => array('wpadmin_login', '=', 0), 'default' => 'um_login_page', 'options' => array('um_login_page' => 'UM Login Page', 'custom_url' => 'Custom URL')), array('id' => 'wpadmin_login_redirect_url', 'type' => 'text', 'title' => __('Custom URL', 'ultimatemember'), 'desc' => __('Enter an alternate url here to redirect a user If they try to access the backend register screen', 'ultimatemember'), 'required' => array('wpadmin_login_redirect', '=', 'custom_url')), array('id' => 'wpadmin_register', 'type' => 'switch', 'title' => __('Allow Backend Register Screen for Guests', 'ultimatemember'), 'default' => 1, 'desc' => __('Control whether guests are able to access the WP-admin register screen or not', 'ultimatemember'), 'on' => __('Yes', 'ultimatemember'), 'off' => __('No', 'ultimatemember')), array('id' => 'wpadmin_register_redirect', 'type' => 'select', 'select2' => array('allowClear' => 0, 'minimumResultsForSearch' => -1), 'title' => __('Redirect to alternative register page', 'ultimatemember'), 'desc' => __('If you disable backend access to register screen, specify here where a user will be redirected', 'ultimatemember'), 'required' => array('wpadmin_register', '=', 0), 'default' => 'um_register_page', 'options' => array('um_register_page' => 'UM Register Page', 'custom_url' => 'Custom URL')), array('id' => 'wpadmin_register_redirect_url', 'type' => 'text', 'title' => __('Custom URL', 'ultimatemember'), 'desc' => __('Enter an alternate url here to redirect a user If they try to access the backend register screen', 'ultimatemember'), 'required' => array('wpadmin_register_redirect', '=', 'custom_url')), array('id' => 'access_widget_admin_only', 'type' => 'switch', 'title' => __('Enable the Access Control widget for Admins only?', 'ultimatemember'), 'default' => 1, 'on' => __('Yes', 'ultimatemember'), 'off' => __('No', 'ultimatemember')), array('id' => 'wpadmin_allow_ips', 'type' => 'textarea', 'title' => __('Whitelisted Backend IPs', 'ultimatemember'), 'desc' => __('Always allow the specified IP addresses to access the backend login screen and WP-admin to avoid being locked from site backend.', 'ultimatemember')), array('id' => 'blocked_ips', 'type' => 'textarea', 'title' => __('Blocked IP Addresses', 'ultimatemember'), 'desc' => __('This will block the listed IPs from signing up or signing in to the site, you can use full IP numbers or target specific range with a wildcard', 'ultimatemember')), array('id' => 'blocked_emails', 'type' => 'textarea', 'title' => __('Blocked Email Addresses', 'ultimatemember'), 'desc' => __('This will block the specified e-mail addresses from being able to sign up or sign in to your site. To block an entire domain, use something like *@domain.com', 'ultimatemember')), array('id' => 'blocked_words', 'type' => 'textarea', 'title' => __('Blacklist Words', 'ultimatemember'), 'desc' => __('This option lets you specify blacklist of words to prevent anyone from signing up with such a word as their username', 'ultimatemember'), 'default' => 'admin' . "\r\n" . 'administrator' . "\r\n" . 'webmaster' . "\r\n" . 'support' . "\r\n" . 'staff')));
/***
***	@
***/
$this->sections[] = array('icon' => 'um-faicon-envelope-o', 'title' => __('Emails', 'ultimatemember'), 'fields' => array(array('id' => 'mail_from', 'type' => 'text', 'title' => __('Mail appears from', 'ultimatemember'), 'desc' => __('e.g. Site Name', 'ultimatemember'), 'default' => get_bloginfo('name')), array('id' => 'mail_from_addr', 'type' => 'text', 'title' => __('Mail appears from address', 'ultimatemember'), 'desc' => __('e.g. admin@companyname.com', 'ultimatemember'), 'default' => get_bloginfo('admin_email')), array('id' => 'email_html', 'type' => 'switch', 'title' => __('Use HTML for E-mails?', 'ultimatemember'), 'default' => 0, 'desc' => __('If you enable HTML for e-mails, you can customize the HTML e-mail templates found in <strong>templates/email</strong> folder.', 'ultimatemember')), array('id' => 'welcome_email_on', 'type' => 'switch', 'title' => __('Account Welcome Email', 'ultimatemember'), 'default' => 1, 'desc' => __('Whether to send the user an email when his account is automatically approved', 'ultimatemember')), array('id' => 'welcome_email_sub', 'type' => 'text', 'title' => __('Account Welcome Email', 'ultimatemember'), 'subtitle' => __('Subject Line', 'ultimatemember'), 'default' => 'Welcome to {site_name}!', 'required' => array('welcome_email_on', '=', 1), 'desc' => __('This is the subject line of the e-mail', 'ultimatemember')), array('id' => 'welcome_email', 'type' => 'textarea', 'title' => __('Account Welcome Email', 'ultimatemember'), 'subtitle' => __('Message Body', 'ultimatemember'), 'required' => array('welcome_email_on', '=', 1), 'default' => 'Hi {display_name},' . "\r\n\r\n" . 'Thank you for signing up with {site_name}! Your account is now active.' . "\r\n\r\n" . 'To login please visit the following url:' . "\r\n\r\n" . '{login_url}' . "\r\n\r\n" . 'Your account e-mail: {email}' . "\r\n" . 'Your account username: {username}' . "\r\n" . 'Your account password: {password}' . "\r\n\r\n" . 'If you have any problems, please contact us at {admin_email}' . "\r\n\r\n" . 'Thanks,' . "\r\n" . '{site_name}'), array('id' => 'checkmail_email_on', 'type' => 'switch', 'title' => __('Account Activation Email', 'ultimatemember'), 'default' => 1, 'desc' => __('Whether to send the user an email when his account needs e-mail activation', 'ultimatemember')), array('id' => 'checkmail_email_sub', 'type' => 'text', 'title' => __('Account Activation Email', 'ultimatemember'), 'subtitle' => __('Subject Line', 'ultimatemember'), 'default' => 'Please activate your account', 'required' => array('checkmail_email_on', '=', 1), 'desc' => __('This is the subject line of the e-mail', 'ultimatemember')), array('id' => 'checkmail_email', 'type' => 'textarea', 'title' => __('Account Activation Email', 'ultimatemember'), 'subtitle' => __('Message Body', 'ultimatemember'), 'required' => array('checkmail_email_on', '=', 1), 'default' => 'Hi {display_name},' . "\r\n\r\n" . 'Thank you for signing up with {site_name}! To activate your account, please click the link below to confirm your email address:' . "\r\n\r\n" . '{account_activation_link}' . "\r\n\r\n" . 'If you have any problems, please contact us at {admin_email}' . "\r\n\r\n" . 'Thanks,' . "\r\n" . '{site_name}'), array('id' => 'pending_email_on', 'type' => 'switch', 'title' => __('Pending Review Email', 'ultimatemember'), 'default' => 1, 'desc' => __('Whether to send the user an email when his account needs admin review', 'ultimatemember')), array('id' => 'pending_email_sub', 'type' => 'text', 'title' => __('Pending Review Email', 'ultimatemember'), 'subtitle' => __('Subject Line', 'ultimatemember'), 'default' => 'Your account is pending review', 'required' => array('pending_email_on', '=', 1), 'desc' => __('This is the subject line of the e-mail', 'ultimatemember')), array('id' => 'pending_email', 'type' => 'textarea', 'title' => __('Pending Review Email', 'ultimatemember'), 'subtitle' => __('Message Body', 'ultimatemember'), 'required' => array('pending_email_on', '=', 1), 'default' => 'Hi {display_name},' . "\r\n\r\n" . 'Thank you for signing up with {site_name}! Your account is currently being reviewed by a member of our team.' . "\r\n\r\n" . 'Please allow us some time to process your request.' . "\r\n\r\n" . 'If you have any problems, please contact us at {admin_email}' . "\r\n\r\n" . 'Thanks,' . "\r\n" . '{site_name}'), array('id' => 'approved_email_on', 'type' => 'switch', 'title' => __('Account Approved Email', 'ultimatemember'), 'default' => 1, 'desc' => __('Whether to send the user an email when his account is approved', 'ultimatemember')), array('id' => 'approved_email_sub', 'type' => 'text', 'title' => __('Account Approved Email', 'ultimatemember'), 'subtitle' => __('Subject Line', 'ultimatemember'), 'default' => 'Your account at {site_name} is now active', 'required' => array('approved_email_on', '=', 1), 'desc' => __('This is the subject line of the e-mail', 'ultimatemember')), array('id' => 'approved_email', 'type' => 'textarea', 'title' => __('Account Approved Email', 'ultimatemember'), 'subtitle' => __('Message Body', 'ultimatemember'), 'required' => array('approved_email_on', '=', 1), 'default' => 'Hi {display_name},' . "\r\n\r\n" . 'Thank you for signing up with {site_name}! Your account has been approved and is now active.' . "\r\n\r\n" . 'To login please visit the following url:' . "\r\n\r\n" . '{login_url}' . "\r\n\r\n" . 'Your account e-mail: {email}' . "\r\n" . 'Your account username: {username}' . "\r\n" . 'Your account password: {password}' . "\r\n\r\n" . 'If you have any problems, please contact us at {admin_email}' . "\r\n\r\n" . 'Thanks,' . "\r\n" . '{site_name}'), array('id' => 'rejected_email_on', 'type' => 'switch', 'title' => __('Account Rejected Email', 'ultimatemember'), 'default' => 1, 'desc' => __('Whether to send the user an email when his account is rejected', 'ultimatemember')), array('id' => 'rejected_email_sub', 'type' => 'text', 'title' => __('Account Rejected Email', 'ultimatemember'), 'subtitle' => __('Subject Line', 'ultimatemember'), 'default' => 'Your account has been rejected', 'required' => array('rejected_email_on', '=', 1), 'desc' => __('This is the subject line of the e-mail', 'ultimatemember')), array('id' => 'rejected_email', 'type' => 'textarea', 'title' => __('Account Rejected Email', 'ultimatemember'), 'subtitle' => __('Message Body', 'ultimatemember'), 'required' => array('rejected_email_on', '=', 1), 'default' => 'Hi {display_name},' . "\r\n\r\n" . 'Thank you for applying for membership to {site_name}! We have reviewed your information and unfortunately we are unable to accept you as a member at this moment.' . "\r\n\r\n" . 'Please feel free to apply again at a future date.' . "\r\n\r\n" . 'Thanks,' . "\r\n" . '{site_name}'), array('id' => 'inactive_email_on', 'type' => 'switch', 'title' => __('Account Deactivated Email', 'ultimatemember'), 'default' => 1, 'desc' => __('Whether to send the user an email when his account is deactivated', 'ultimatemember')), array('id' => 'inactive_email_sub', 'type' => 'text', 'title' => __('Account Deactivated Email', 'ultimatemember'), 'subtitle' => __('Subject Line', 'ultimatemember'), 'default' => 'Your account has been deactivated', 'required' => array('inactive_email_on', '=', 1), 'desc' => __('This is the subject line of the e-mail', 'ultimatemember')), array('id' => 'inactive_email', 'type' => 'textarea', 'title' => __('Account Deactivated Email', 'ultimatemember'), 'subtitle' => __('Message Body', 'ultimatemember'), 'required' => array('inactive_email_on', '=', 1), 'default' => 'Hi {display_name},' . "\r\n\r\n" . 'This is an automated email to let you know your {site_name} account has been deactivated.' . "\r\n\r\n" . 'If you would like your account to be reactivated please contact us at {admin_email}' . "\r\n\r\n" . 'Thanks,' . "\r\n" . '{site_name}'), array('id' => 'deletion_email_on', 'type' => 'switch', 'title' => __('Account Deleted Email', 'ultimatemember'), 'default' => 1, 'desc' => __('Whether to send the user an email when his account is deleted', 'ultimatemember')), array('id' => 'deletion_email_sub', 'type' => 'text', 'title' => __('Account Deleted Email', 'ultimatemember'), 'subtitle' => __('Subject Line', 'ultimatemember'), 'default' => 'Your account has been deleted', 'required' => array('deletion_email_on', '=', 1), 'desc' => __('This is the subject line of the e-mail', 'ultimatemember')), array('id' => 'deletion_email', 'type' => 'textarea', 'title' => __('Account Deleted Email', 'ultimatemember'), 'subtitle' => __('Message Body', 'ultimatemember'), 'required' => array('deletion_email_on', '=', 1), 'default' => 'Hi {display_name},' . "\r\n\r\n" . 'This is an automated email to let you know your {site_name} account has been deleted. All of your personal information has been permanently deleted and you will no longer be able to login to {site_name}.' . "\r\n\r\n" . 'If your account has been deleted by accident please contact us at {admin_email}' . "\r\n\r\n" . 'Thanks,' . "\r\n" . '{site_name}'), array('id' => 'resetpw_email_on', 'type' => 'switch', 'title' => __('Password Reset Email', 'ultimatemember'), 'default' => 1, 'desc' => __('Whether to send the user an email when he request to reset password (Recommended, please keep on)', 'ultimatemember')), array('id' => 'resetpw_email_sub', 'type' => 'text', 'title' => __('Password Reset Email', 'ultimatemember'), 'subtitle' => __('Subject Line', 'ultimatemember'), 'default' => 'Reset your password', 'required' => array('resetpw_email_on', '=', 1), 'desc' => __('This is the subject line of the e-mail', 'ultimatemember')), array('id' => 'resetpw_email', 'type' => 'textarea', 'title' => __('Password Reset Email', 'ultimatemember'), 'subtitle' => __('Message Body', 'ultimatemember'), 'required' => array('resetpw_email_on', '=', 1), 'default' => 'Hi {display_name},' . "\r\n\r\n" . 'We received a request to reset the password for your account. If you made this request, click the link below to change your password:'******'{password_reset_link}' . "\r\n\r\n" . 'If you didn\'t make this request, you can ignore this email' . "\r\n\r\n" . 'Thanks,' . "\r\n" . '{site_name}'), array('id' => 'changedpw_email_on', 'type' => 'switch', 'title' => __('Password Changed Email', 'ultimatemember'), 'default' => 1, 'desc' => __('Whether to send the user an email when he request to reset password (Recommended, please keep on)', 'ultimatemember')), array('id' => 'changedpw_email_sub', 'type' => 'text', 'title' => __('Password Changed Email', 'ultimatemember'), 'subtitle' => __('Subject Line', 'ultimatemember'), 'default' => 'Your {site_name} password has been changed', 'required' => array('changedpw_email_on', '=', 1), 'desc' => __('This is the subject line of the e-mail', 'ultimatemember')), array('id' => 'changedpw_email', 'type' => 'textarea', 'title' => __('Password Changed Email', 'ultimatemember'), 'subtitle' => __('Message Body', 'ultimatemember'), 'required' => array('changedpw_email_on', '=', 1), 'default' => 'Hi {display_name},' . "\r\n\r\n" . 'You recently changed the password associated with your {site_name} account.' . "\r\n\r\n" . 'If you did not make this change and believe your {site_name} account has been compromised, please contact us at the following email address: {admin_email}' . "\r\n\r\n" . 'Thanks,' . "\r\n" . '{site_name}')));
/***
***	@
***/
function um_access_post_settings()
{
    global $post, $ultimatemember;
    // woo commerce shop ID
    if (function_exists('is_shop') && is_shop()) {
        $um_post_id = get_option('woocommerce_shop_page_id');
    } else {
        if (is_category() || is_archive() || is_search() || in_the_loop() || is_feed() || is_tax() || !get_post_type() || !isset($post->ID) || is_home() || is_front_page()) {
            return;
        }
    }
    if (!isset($um_post_id)) {
        $um_post_id = $post->ID;
    }
    $args = $ultimatemember->access->get_meta($um_post_id);
    extract($args);
    $categories = get_the_category($post->ID);
    // Check post category restriction
    foreach ($categories as $cat) {
        $opt = get_option("category_{$cat->term_id}");
        if (isset($opt['_um_accessible'])) {
            switch ($opt['_um_accessible']) {
                case 0:
                    // Open to everyone
                    $ultimatemember->access->allow_access = true;
                    $ultimatemember->access->redirect_handler = false;
                    // open to everyone
                    break;
                case 1:
                    // Logged out users only
                    if (is_user_logged_in()) {
                        $ultimatemember->access->redirect_handler = isset($opt['_um_redirect']) ? $opt['_um_redirect'] : site_url();
                    }
                    if (!is_user_logged_in()) {
                        $ultimatemember->access->allow_access = true;
                    }
                    break;
                case 2:
                    // Logged in users only
                    if (!is_user_logged_in()) {
                        $ultimatemember->access->redirect_handler = isset($opt['_um_redirect']) && !empty($opt['_um_redirect']) ? $opt['_um_redirect'] : um_get_core_page('login');
                        $ultimatemember->access->allow_access = false;
                    }
                    if (is_user_logged_in()) {
                        if (isset($opt['_um_roles']) && !empty($opt['_um_roles'])) {
                            if (in_array(um_user('role'), $opt['_um_roles'])) {
                                $ultimatemember->access->allow_access = true;
                            } else {
                                $ultimatemember->access->redirect_handler = isset($opt['_um_redirect']) && !empty($opt['_um_redirect']) ? $opt['_um_redirect'] : site_url();
                                $ultimatemember->access->allow_access = false;
                            }
                        } else {
                            // if allowed all roles
                            $ultimatemember->access->allow_access = true;
                        }
                    }
            }
        }
        // end if isset( $opt['_um_accessible'] )
        // if one of the categories has enabled restriction, apply its settings to the current post
        if ($ultimatemember->access->allow_access == false) {
            return;
        }
    }
    // end foreach
    if (!isset($args['custom_access_settings']) || $args['custom_access_settings'] == 0) {
        $um_post_id = apply_filters('um_access_control_for_parent_posts', $um_post_id);
        $args = $ultimatemember->access->get_meta($um_post_id);
        extract($args);
        if (!isset($args['custom_access_settings']) || $args['custom_access_settings'] == 0) {
            return;
        }
    }
    $redirect_to = null;
    if (!isset($accessible)) {
        return;
    }
    switch ($accessible) {
        case 0:
            $ultimatemember->access->allow_access = true;
            $ultimatemember->access->redirect_handler = false;
            // open to everyone
            break;
        case 1:
            $redirect_to = esc_url($access_redirect2);
            if (is_user_logged_in()) {
                $ultimatemember->access->allow_access = false;
            }
            if (!is_user_logged_in()) {
                $ultimatemember->access->allow_access = true;
            }
            if (!empty($redirect_to)) {
                $ultimatemember->access->redirect_handler = esc_url($redirect_to);
            } else {
                if (!is_user_logged_in()) {
                    $ultimatemember->access->redirect_handler = um_get_core_page("login");
                } else {
                    $ultimatemember->access->redirect_handler = um_get_core_page("user");
                }
            }
            break;
        case 2:
            if (!is_user_logged_in()) {
                if (empty($access_redirect)) {
                    $access_redirect = um_get_core_page('login');
                }
                $redirect_to = esc_url($access_redirect);
            }
            if (is_user_logged_in() && isset($access_roles) && !empty($access_roles)) {
                $access_roles = unserialize($access_roles);
                $access_roles = array_filter($access_roles);
                if (!empty($access_roles) && !in_array(um_user('role'), $access_roles)) {
                    if (!$access_redirect) {
                        if (is_user_logged_in()) {
                            $access_redirect = esc_url(site_url());
                        } else {
                            $access_redirect = esc_url(um_get_core_page('login'));
                        }
                    }
                    $redirect_to = esc_url($access_redirect);
                }
            }
            $ultimatemember->access->redirect_handler = esc_url($redirect_to);
            break;
    }
    if (um_is_core_page('user') && !is_user_logged_in()) {
        $ultimatemember->access->allow_access = false;
        $ultimatemember->access->redirect_handler = esc_url($access_redirect);
        wp_redirect($ultimatemember->access->redirect_handler);
        exit;
    }
}
Example #14
0
?>
" target="_blank">User</a></li>
						<li><a href="<?php 
echo um_get_core_page('members');
?>
" target="_blank">Members</a></li>
						<li><a href="<?php 
echo um_get_core_page('account');
?>
" target="_blank">Account</a></li>
						<li><a href="<?php 
echo admin_url('post.php?post=' . $ultimatemember->permalinks->core['logout'] . '&action=edit');
?>
" target="_blank">Logout</a></li>
						<li><a href="<?php 
echo um_get_core_page('password-reset');
?>
" target="_blank">Password Reset</a></li>
					</ul>
				</p>
			</div>

			<div class="last-feature">
				<h4>Getting started</h4>
				<p>The plugin has several different elements in the WordPress admin that allow you to customize your community/membership site:</p>
				<p>
					<ul>
						<li><a href="<?php 
echo admin_url('admin.php?page=ultimatemember');
?>
" target="_blank">Dashboard</a></li>
Example #15
0
<form role="search" method="get" class="search-form um-search-form" action="<?php 
echo esc_url(um_get_core_page('members'));
?>
">
	<input type="hidden" name="um_search" value="1">
    <div class="um-search-area">
        <span class="screen-reader-text"><?php 
echo _x('Search for:', 'label');
?>
</span>
        <input type="search" class="um-search-field search-field" placeholder="<?php 
echo esc_attr_x('Search &hellip;', 'placeholder');
?>
" value="<?php 
echo um_get_search_query();
?>
" name="search" title="<?php 
echo esc_attr_x('Search for:', 'label');
?>
" />
        <a href="javascript: void(0);" id="um-search-button" class="um-search-icon um-faicon um-faicon-search"></a>
    </div>
</form>
Example #16
0
function um_after_login_submit($args)
{
    global $ultimatemember;
    if ($args['forgot_pass_link'] == 0) {
        return;
    }
    ?>
		
		<div class="um-col-alt-b">
			<a href="<?php 
    echo um_get_core_page('password-reset');
    ?>
" class="um-link-alt"><?php 
    _e('Forgot your password?', 'ultimatemember');
    ?>
</a>
		</div>
		
		<?php 
}
Example #17
0
<div class="um <?php 
echo $this->get_class($mode, $args);
?>
 um-<?php 
echo $form_id;
?>
" data-error_required="This field is required" data-password_not_match="Passwords do not match" data-password_not_long="Password must be 8 characters at least">

	<div class="um-form">
	
		<div class="um-misc-with-img">
			
			<div class="um-misc-img">
				<a href="<?php 
echo um_get_core_page('user');
?>
"><?php 
echo um_user('profile_photo', 80);
?>
</a>
			</div>
			
			<div><strong><?php 
echo um_user('display_name');
?>
</strong></div>
			
			<?php 
do_action('um_logout_after_user_welcome', $args);
?>
			
Example #18
0
 function activate_account_via_email_link()
 {
     global $ultimatemember;
     if (isset($_REQUEST['act']) && $_REQUEST['act'] == 'activate_via_email' && isset($_REQUEST['hash']) && strlen($_REQUEST['hash']) == 40 && isset($_REQUEST['user_id']) && is_numeric($_REQUEST['user_id'])) {
         // valid token
         $user_id = absint($_REQUEST['user_id']);
         delete_option("um_cache_userdata_{$user_id}");
         um_fetch_user($user_id);
         if (um_user('account_status') != 'awaiting_email_confirmation') {
             wp_die('The activation link you used is invalid or has expired.');
         }
         if (strtolower($_REQUEST['hash']) !== strtolower(um_user('account_secret_hash'))) {
             wp_die('The secret key provided does not match this one for the user.');
         }
         $ultimatemember->user->approve();
         $redirect = um_user('url_email_activate') ? um_user('url_email_activate') : um_get_core_page('login', 'account_active');
         $login = (bool) um_user('login_email_activate');
         // log in automatically
         if (!is_user_logged_in() && $login) {
             $user = get_userdata($user_id);
             $user_id = $user->ID;
             // update wp user
             wp_set_current_user($user_id, $user_login);
             wp_set_auth_cookie($user_id);
             ob_start();
             do_action('wp_login', $user_login);
             ob_end_clean();
         }
         um_reset_user();
         do_action('um_after_email_confirmation', $user_id);
         exit(wp_redirect($redirect));
     }
 }
Example #19
0
***/
add_filter('redux/options/um_options/compiler', 'um_core_page_setting_saved', 100, 3);
function um_core_page_setting_saved($options, $css, $changed_values)
{
    $core_pages = array('user' => __('User page', 'ultimatemember'), 'account' => __('Account page', 'ultimatemember'), 'members' => __('Members page', 'ultimatemember'), 'register' => __('Register page', 'ultimatemember'), 'login' => __('Login page', 'ultimatemember'), 'logout' => __('Logout page', 'ultimatemember'), 'password-reset' => __('Password reset page', 'ultimatemember'));
    $pages = get_option('um_core_pages');
    $core_pages = apply_filters('um_core_pages', $core_pages);
    foreach ($core_pages as $slug => $page) {
        $pages[$slug] = $options['core_' . $slug];
    }
    update_option('um_core_pages', $pages);
}
/***
***	@
***/
$this->sections[] = array('icon' => 'um-faicon-user', 'title' => __('Users', 'ultimatemember'), 'fields' => array(array('id' => 'default_role', 'type' => 'select', 'select2' => array('allowClear' => 0, 'minimumResultsForSearch' => -1), 'title' => __('Default New User Role', 'ultimatemember'), 'desc' => __('Select the default role that will be assigned to user after registration If you did not specify custom role settings per form.', 'ultimatemember'), 'default' => 'member', 'options' => $ultimatemember->query->get_roles(), 'placeholder' => __('Choose user role...', 'ultimatemember')), array('id' => 'permalink_base', 'type' => 'select', 'select2' => array('allowClear' => 0, 'minimumResultsForSearch' => -1), 'title' => __('Profile Permalink Base', 'ultimatemember'), 'desc' => __('Here you can control the permalink structure of the user profile URL globally', 'ultimatemember'), 'default' => 'user_login', 'desc' => 'e.g. ' . trailingslashit(um_get_core_page('user')) . '<strong>username</strong>/', 'options' => array('user_login' => __('Username', 'ultimatemember'), 'name' => __('First and Last Name', 'ultimatemember'), 'user_id' => __('User ID', 'ultimatemember')), 'placeholder' => __('Select...', 'ultimatemember')), array('id' => 'display_name', 'type' => 'select', 'select2' => array('allowClear' => 0, 'minimumResultsForSearch' => -1), 'title' => __('User Display Name', 'ultimatemember'), 'desc' => __('This is the name that will be displayed for users on the front end of your site. Default setting uses first/last name as display name if it exists', 'ultimatemember'), 'default' => 'full_name', 'options' => array('username' => __('Username', 'ultimatemember'), 'full_name' => __('First name & last name', 'ultimatemember'), 'sur_name' => __('Last name & first name', 'ultimatemember'), 'initial_name' => __('First name & first initial of last name', 'ultimatemember'), 'initial_name_f' => __('First initial of first name & last name', 'ultimatemember'), 'first_name' => __('First name only', 'ultimatemember'), 'public_name' => __('Display name', 'ultimatemember'), 'field' => __('Custom field(s)', 'ultimatemember')), 'placeholder' => __('Select...')), array('id' => 'display_name_field', 'type' => 'text', 'title' => __('Display Name Custom Field(s)', 'ultimatemember'), 'desc' => __('Specify the custom field meta key or custom fields seperated by comma that you want to use to display users name on the frontend of your site', 'ultimatemember'), 'required' => array('display_name', '=', 'field')), array('id' => 'author_redirect', 'type' => 'switch', 'title' => __('Automatically redirect author page to their profile?', 'ultimatemember'), 'default' => 1, 'desc' => __('If enabled, author pages will automatically redirect to the user\'s profile page', 'ultimatemember'), 'on' => __('Yes', 'ultimatemember'), 'off' => __('No', 'ultimatemember')), array('id' => 'members_page', 'type' => 'switch', 'title' => __('Enable Members Directory', 'ultimatemember'), 'default' => 1, 'desc' => __('Control whether to enable or disable member directories on this site', 'ultimatemember'), 'on' => __('Yes', 'ultimatemember'), 'off' => __('No', 'ultimatemember')), array('id' => 'use_gravatars', 'type' => 'switch', 'title' => __('Use Gravatars?', 'ultimatemember'), 'default' => 0, 'desc' => __('Do you want to use gravatars instead of the default plugin profile photo (If the user did not upload a custom profile photo / avatar)', 'ultimatemember'), 'on' => __('Yes', 'ultimatemember'), 'off' => __('No', 'ultimatemember')), array('id' => 'reset_require_strongpass', 'type' => 'switch', 'title' => __('Require a strong password? (when user resets password only)', 'ultimatemember'), 'default' => 0, 'desc' => __('Enable or disable a strong password rules on password reset and change procedure', 'ultimatemember'), 'on' => __('On', 'ultimatemember'), 'off' => __('Off', 'ultimatemember'))));
/***
***	@
***/
$this->sections[] = array('icon' => 'um-faicon-cog', 'title' => __('Account', 'ultimatemember'), 'fields' => array(array('id' => 'account_tab_password', 'type' => 'switch', 'title' => __('Password Account Tab', 'ultimatemember'), 'default' => 1, 'desc' => 'Enable/disable the Password account tab in account page', 'on' => __('On', 'ultimatemember'), 'off' => __('Off', 'ultimatemember')), array('id' => 'account_tab_privacy', 'type' => 'switch', 'title' => __('Privacy Account Tab', 'ultimatemember'), 'default' => 1, 'desc' => __('Enable/disable the Privacy account tab in account page', 'ultimatemember'), 'on' => __('On', 'ultimatemember'), 'off' => __('Off', 'ultimatemember')), array('id' => 'account_tab_notifications', 'type' => 'switch', 'title' => __('Notifications Account Tab', 'ultimatemember'), 'default' => 1, 'desc' => __('Enable/disable the Notifications account tab in account page', 'ultimatemember'), 'on' => __('On', 'ultimatemember'), 'off' => __('Off', 'ultimatemember')), array('id' => 'account_tab_delete', 'type' => 'switch', 'title' => __('Delete Account Tab', 'ultimatemember'), 'default' => 1, 'desc' => __('Enable/disable the Delete account tab in account page', 'ultimatemember'), 'on' => __('On', 'ultimatemember'), 'off' => __('Off', 'ultimatemember')), array('id' => 'delete_account_text', 'type' => 'textarea', 'title' => __('Account Deletion Custom Text', 'ultimatemember'), 'default' => __('Are you sure you want to delete your account? This will erase all of your account data from the site. To delete your account enter your password below', 'ultimatemember'), 'desc' => __('This is custom text that will be displayed to users before they delete their accounts from your site', 'ultimatemember'), 'args' => array('teeny' => false, 'media_buttons' => false, 'textarea_rows' => 6)), array('id' => 'account_name', 'type' => 'switch', 'title' => __('Add a First & Last Name fields', 'ultimatemember'), 'default' => 1, 'desc' => __('Whether to enable these fields on the user account page by default or hide them.', 'ultimatemember'), 'on' => __('On', 'ultimatemember'), 'off' => __('Off', 'ultimatemember')), array('id' => 'account_email', 'type' => 'switch', 'title' => __('Allow users to change e-mail', 'ultimatemember'), 'default' => 1, 'desc' => __('Whether to allow users changing their email in account page.', 'ultimatemember'), 'on' => __('On', 'ultimatemember'), 'off' => __('Off', 'ultimatemember')), array('id' => 'account_require_strongpass', 'type' => 'switch', 'title' => __('Require a strong password?', 'ultimatemember'), 'default' => 0, 'desc' => __('Enable or disable a strong password rules on account page / change password tab', 'ultimatemember'), 'on' => __('On', 'ultimatemember'), 'off' => __('Off', 'ultimatemember'))));
/***
***	@
***/
$this->sections[] = array('icon' => 'um-faicon-lock', 'title' => __('Access', 'ultimatemember'), 'fields' => array(array('id' => 'panic_key', 'type' => 'text', 'title' => __('Panic Key', 'ultimatemember'), 'desc' => __('Panic Key is a random generated key that allow you to access the WordPress backend always regardless of backend settings.', 'ultimatemember'), 'default' => $ultimatemember->validation->randomize(), 'desc' => trailingslashit(get_bloginfo('url')) . 'wp-admin/?um_panic_key=<strong>your_panic_key</strong>'), array('id' => 'accessible', 'type' => 'select', 'select2' => array('allowClear' => 0, 'minimumResultsForSearch' => -1), 'title' => __('Global Site Access', 'ultimatemember'), 'default' => 0, 'desc' => __('Globally control the access of your site, you can have seperate restrict options per post/page by editing the desired item.', 'ultimatemember'), 'options' => array(0 => 'Site accessible to Everyone', 2 => 'Site accessible to Logged In Users')), array('id' => 'access_redirect', 'type' => 'text', 'title' => __('Custom Redirect URL', 'ultimatemember'), 'desc' => __('A logged out user will be redirected to this url If he is not permitted to access the site', 'ultimatemember'), 'required' => array('accessible', '=', 2)), array('id' => 'access_exclude_uris', 'type' => 'multi_text', 'default' => array(), 'title' => __('Exclude the following URLs', 'ultimatemember'), 'desc' => __('Here you can exclude URLs beside the redirect URI to be accessible to everyone', 'ultimatemember'), 'add_text' => __('Add New URL', 'ultimatemember'), 'required' => array('accessible', '=', 2)), array('id' => 'wpadmin_login', 'type' => 'switch', 'title' => __('Allow Backend Login Screen for Guests', 'ultimatemember'), 'default' => 1, 'desc' => __('Control whether guests are able to access the WP-admin login screen or not', 'ultimatemember'), 'on' => __('Yes', 'ultimatemember'), 'off' => __('No', 'ultimatemember')), array('id' => 'deny_admin_frontend_login', 'type' => 'switch', 'title' => __('Disable Admin Login via Frontend', 'ultimatemember'), 'default' => 0, 'desc' => __('DO NOT turn this option on if you have set the option  "Allow Backend Login Screen for Guests" to NO. This will result in being locked out of admin.', 'ultimatemember'), 'on' => __('Yes', 'ultimatemember'), 'off' => __('No', 'ultimatemember')), array('id' => 'wpadmin_login_redirect', 'type' => 'select', 'select2' => array('allowClear' => 0, 'minimumResultsForSearch' => -1), 'title' => __('Redirect to alternative login page', 'ultimatemember'), 'desc' => __('If you disable backend access to login screen, specify here where a user will be redirected', 'ultimatemember'), 'required' => array('wpadmin_login', '=', 0), 'default' => 'um_login_page', 'options' => array('um_login_page' => 'UM Login Page', 'custom_url' => 'Custom URL')), array('id' => 'wpadmin_login_redirect_url', 'type' => 'text', 'title' => __('Custom URL', 'ultimatemember'), 'desc' => __('Enter an alternate url here to redirect a user If they try to access the backend register screen', 'ultimatemember'), 'required' => array('wpadmin_login_redirect', '=', 'custom_url')), array('id' => 'wpadmin_register', 'type' => 'switch', 'title' => __('Allow Backend Register Screen for Guests', 'ultimatemember'), 'default' => 1, 'desc' => __('Control whether guests are able to access the WP-admin register screen or not', 'ultimatemember'), 'on' => __('Yes', 'ultimatemember'), 'off' => __('No', 'ultimatemember')), array('id' => 'wpadmin_register_redirect', 'type' => 'select', 'select2' => array('allowClear' => 0, 'minimumResultsForSearch' => -1), 'title' => __('Redirect to alternative register page', 'ultimatemember'), 'desc' => __('If you disable backend access to register screen, specify here where a user will be redirected', 'ultimatemember'), 'required' => array('wpadmin_register', '=', 0), 'default' => 'um_register_page', 'options' => array('um_register_page' => 'UM Register Page', 'custom_url' => 'Custom URL')), array('id' => 'wpadmin_register_redirect_url', 'type' => 'text', 'title' => __('Custom URL', 'ultimatemember'), 'desc' => __('Enter an alternate url here to redirect a user If they try to access the backend register screen', 'ultimatemember'), 'required' => array('wpadmin_register_redirect', '=', 'custom_url')), array('id' => 'access_widget_admin_only', 'type' => 'switch', 'title' => __('Enable the Access Control widget for Admins only?', 'ultimatemember'), 'default' => 1, 'on' => __('Yes', 'ultimatemember'), 'off' => __('No', 'ultimatemember')), array('id' => 'wpadmin_allow_ips', 'type' => 'textarea', 'title' => __('Whitelisted Backend IPs', 'ultimatemember'), 'desc' => __('Always allow the specified IP addresses to access the backend login screen and WP-admin to avoid being locked from site backend.', 'ultimatemember')), array('id' => 'blocked_ips', 'type' => 'textarea', 'title' => __('Blocked IP Addresses', 'ultimatemember'), 'desc' => __('This will block the listed IPs from signing up or signing in to the site, you can use full IP numbers or target specific range with a wildcard', 'ultimatemember')), array('id' => 'blocked_emails', 'type' => 'textarea', 'title' => __('Blocked Email Addresses', 'ultimatemember'), 'desc' => __('This will block the specified e-mail addresses from being able to sign up or sign in to your site. To block an entire domain, use something like *@domain.com', 'ultimatemember')), array('id' => 'blocked_words', 'type' => 'textarea', 'title' => __('Blacklist Words', 'ultimatemember'), 'desc' => __('This option lets you specify blacklist of words to prevent anyone from signing up with such a word as their username', 'ultimatemember'), 'default' => 'admin' . "\r\n" . 'administrator' . "\r\n" . 'webmaster' . "\r\n" . 'support' . "\r\n" . 'staff')));
/***
***	@
***/
$this->sections[] = array('icon' => 'um-faicon-envelope-o', 'title' => __('Emails', 'ultimatemember'), 'fields' => array(array('id' => 'mail_from', 'type' => 'text', 'title' => __('Mail appears from', 'ultimatemember'), 'desc' => __('e.g. Site Name', 'ultimatemember'), 'default' => get_bloginfo('name')), array('id' => 'mail_from_addr', 'type' => 'text', 'title' => __('Mail appears from address', 'ultimatemember'), 'desc' => __('e.g. admin@companyname.com', 'ultimatemember'), 'default' => get_bloginfo('admin_email')), array('id' => 'email_html', 'type' => 'switch', 'title' => __('Use HTML for E-mails?', 'ultimatemember'), 'default' => 0, 'desc' => __('If you enable HTML for e-mails, you can customize the HTML e-mail templates found in <strong>templates/email</strong> folder.', 'ultimatemember')), array('id' => 'welcome_email_on', 'type' => 'switch', 'title' => __('Account Welcome Email', 'ultimatemember'), 'default' => 1, 'desc' => __('Whether to send the user an email when his account is automatically approved', 'ultimatemember')), array('id' => 'welcome_email_sub', 'type' => 'text', 'title' => __('Account Welcome Email', 'ultimatemember'), 'subtitle' => __('Subject Line', 'ultimatemember'), 'default' => 'Welcome to {site_name}!', 'required' => array('welcome_email_on', '=', 1), 'desc' => __('This is the subject line of the e-mail', 'ultimatemember')), array('id' => 'welcome_email', 'type' => 'textarea', 'title' => __('Account Welcome Email', 'ultimatemember'), 'subtitle' => __('Message Body', 'ultimatemember'), 'required' => array('welcome_email_on', '=', 1), 'default' => 'Hi {display_name},' . "\r\n\r\n" . 'Thank you for signing up with {site_name}! Your account is now active.' . "\r\n\r\n" . 'To login please visit the following url:' . "\r\n\r\n" . '{login_url}' . "\r\n\r\n" . 'Your account e-mail: {email}' . "\r\n" . 'Your account username: {username}' . "\r\n" . 'Your account password: {password}' . "\r\n\r\n" . 'If you have any problems, please contact us at {admin_email}' . "\r\n\r\n" . 'Thanks,' . "\r\n" . '{site_name}'), array('id' => 'checkmail_email_on', 'type' => 'switch', 'title' => __('Account Activation Email', 'ultimatemember'), 'default' => 1, 'desc' => __('Whether to send the user an email when his account needs e-mail activation', 'ultimatemember')), array('id' => 'checkmail_email_sub', 'type' => 'text', 'title' => __('Account Activation Email', 'ultimatemember'), 'subtitle' => __('Subject Line', 'ultimatemember'), 'default' => 'Please activate your account', 'required' => array('checkmail_email_on', '=', 1), 'desc' => __('This is the subject line of the e-mail', 'ultimatemember')), array('id' => 'checkmail_email', 'type' => 'textarea', 'title' => __('Account Activation Email', 'ultimatemember'), 'subtitle' => __('Message Body', 'ultimatemember'), 'required' => array('checkmail_email_on', '=', 1), 'default' => 'Hi {display_name},' . "\r\n\r\n" . 'Thank you for signing up with {site_name}! To activate your account, please click the link below to confirm your email address:' . "\r\n\r\n" . '{account_activation_link}' . "\r\n\r\n" . 'If you have any problems, please contact us at {admin_email}' . "\r\n\r\n" . 'Thanks,' . "\r\n" . '{site_name}'), array('id' => 'pending_email_on', 'type' => 'switch', 'title' => __('Pending Review Email', 'ultimatemember'), 'default' => 1, 'desc' => __('Whether to send the user an email when his account needs admin review', 'ultimatemember')), array('id' => 'pending_email_sub', 'type' => 'text', 'title' => __('Pending Review Email', 'ultimatemember'), 'subtitle' => __('Subject Line', 'ultimatemember'), 'default' => 'Your account is pending review', 'required' => array('pending_email_on', '=', 1), 'desc' => __('This is the subject line of the e-mail', 'ultimatemember')), array('id' => 'pending_email', 'type' => 'textarea', 'title' => __('Pending Review Email', 'ultimatemember'), 'subtitle' => __('Message Body', 'ultimatemember'), 'required' => array('pending_email_on', '=', 1), 'default' => 'Hi {display_name},' . "\r\n\r\n" . 'Thank you for signing up with {site_name}! Your account is currently being reviewed by a member of our team.' . "\r\n\r\n" . 'Please allow us some time to process your request.' . "\r\n\r\n" . 'If you have any problems, please contact us at {admin_email}' . "\r\n\r\n" . 'Thanks,' . "\r\n" . '{site_name}'), array('id' => 'approved_email_on', 'type' => 'switch', 'title' => __('Account Approved Email', 'ultimatemember'), 'default' => 1, 'desc' => __('Whether to send the user an email when his account is approved', 'ultimatemember')), array('id' => 'approved_email_sub', 'type' => 'text', 'title' => __('Account Approved Email', 'ultimatemember'), 'subtitle' => __('Subject Line', 'ultimatemember'), 'default' => 'Your account at {site_name} is now active', 'required' => array('approved_email_on', '=', 1), 'desc' => __('This is the subject line of the e-mail', 'ultimatemember')), array('id' => 'approved_email', 'type' => 'textarea', 'title' => __('Account Approved Email', 'ultimatemember'), 'subtitle' => __('Message Body', 'ultimatemember'), 'required' => array('approved_email_on', '=', 1), 'default' => 'Hi {display_name},' . "\r\n\r\n" . 'Thank you for signing up with {site_name}! Your account has been approved and is now active.' . "\r\n\r\n" . 'To login please visit the following url:' . "\r\n\r\n" . '{login_url}' . "\r\n\r\n" . 'Your account e-mail: {email}' . "\r\n" . 'Your account username: {username}' . "\r\n" . 'Your account password: {password}' . "\r\n\r\n" . 'If you have any problems, please contact us at {admin_email}' . "\r\n\r\n" . 'Thanks,' . "\r\n" . '{site_name}'), array('id' => 'rejected_email_on', 'type' => 'switch', 'title' => __('Account Rejected Email', 'ultimatemember'), 'default' => 1, 'desc' => __('Whether to send the user an email when his account is rejected', 'ultimatemember')), array('id' => 'rejected_email_sub', 'type' => 'text', 'title' => __('Account Rejected Email', 'ultimatemember'), 'subtitle' => __('Subject Line', 'ultimatemember'), 'default' => 'Your account has been rejected', 'required' => array('rejected_email_on', '=', 1), 'desc' => __('This is the subject line of the e-mail', 'ultimatemember')), array('id' => 'rejected_email', 'type' => 'textarea', 'title' => __('Account Rejected Email', 'ultimatemember'), 'subtitle' => __('Message Body', 'ultimatemember'), 'required' => array('rejected_email_on', '=', 1), 'default' => 'Hi {display_name},' . "\r\n\r\n" . 'Thank you for applying for membership to {site_name}! We have reviewed your information and unfortunately we are unable to accept you as a member at this moment.' . "\r\n\r\n" . 'Please feel free to apply again at a future date.' . "\r\n\r\n" . 'Thanks,' . "\r\n" . '{site_name}'), array('id' => 'inactive_email_on', 'type' => 'switch', 'title' => __('Account Deactivated Email', 'ultimatemember'), 'default' => 1, 'desc' => __('Whether to send the user an email when his account is deactivated', 'ultimatemember')), array('id' => 'inactive_email_sub', 'type' => 'text', 'title' => __('Account Deactivated Email', 'ultimatemember'), 'subtitle' => __('Subject Line', 'ultimatemember'), 'default' => 'Your account has been deactivated', 'required' => array('inactive_email_on', '=', 1), 'desc' => __('This is the subject line of the e-mail', 'ultimatemember')), array('id' => 'inactive_email', 'type' => 'textarea', 'title' => __('Account Deactivated Email', 'ultimatemember'), 'subtitle' => __('Message Body', 'ultimatemember'), 'required' => array('inactive_email_on', '=', 1), 'default' => 'Hi {display_name},' . "\r\n\r\n" . 'This is an automated email to let you know your {site_name} account has been deactivated.' . "\r\n\r\n" . 'If you would like your account to be reactivated please contact us at {admin_email}' . "\r\n\r\n" . 'Thanks,' . "\r\n" . '{site_name}'), array('id' => 'deletion_email_on', 'type' => 'switch', 'title' => __('Account Deleted Email', 'ultimatemember'), 'default' => 1, 'desc' => __('Whether to send the user an email when his account is deleted', 'ultimatemember')), array('id' => 'deletion_email_sub', 'type' => 'text', 'title' => __('Account Deleted Email', 'ultimatemember'), 'subtitle' => __('Subject Line', 'ultimatemember'), 'default' => 'Your account has been deleted', 'required' => array('deletion_email_on', '=', 1), 'desc' => __('This is the subject line of the e-mail', 'ultimatemember')), array('id' => 'deletion_email', 'type' => 'textarea', 'title' => __('Account Deleted Email', 'ultimatemember'), 'subtitle' => __('Message Body', 'ultimatemember'), 'required' => array('deletion_email_on', '=', 1), 'default' => 'Hi {display_name},' . "\r\n\r\n" . 'This is an automated email to let you know your {site_name} account has been deleted. All of your personal information has been permanently deleted and you will no longer be able to login to {site_name}.' . "\r\n\r\n" . 'If your account has been deleted by accident please contact us at {admin_email}' . "\r\n\r\n" . 'Thanks,' . "\r\n" . '{site_name}'), array('id' => 'resetpw_email_on', 'type' => 'switch', 'title' => __('Password Reset Email', 'ultimatemember'), 'default' => 1, 'desc' => __('Whether to send the user an email when he request to reset password (Recommended, please keep on)', 'ultimatemember')), array('id' => 'resetpw_email_sub', 'type' => 'text', 'title' => __('Password Reset Email', 'ultimatemember'), 'subtitle' => __('Subject Line', 'ultimatemember'), 'default' => 'Reset your password', 'required' => array('resetpw_email_on', '=', 1), 'desc' => __('This is the subject line of the e-mail', 'ultimatemember')), array('id' => 'resetpw_email', 'type' => 'textarea', 'title' => __('Password Reset Email', 'ultimatemember'), 'subtitle' => __('Message Body', 'ultimatemember'), 'required' => array('resetpw_email_on', '=', 1), 'default' => 'Hi {display_name},' . "\r\n\r\n" . 'We received a request to reset the password for your account. If you made this request, click the link below to change your password:'******'{password_reset_link}' . "\r\n\r\n" . 'If you didn\'t make this request, you can ignore this email' . "\r\n\r\n" . 'Thanks,' . "\r\n" . '{site_name}'), array('id' => 'changedpw_email_on', 'type' => 'switch', 'title' => __('Password Changed Email', 'ultimatemember'), 'default' => 1, 'desc' => __('Whether to send the user an email when he request to reset password (Recommended, please keep on)', 'ultimatemember')), array('id' => 'changedpw_email_sub', 'type' => 'text', 'title' => __('Password Changed Email', 'ultimatemember'), 'subtitle' => __('Subject Line', 'ultimatemember'), 'default' => 'Your {site_name} password has been changed', 'required' => array('changedpw_email_on', '=', 1), 'desc' => __('This is the subject line of the e-mail', 'ultimatemember')), array('id' => 'changedpw_email', 'type' => 'textarea', 'title' => __('Password Changed Email', 'ultimatemember'), 'subtitle' => __('Message Body', 'ultimatemember'), 'required' => array('changedpw_email_on', '=', 1), 'default' => 'Hi {display_name},' . "\r\n\r\n" . 'You recently changed the password associated with your {site_name} account.' . "\r\n\r\n" . 'If you did not make this change and believe your {site_name} account has been compromised, please contact us at the following email address: {admin_email}' . "\r\n\r\n" . 'Thanks,' . "\r\n" . '{site_name}')));
/***
***	@
***/
function um_access_post_settings()
{
    global $post, $ultimatemember;
    // woo commerce shop ID
    if (function_exists('is_shop') && is_shop()) {
        $post_id = get_option('woocommerce_shop_page_id');
    } else {
        if (is_archive() || is_front_page() || is_search() || in_the_loop()) {
            return;
        } else {
            if (!get_post_type() || !isset($post->ID)) {
                return;
            }
        }
    }
    if (!isset($post_id)) {
        $post_id = $post->ID;
    }
    $args = $ultimatemember->access->get_meta($post_id);
    extract($args);
    if (!isset($args['custom_access_settings']) || $args['custom_access_settings'] == 0) {
        $post_id = apply_filters('um_access_control_for_parent_posts', $post_id);
        $args = $ultimatemember->access->get_meta($post_id);
        extract($args);
        if (!isset($args['custom_access_settings']) || $args['custom_access_settings'] == 0) {
            return;
        }
    }
    $redirect_to = null;
    if (!isset($accessible)) {
        return;
    }
    switch ($accessible) {
        case 0:
            $ultimatemember->access->allow_access = true;
            $ultimatemember->access->redirect_handler = false;
            // open to everyone
            break;
        case 1:
            if (is_user_logged_in()) {
                $redirect_to = $access_redirect2;
            }
            if (!is_user_logged_in()) {
                $ultimatemember->access->allow_access = true;
            }
            break;
        case 2:
            if (!is_user_logged_in()) {
                if (!$access_redirect) {
                    $access_redirect = um_get_core_page('login');
                }
                $redirect_to = $access_redirect;
            }
            if (is_user_logged_in() && isset($access_roles) && !empty($access_roles)) {
                if (!in_array(um_user('role'), unserialize($access_roles))) {
                    if (!$access_redirect) {
                        if (is_user_logged_in()) {
                            $access_redirect = home_url();
                        } else {
                            $access_redirect = um_get_core_page('login');
                        }
                    }
                    $redirect_to = $access_redirect;
                }
            }
            break;
    }
    if ($redirect_to) {
        if (is_feed()) {
        } else {
            $ultimatemember->access->allow_access = false;
            $ultimatemember->access->redirect_handler = $redirect_to;
        }
    }
}
function um_add_edit_icon($args)
{
    global $ultimatemember;
    $output = '';
    if (!is_user_logged_in()) {
        return;
    }
    // not allowed for guests
    if (isset($ultimatemember->user->cannot_edit) && $ultimatemember->user->cannot_edit == 1) {
        return;
    }
    // do not proceed if user cannot edit
    if ($ultimatemember->fields->editing == true) {
        ?>

		<div class="um-profile-edit um-profile-headericon">

			<a href="#" class="um-profile-edit-a um-profile-save"><i class="um-faicon-check"></i></a>

		</div>

		<?php 
    } else {
        ?>

		<div class="um-profile-edit um-profile-headericon">

			<a href="#" class="um-profile-edit-a"><i class="um-faicon-cog"></i></a>

			<?php 
        $items = array('editprofile' => '<a href="' . um_edit_profile_url() . '" class="real_url">' . __('Edit Profile', 'ultimatemember') . '</a>', 'myaccount' => '<a href="' . um_get_core_page('account') . '" class="real_url">' . __('My Account', 'ultimatemember') . '</a>', 'logout' => '<a href="' . um_get_core_page('logout') . '" class="real_url">' . __('Logout', 'ultimatemember') . '</a>', 'cancel' => '<a href="#" class="um-dropdown-hide">' . __('Cancel', 'ultimatemember') . '</a>');
        $cancel = $items['cancel'];
        if (!um_is_myprofile()) {
            $actions = $ultimatemember->user->get_admin_actions();
            unset($items['myaccount']);
            unset($items['logout']);
            unset($items['cancel']);
            if (is_array($actions)) {
                $items = array_merge($items, $actions);
            }
            $items = apply_filters('um_profile_edit_menu_items', $items, um_profile_id());
            $items['cancel'] = $cancel;
        } else {
            $items = apply_filters('um_myprofile_edit_menu_items', $items);
        }
        echo $ultimatemember->menu->new_ui($args['header_menu'], 'div.um-profile-edit', 'click', $items);
        ?>

		</div>

		<?php 
    }
}
function um_add_submit_button_to_register($args)
{
    global $ultimatemember;
    // DO NOT add when reviewing user's details
    if (isset($ultimatemember->user->preview) && $ultimatemember->user->preview == true && is_admin()) {
        return;
    }
    $primary_btn_word = $args['primary_btn_word'];
    $primary_btn_word = apply_filters('um_register_form_button_one', $primary_btn_word);
    $secondary_btn_word = $args['secondary_btn_word'];
    $secondary_btn_word = apply_filters('um_register_form_button_two', $secondary_btn_word);
    $secondary_btn_url = isset($args['secondary_btn_url']) && $args['secondary_btn_url'] ? $args['secondary_btn_url'] : um_get_core_page('login');
    $secondary_btn_url = apply_filters('um_register_form_button_two_url', $secondary_btn_url);
    ?>
		
		<div class="um-col-alt">
		
			<?php 
    if (isset($args['secondary_btn']) && $args['secondary_btn'] != 0) {
        ?>
			
			<div class="um-left um-half"><input type="submit" value="<?php 
        echo $primary_btn_word;
        ?>
" class="um-button" /></div>
			<div class="um-right um-half"><a href="<?php 
        echo $secondary_btn_url;
        ?>
" class="um-button um-alt"><?php 
        echo $secondary_btn_word;
        ?>
</a></div>
			
			<?php 
    } else {
        ?>
			
			<div class="um-center"><input type="submit" value="<?php 
        echo $primary_btn_word;
        ?>
" class="um-button" /></div>
			
			<?php 
    }
    ?>
			
			<div class="um-clear"></div>
			
		</div>
	
		<?php 
}
Example #23
0
    function content()
    {
        global $wpdb, $ultimatemember;
        if (!class_exists('Browser')) {
            require_once um_path . 'core/lib/browser.php';
        }
        // Detect browser
        $browser = new Browser();
        // Get theme info
        $theme_data = wp_get_theme();
        $theme = $theme_data->Name . ' ' . $theme_data->Version;
        // Identify Hosting Provider
        $host = um_get_host();
        ?>
		
		<div class="wrap">
		
			<h2>Ultimate Member</h2>
			
			<h3><?php 
        echo $this->addon[0];
        ?>
</h3>
			
			<?php 
        if (isset($this->content)) {
            echo $this->content;
        } else {
            ?>

		<form action="<?php 
            echo esc_url(admin_url('admin.php?page=um_system_info'));
            ?>
" method="post" dir="ltr">
			<textarea style="width:100%; height:400px;" readonly="readonly" onclick="this.focus();this.select()" id="system-info-textarea" name="um-sysinfo" title="<?php 
            _e('To copy the system info, click below then press Ctrl + C (PC) or Cmd + C (Mac).', 'edd');
            ?>
">
### Begin System Info ###

## Please include this information when posting support requests ##

<?php 
            do_action('um_system_info_before');
            ?>

--- Site Info ---

Site URL:						<?php 
            echo site_url() . "\n";
            ?>
Home URL:					<?php 
            echo home_url() . "\n";
            ?>
Multisite:					<?php 
            echo is_multisite() ? 'Yes' . "\n" : 'No' . "\n";
            ?>

--- Hosting Provider ---

<?php 
            if ($host) {
                ?>
Host:						<?php 
                echo $host . "\n";
            }
            ?>

--- User Browser ---

<?php 
            echo $browser;
            ?>

--- WordPress Configurations ---

Version:						<?php 
            echo get_bloginfo('version') . "\n";
            ?>
Language:					<?php 
            echo get_locale() . "\n";
            ?>
Permalink Structure:			<?php 
            echo get_option('permalink_structure') . "\n";
            ?>
Active Theme:				<?php 
            echo $theme . "\n";
            $show_on_front = get_option('show_on_front');
            if ($show_on_front == "posts") {
                ?>
Show On Front:				<?php 
                echo get_option('show_on_front') . "/static\n";
            } elseif ($show_on_front == "page") {
                ?>
Page On Front:				<?php 
                $id = get_option('page_on_front');
                echo get_the_title($id) . ' (#' . $id . ')' . "\n";
                ?>
Page For Posts:				<?php 
                $id = get_option('page_for_posts');
                echo get_the_title($id) . ' (#' . $id . ')' . "\n";
            }
            ?>
ABSPATH:					<?php 
            echo ABSPATH . "\n";
            $wp_count_posts = wp_count_posts();
            ?>
All Posts/Pages:				<?php 
            echo array_sum((array) $wp_count_posts) . "\n";
            $request['cmd'] = '_notify-validate';
            $params = array('sslverify' => false, 'timeout' => 60, 'user-agent' => 'UltimateMember/' . ultimatemember_version, 'body' => $request);
            $response = wp_remote_post('https://www.paypal.com/cgi-bin/webscr', $params);
            if (!is_wp_error($response) && $response['response']['code'] >= 200 && $response['response']['code'] < 300) {
                $WP_REMOTE_POST = 'wp_remote_post() works' . "\n";
            } else {
                $WP_REMOTE_POST = 'wp_remote_post() does not work' . "\n";
            }
            ?>
WP Remote Post:           		<?php 
            echo $WP_REMOTE_POST;
            ?>
WP_DEBUG:                 			<?php 
            echo defined('WP_DEBUG') ? WP_DEBUG ? 'Enabled' . "\n" : 'Disabled' . "\n" : 'Not set' . "\n";
            ?>
WP Table Prefix:          			<?php 
            echo "Length: " . strlen($wpdb->prefix);
            echo ", Status:";
            if (strlen($wpdb->prefix) > 16) {
                echo " ERROR: Too Long";
            } else {
                echo " Acceptable";
            }
            echo "\n";
            ?>
Memory Limit:   				<?php 
            echo um_let_to_num(WP_MEMORY_LIMIT) / 1024 . "MB";
            echo "\n";
            ?>

--- UM Configurations ---

Version:						<?php 
            echo ultimatemember_version . "\n";
            ?>
Upgraded From:            		<?php 
            echo get_option('um_version_upgraded_from', 'None') . "\n";
            ?>
Current URL Method:			<?php 
            echo um_get_option('current_url_method') . "\n";
            ?>
Cache User Profile:			<?php 
            if (um_get_option('um_profile_object_cache_stop') == 1) {
                echo "No";
            } else {
                echo "Yes";
            }
            echo "\n";
            ?>
Rewrite Rules: 				<?php 
            if (um_get_option('um_flush_stop') == 1) {
                echo "No";
            } else {
                echo "Yes";
            }
            echo "\n";
            ?>
Force UTF-8 Encoding: 		<?php 
            if (um_get_option('um_force_utf8_strings') == 1) {
                echo "Yes";
            } else {
                echo "No";
            }
            echo "\n";
            ?>
Time Check Security: 			<?php 
            if (um_get_option('enable_timebot') == 1) {
                echo "Yes";
            } else {
                echo "No";
            }
            echo "\n";
            ?>
JS/CSS Compression: 			<?php 
            if (um_get_option('disable_minify') == 0) {
                echo "Yes";
            } else {
                echo "No";
            }
            echo "\n";
            if (is_multisite()) {
                ?>
Network Structure:			<?php 
                echo um_get_option('network_permalink_structure') . "\n";
            }
            ?>
Nav Menu Settings: 			<?php 
            if (um_get_option('disable_menu') == 0) {
                echo "Yes";
            } else {
                echo "No";
            }
            echo "\n";
            ?>
Port Forwarding in URL: 		<?php 
            if (um_get_option('um_port_forwarding_url') == 1) {
                echo "Yes";
            } else {
                echo "No";
            }
            echo "\n";
            ?>
Exclude CSS/JS on Home: 		<?php 
            if (um_get_option('js_css_exlcude_home') == 1) {
                echo "Yes";
            } else {
                echo "No";
            }
            echo "\n";
            ?>

--- UM Pages Configuration ---

<?php 
            do_action("um_system_info_before_page_config");
            ?>
User:						<?php 
            echo get_permalink(um_get_option('core_user')) . "\n";
            ?>
Account:						<?php 
            echo get_permalink(um_get_option('core_account')) . "\n";
            ?>
Members:					<?php 
            echo get_permalink(um_get_option('core_members')) . "\n";
            ?>
Register:						<?php 
            echo get_permalink(um_get_option('core_register')) . "\n";
            ?>
Login:						<?php 
            echo get_permalink(um_get_option('core_login')) . "\n";
            ?>
Logout:						<?php 
            echo get_permalink(um_get_option('core_logout')) . "\n";
            ?>
Password Reset:				<?php 
            echo get_permalink(um_get_option('core_password-reset')) . "\n";
            do_action("um_system_info_after_page_config");
            ?>

-- UM Users Configuration ---

Default New User Role: 		<?php 
            echo um_get_option('default_role') . "\n";
            ?>
Profile Permalink Base:		<?php 
            echo um_get_option('permalink_base') . "\n";
            ?>
User Display Name:			<?php 
            echo um_get_option('display_name') . "\n";
            ?>
Force Name to Uppercase:		<?php 
            echo $this->value(um_get_option('force_display_name_capitlized'), 'yesno', true);
            ?>
Redirect author to profile: 		<?php 
            echo $this->value(um_get_option('author_redirect'), 'yesno', true);
            ?>
Enable Members Directory:	<?php 
            echo $this->value(um_get_option('members_page'), 'yesno', true);
            ?>
Use Gravatars: 				<?php 
            echo $this->value(um_get_option('use_gravatars'), 'yesno', true);
            if (um_get_option('use_gravatars')) {
                ?>
Gravatar builtin image:		<?php 
                echo um_get_option('use_um_gravatar_default_builtin_image') . "\n";
                ?>
UM Avatar as blank Gravatar: 	<?php 
                echo $this->value(um_get_option('use_um_gravatar_default_image'), 'yesno', true);
            }
            ?>
Require a strong password: 	<?php 
            echo $this->value(um_get_option('reset_require_strongpass'), 'onoff', true);
            ?>
Editable primary email field in profile view:	<?php 
            echo $this->value(um_get_option('editable_primary_email_in_profile'), 'onoff', true);
            ?>
  

-- UM Access Configuration ---

Panic Key: 								<?php 
            echo um_get_option('panic_key') . "\n";
            ?>
Global Site Access:						<?php 
            $arr = array('Site accessible to Everyone', '', 'Site accessible to Logged In Users');
            echo $arr[intval(um_get_option('accessible'))] . "\n";
            if (um_get_option('accessible') == 2) {
                ?>
Custom Redirect URL:						<?php 
                echo um_get_option('access_redirect') . "\n";
                ?>
Exclude the following URLs:<?php 
                echo "\t\t\t\t" . implode("\t\n\t\t\t\t\t\t\t\t\t\t", um_get_option('access_exclude_uris')) . "\n";
            }
            ?>
Backend Login Screen for Guests:			<?php 
            echo $this->value(um_get_option('wpadmin_login'), 'yesno', true);
            if (!um_get_option('wpadmin_login')) {
                ?>
Redirect to alternative login page:			<?php 
                if (um_get_option('wpadmin_login_redirect') == 'um_login_page') {
                    echo um_get_core_page('login') . "\n";
                } else {
                    echo um_get_option('wpadmin_login_redirect_url') . "\n";
                }
            }
            ?>
Backend Register Screen for Guests:		<?php 
            echo $this->value(um_get_option('wpadmin_register'), 'yesno', true);
            if (!um_get_option('wpadmin_register')) {
                ?>
Redirect to alternative register page:		<?php 
                if (um_get_option('wpadmin_register_redirect') == 'um_register_page') {
                    echo um_get_core_page('register') . "\n";
                } else {
                    echo um_get_option('wpadmin_register_redirect_url') . "\n";
                }
            }
            ?>
Access Control widget for Admins only: 		<?php 
            echo $this->value(um_get_option('access_widget_admin_only'), 'yesno', true);
            ?>
Enable the Reset Password Limit:			<?php 
            echo $this->value(um_get_option('enable_reset_password_limit'), 'yesno', true);
            if (um_get_option('enable_reset_password_limit')) {
                echo "Reset Password Limit:\t\t\t\t\t\t" . um_get_option('reset_password_limit_number') . "\n";
                echo "Disable Reset Password Limit for Admins:\t" . $this->value(um_get_option('disable_admin_reset_password_limit'), 'yesno', true);
            }
            if (!empty(um_get_option('wpadmin_allow_ips'))) {
                ?>
Whitelisted Backend IPs: 					<?php 
                echo count(explode("\n", trim(um_get_option('wpadmin_allow_ips')))) . "\n";
            }
            if (!empty(um_get_option('blocked_ips'))) {
                ?>
Blocked IP Addresses: 					<?php 
                echo count(explode("\n", um_get_option('blocked_ips'))) . "\n";
            }
            if (!empty(um_get_option('blocked_emails'))) {
                ?>
Blocked Email Addresses: 					<?php 
                echo count(explode("\n", um_get_option('blocked_emails'))) . "\n";
            }
            if (!empty(um_get_option('blocked_words'))) {
                ?>
Blacklist Words: 							<?php 
                echo count(explode("\n", um_get_option('blocked_words'))) . "\n";
            }
            ?>


--- UM Email Configurations --

Mail appears from:			<?php 
            if (!empty(um_get_option('mail_from'))) {
                echo um_get_option('mail_from');
            } else {
                echo "-";
            }
            echo "\n";
            ?>
Mail appears from address:	<?php 
            if (!empty(um_get_option('mail_from_addr'))) {
                echo um_get_option('mail_from_addr');
            } else {
                echo "-";
            }
            echo "\n";
            ?>
Use HTML for E-mails:			<?php 
            echo $this->value(um_get_option('email_html'), 'yesno', true);
            ?>
Account Welcome Email:		<?php 
            echo $this->value(um_get_option('welcome_email_on'), 'yesno', true);
            ?>
Account Activation Email:		<?php 
            echo $this->value(um_get_option('checkmail_email_on'), 'yesno', true);
            ?>
Pending Review Email:		<?php 
            echo $this->value(um_get_option('pending_email_on'), 'yesno', true);
            ?>
Account Approved Email:		<?php 
            echo $this->value(um_get_option('approved_email_on'), 'yesno', true);
            ?>
Account Rejected Email:		<?php 
            echo $this->value(um_get_option('rejected_email_on'), 'yesno', true);
            ?>
Account Deactivated Email:	<?php 
            echo $this->value(um_get_option('inactive_email_on'), 'yesno', true);
            ?>
Account Deleted Email:		<?php 
            echo $this->value(um_get_option('deletion_email_on'), 'yesno', true);
            ?>
Password Reset Email:		<?php 
            echo $this->value(um_get_option('resetpw_email_on'), 'yesno', true);
            ?>
Password Changed Email:		<?php 
            echo $this->value(um_get_option('changedpw_email_on'), 'yesno', true);
            ?>


--- UM Total Users ---

<?php 
            $result = count_users();
            echo 'All Users(' . $result['total_users'] . ")\n";
            foreach ($result['avail_roles'] as $role => $count) {
                echo $role . "(" . $count . ")\n";
            }
            ?>


--- UM Roles ---

<?php 
            foreach ($ultimatemember->query->get_roles() as $role_id => $role) {
                echo $role . " ({$role_id})\n";
            }
            ?>


--- UM Custom Templates ---

<?php 
            // Show templates that have been copied to the theme's edd_templates dir
            $dir = get_stylesheet_directory() . '/ultimate-member/templates/*.php';
            if (!empty($dir)) {
                $found = glob($dir);
                if (!empty($found)) {
                    foreach (glob($dir) as $file) {
                        echo "File: " . $file . "\n";
                    }
                } else {
                    echo 'N/A' . "\n";
                }
            }
            echo "\n\n";
            $dir = get_stylesheet_directory() . '/ultimate-member/templates/emails/*.html';
            echo "-- UM Email HTML Templates -- \n\n";
            if (!empty($dir)) {
                $found = glob($dir);
                if (!empty($found)) {
                    foreach (glob($dir) as $file) {
                        echo "File: " . $file . "\n";
                    }
                } else {
                    echo 'N/A' . "\n";
                }
            }
            ?>

--- Web Server Configurations ---

PHP Version:              			<?php 
            echo PHP_VERSION . "\n";
            ?>
MySQL Version:            		<?php 
            echo $wpdb->db_version() . "\n";
            ?>
Web Server Info:          			<?php 
            echo $_SERVER['SERVER_SOFTWARE'] . "\n";
            ?>

--- PHP Configurations --

PHP Safe Mode:            		<?php 
            echo $this->value(ini_get('safe_mode'), 'yesno', true);
            ?>
PHP Memory Limit:         		<?php 
            echo ini_get('memory_limit') . "\n";
            ?>
PHP Upload Max Size:      		<?php 
            echo ini_get('upload_max_filesize') . "\n";
            ?>
PHP Post Max Size:        		<?php 
            echo ini_get('post_max_size') . "\n";
            ?>
PHP Upload Max Filesize:  		<?php 
            echo ini_get('upload_max_filesize') . "\n";
            ?>
PHP Time Limit:           			<?php 
            echo ini_get('max_execution_time') . "\n";
            ?>
PHP Max Input Vars:       		<?php 
            echo ini_get('max_input_vars') . "\n";
            ?>
PHP Arg Separator:        		<?php 
            echo ini_get('arg_separator.output') . "\n";
            ?>
PHP Allow URL File Open:  		<?php 
            echo ini_get('allow_url_fopen') ? "Yes\n" : "No\n";
            ?>


--- Web Server Extensions/Modules ---

DISPLAY ERRORS:           		<?php 
            echo ini_get('display_errors') ? 'On (' . ini_get('display_errors') . ')' : 'N/A';
            echo "\n";
            ?>
FSOCKOPEN:                			<?php 
            echo function_exists('fsockopen') ? 'Your server supports fsockopen.' : 'Your server does not support fsockopen.';
            echo "\n";
            ?>
cURL:                     				<?php 
            echo function_exists('curl_init') ? 'Your server supports cURL.' : 'Your server does not support cURL.';
            echo "\n";
            ?>
SOAP Client:              			<?php 
            echo class_exists('SoapClient') ? 'Your server has the SOAP Client enabled.' : 'Your server does not have the SOAP Client enabled.';
            echo "\n";
            ?>
SUHOSIN:                  			<?php 
            echo extension_loaded('suhosin') ? 'Your server has SUHOSIN installed.' : 'Your server does not have SUHOSIN installed.';
            echo "\n";
            ?>


--- Session Configurations ---

Session:                  			<?php 
            echo isset($_SESSION) ? 'Enabled' : 'Disabled';
            echo "\n";
            ?>
Session Name:             			<?php 
            echo esc_html(ini_get('session.name'));
            echo "\n";
            ?>
Cookie Path:              			<?php 
            echo esc_html(ini_get('session.cookie_path'));
            echo "\n";
            ?>
Save Path:                			<?php 
            echo esc_html(ini_get('session.save_path'));
            echo "\n";
            ?>
Use Cookies:              			<?php 
            echo ini_get('session.use_cookies') ? 'On' : 'Off';
            echo "\n";
            ?>
Use Only Cookies:         		<?php 
            echo ini_get('session.use_only_cookies') ? 'On' : 'Off';
            echo "\n";
            ?>



--- WordPress Active Plugins ---

<?php 
            $plugins = get_plugins();
            $active_plugins = get_option('active_plugins', array());
            foreach ($plugins as $plugin_path => $plugin) {
                // If the plugin isn't active, don't show it.
                if (!in_array($plugin_path, $active_plugins)) {
                    continue;
                }
                echo $plugin['Name'] . ': ' . $plugin['Version'] . "\n";
            }
            if (is_multisite()) {
                ?>

--- WordPress Network Active Plugins ---

<?php 
                $plugins = wp_get_active_network_plugins();
                $active_plugins = get_site_option('active_sitewide_plugins', array());
                foreach ($plugins as $plugin_path) {
                    $plugin_base = plugin_basename($plugin_path);
                    // If the plugin isn't active, don't show it.
                    if (!array_key_exists($plugin_base, $active_plugins)) {
                        continue;
                    }
                    $plugin = get_plugin_data($plugin_path);
                    echo $plugin['Name'] . ' :' . $plugin['Version'] . "\n";
                }
            }
            do_action('um_system_info_after');
            ?>




### End System Info ###</textarea>
			<p class="submit">
				<input type="hidden" name="um-addon-hook" value="download_system_info" />
				<?php 
            submit_button('Download System Info File', 'primary', 'download_system_info', false);
            ?>
			</p>
		</form>		
		
		<?php 
        }
        ?>

		<?php 
    }