diff --git a/admin/assets/css/um-admin-dashboard.css b/admin/assets/css/um-admin-dashboard.css index 1f0e84d2..732c53bb 100644 --- a/admin/assets/css/um-admin-dashboard.css +++ b/admin/assets/css/um-admin-dashboard.css @@ -129,7 +129,7 @@ */ .um-admin-dash-count { - background: #7ACE5A; + background: #7ACF58; color: #fff; padding: 2px 6px; border-radius: 3px; diff --git a/admin/core/um-admin-actions-modal.php b/admin/core/um-admin-actions-modal.php index c191e44a..21eb273b 100644 --- a/admin/core/um-admin-actions-modal.php +++ b/admin/core/um-admin-actions-modal.php @@ -92,7 +92,7 @@ $metabox = new UM_Admin_Metabox(); - if ( !is_user_logged_in() || !current_user_can('manage_options') ) die('Please login as administrator'); + if ( !is_user_logged_in() || !current_user_can('manage_options') ) die( __('Please login as administrator','ultimatemember') ); extract($_POST); @@ -138,7 +138,7 @@ ?> -

+

-

+

builtin->predefined_fields ) { foreach ($ultimatemember->builtin->predefined_fields as $field_key => $array) { - if ( !isset( $array['account_only'] ) ) { + if ( !isset( $array['account_only'] ) && !isset( $array['private_use'] ) ) { ?> - ' . __('None') . '

'; } ?> + ' . __('None','ultimatemember') . '

'; } ?>
-

+

fields->set_mode = 'account'; @@ -71,12 +71,12 @@ class UM_Account { if ( get_option('permalink_structure') ) { - $url = trailingslashit( untrailingslashit( um_account_page_url() ) ); + $url = trailingslashit( untrailingslashit( um_get_core_page('account') ) ); $url = $url . $id . '/'; } else { - $url = add_query_arg( 'um_tab', $id, um_account_page_url() ); + $url = add_query_arg( 'um_tab', $id, um_get_core_page('account') ); } diff --git a/core/um-actions-account.php b/core/um-actions-account.php index e6f3e3de..70e6dcc9 100644 --- a/core/um-actions-account.php +++ b/core/um-actions-account.php @@ -33,7 +33,7 @@ } } - exit( wp_redirect( um_account_page_url() ) ); + exit( wp_redirect( um_get_core_page('account') ) ); } diff --git a/core/um-actions-login.php b/core/um-actions-login.php index 8a1b2286..46b1bba5 100644 --- a/core/um-actions-login.php +++ b/core/um-actions-login.php @@ -65,7 +65,7 @@ function um_after_login_submit(){ ?>
- +
' . $msg . '

'; + + } + + } \ No newline at end of file diff --git a/core/um-actions-password.php b/core/um-actions-password.php new file mode 100644 index 00000000..7426b2c9 --- /dev/null +++ b/core/um-actions-password.php @@ -0,0 +1,210 @@ +user_email; + } else { + $data = get_user_by( 'email', $user ); + $user_email = $user; + } + + $ultimatemember->password->reset_request['user_id'] = $data->ID; + $ultimatemember->password->reset_request['user_email'] = $user_email; + + um_fetch_user( $data->ID ); + + $ultimatemember->user->password_reset(); + + um_reset_user(); + + } + + /*** + *** @process a change request + ***/ + add_action('um_change_password_process_hook','um_change_password_process_hook'); + 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'); + + if ( is_user_logged_in() ) { + wp_logout(); + } + + exit( wp_redirect( um_get_core_page('login', 'password_changed') ) ); + + } + + /*** + *** @Error handler: reset password + ***/ + add_action('um_reset_password_errors_hook','um_reset_password_errors_hook'); + function um_reset_password_errors_hook( $args ) { + global $ultimatemember; + + if ( $_POST[ $ultimatemember->honeypot ] != '' ) + wp_die('Hello, spam bot!'); + + $form_timestamp = trim($_POST['timestamp']); + $live_timestamp = time(); + + if ( $form_timestamp == '' ) + wp_die( __('Hello, spam bot!') ); + + if ( $live_timestamp - $form_timestamp < 3 ) + wp_die( __('Whoa, slow down! You\'re seeing this message because you tried to submit a form too fast and we think you might be a spam bot. If you are a real human being please wait a few seconds before submitting the form. Thanks!') ); + + if ( strlen(trim( $_POST['username_b'] ) ) == 0 ) { + $ultimatemember->form->add_error('username_b', __('Please provide your username or email','ultimatemember') ); + } + + $user = $_POST['username_b']; + + if ( ( !is_email( $user ) && !username_exists( $user ) ) || ( is_email( $user ) && !email_exists( $user ) ) ) { + $ultimatemember->form->add_error('username_b', __(' We can\'t find an account registered with that address or username ','ultimatemember') ); + } + + } + + /*** + *** @Error handler: changing password + ***/ + add_action('um_change_password_errors_hook','um_change_password_errors_hook'); + function um_change_password_errors_hook( $args ) { + global $ultimatemember; + + if ( $_POST[ $ultimatemember->honeypot ] != '' ) + wp_die('Hello, spam bot!'); + + $form_timestamp = trim($_POST['timestamp']); + $live_timestamp = time(); + + if ( $form_timestamp == '' ) + wp_die( __('Hello, spam bot!') ); + + if ( $live_timestamp - $form_timestamp < 3 ) + wp_die( __('Whoa, slow down! You\'re seeing this message because you tried to submit a form too fast and we think you might be a spam bot. If you are a real human being please wait a few seconds before submitting the form. Thanks!') ); + + if ( !$args['user_password'] ) { + $ultimatemember->form->add_error('user_password', 'You must enter a new password'); + } + + if ( strlen( utf8_decode( $args['user_password'] ) ) < 8 ) { + $ultimatemember->form->add_error('user_password', __('Your password must contain at least 8 characters') ); + } + + if ( strlen( utf8_decode( $args['user_password'] ) ) > 30 ) { + $ultimatemember->form->add_error('user_password', __('Your password must contain less than 30 characters') ); + } + + if ( !$ultimatemember->validation->strong_pass( $args['user_password'] ) ) { + $ultimatemember->form->add_error('user_password', 'Your password must contain at least one capital letter and one number'); + } + + if ( !$args['confirm_user_password'] ) { + $ultimatemember->form->add_error('confirm_user_password', 'You must confirm your new password'); + } + + if ( $args['user_password'] != $args['confirm_user_password'] ) { + $ultimatemember->form->add_error('confirm_user_password', 'Your passwords do not match'); + } + + } + + /*** + *** @hidden fields + ***/ + add_action('um_change_password_page_hidden_fields','um_change_password_page_hidden_fields'); + function um_change_password_page_hidden_fields( $args ) { + + ?> + + + + + + + + + + builtin->get_specific_fields('password_reset_text,username_b'); ?> + + $data ) { + $output .= $ultimatemember->fields->edit_field( $key, $data ); + }echo $output; ?> + +
+ +
+ +
+ +
+ + builtin->get_specific_fields('user_password'); ?> + + $data ) { + $output .= $ultimatemember->fields->edit_field( $key, $data ); + }echo $output; ?> + +
+ +
+ +
+ +
+ + array( - 'name' => 'Text Block', + 'name' => 'Content Block', 'col1' => array('_title'), 'col2' => array('_public','_roles'), 'col_full' => array('_content'), @@ -700,6 +700,28 @@ class UM_Builtin { 'icon' => 'um-icon-device-mobile', ), + // for use in password reset page + + 'password_reset_text' => array( + 'title' => 'Password Reset', + 'type' => 'block', + 'content' => '
To reset your password, please enter your email address or username below
', + 'private_use' => true, + ), + + 'username_b' => array( + 'title' => 'Username or E-mail', + 'metakey' => 'username_b', + 'type' => 'text', + 'placeholder' => __('Enter your username or email','ultimatemember'), + 'required' => 1, + 'public' => 1, + 'editable' => 0, + 'private_use' => true, + ), + + // for use in account page + 'profile_privacy' => array( 'title' => 'Profile Privacy', 'metakey' => 'profile_privacy', diff --git a/core/um-fields.php b/core/um-fields.php index 5e9af37e..05543498 100644 --- a/core/um-fields.php +++ b/core/um-fields.php @@ -290,7 +290,7 @@ class UM_Fields { // normal state if ( isset($ultimatemember->form->post_form[$key]) ) { - if ( strstr( $key, 'user_pass' ) ) return ''; + if ( strstr( $key, 'user_pass' ) && $this->set_mode != 'password' ) return ''; return $ultimatemember->form->post_form[$key]; @@ -735,7 +735,7 @@ class UM_Fields { } else { - if ( $this->set_mode == 'account' && um_is_account_page() ) { + if ( $this->set_mode == 'account' && um_is_core_page('account') ) { $key = 'current_' . $original_key; $output .= '
'; @@ -768,10 +768,14 @@ class UM_Fields { $output .= '
'; - if ( $this->set_mode == 'account' && um_is_account_page() ) { + if ( $this->set_mode == 'account' && um_is_core_page('account') || $this->set_mode == 'password' && um_is_core_page('password-reset') ) { + $output .= $this->field_label( 'New Password', $key, $data); + } else if ( isset( $data['label'] ) ) { + $output .= $this->field_label($label, $key, $data); + } $output .= '
'; diff --git a/core/um-filters-profile.php b/core/um-filters-profile.php index d26a0281..44f2237c 100644 --- a/core/um-filters-profile.php +++ b/core/um-filters-profile.php @@ -9,7 +9,7 @@ $profile_title = um_get_option('profile_title'); - if ( um_is_user_page_uri() && um_get_requested_user() ) { + if ( um_is_core_page('user') && um_get_requested_user() ) { um_fetch_user( um_get_requested_user() ); @@ -35,9 +35,9 @@ return $title; if ( $id == $ultimatemember->permalinks->core['user'] ) { - if ( um_is_user_page_uri() && um_get_requested_user() ) { + if ( um_is_core_page('user') && um_get_requested_user() ) { $title = um_get_display_name( um_get_requested_user() ); - } else if ( um_is_user_page_uri() && is_user_logged_in() ) { + } else if ( um_is_core_page('user') && is_user_logged_in() ) { $title = um_get_display_name( get_current_user_id() ); } } diff --git a/core/um-form.php b/core/um-form.php index 131a00d1..c2a49308 100644 --- a/core/um-form.php +++ b/core/um-form.php @@ -67,8 +67,7 @@ class UM_Form { $this->post_form['submitted'] = $this->post_form; $this->post_form = array_merge( $this->form_data, $this->post_form ); - - /* + if ( $_POST[ $ultimatemember->honeypot ] != '' ) wp_die('Hello, spam bot!'); @@ -81,10 +80,9 @@ class UM_Form { wp_die( __('Hello, spam bot!') ); if ( $live_timestamp - $form_timestamp < 5 ) - wp_die( __('Whoa, slow down! You’re seeing this message because you tried to submit a form too fast and we think you might be a spam bot. If you are a real human being please wait a few seconds before submitting the form. Thanks!') ); + wp_die( __('Whoa, slow down! You\'re seeing this message because you tried to submit a form too fast and we think you might be a spam bot. If you are a real human being please wait a few seconds before submitting the form. Thanks!') ); } - */ /* Continue based on form mode - pre-validation */ diff --git a/core/um-logout.php b/core/um-logout.php index 0f7cb18c..5720d5cc 100644 --- a/core/um-logout.php +++ b/core/um-logout.php @@ -12,7 +12,8 @@ class UM_Logout { *** @Logout via logout page ***/ function logout_page() { - if ( um_is_logout_page() ) { + + if ( um_is_core_page('logout') ) { if ( is_user_logged_in() ) { @@ -32,6 +33,7 @@ class UM_Logout { } } + } } \ No newline at end of file diff --git a/core/um-mail.php b/core/um-mail.php index 1bf3b342..43d3db8d 100644 --- a/core/um-mail.php +++ b/core/um-mail.php @@ -38,6 +38,7 @@ class UM_Mail { '{display_name}', '{site_name}', '{account_activation_link}', + '{password_reset_link}', '{admin_email}', '{user_profile_link}', ); @@ -48,6 +49,7 @@ class UM_Mail { um_user('display_name'), um_get_option('site_name'), um_user('account_activation_link'), + um_user('password_reset_link'), um_admin_email(), um_user_profile_url(), ); diff --git a/core/um-password.php b/core/um-password.php new file mode 100644 index 00000000..9b18c20c --- /dev/null +++ b/core/um-password.php @@ -0,0 +1,225 @@ +user->profile['reset_pass_hash_token'] = time(); + $ultimatemember->user->update_usermeta_info('reset_pass_hash_token'); + + $this->change_password = true; + + um_reset_user(); + + } + + } + + /*** + *** @reset url + ***/ + function reset_url(){ + global $ultimatemember; + + if ( !um_user('reset_pass_hash') ) return false; + + $url = add_query_arg( 'act', 'reset_password', um_get_core_page('password-reset') ); + $url = add_query_arg( 'hash', um_user('reset_pass_hash'), $url ); + $url = add_query_arg( 'user_id', um_user('ID'), $url ); + + return $url; + + } + + /*** + *** @we are on password reset page + ***/ + function password_reset(){ + global $ultimatemember; + + if ( um_is_core_page('password-reset') ) { + + $ultimatemember->fields->set_mode = 'password'; + + } + + } + + /*** + *** @password page form + ***/ + function form_init() { + global $ultimatemember; + + if ( um_requesting_password_reset() ) { + + $ultimatemember->form->post_form = $_POST; + + do_action('um_reset_password_errors_hook', $ultimatemember->form->post_form ); + + if ( !isset($ultimatemember->form->errors) ) { + + do_action('um_reset_password_process_hook', $ultimatemember->form->post_form ); + + } + + } + + if ( um_requesting_password_change() ) { + + $ultimatemember->form->post_form = $_POST; + + do_action('um_change_password_errors_hook', $ultimatemember->form->post_form ); + + if ( !isset($ultimatemember->form->errors) ) { + + do_action('um_change_password_process_hook', $ultimatemember->form->post_form ); + + } + + } + + } + + /*** + *** @Add class based on shortcode + ***/ + function get_class( $mode ){ + + global $ultimatemember; + + $classes = 'um-'.$mode; + + if ( is_admin() ) { + $classes .= ' um-in-admin'; + } + + if ( $ultimatemember->fields->editing == true ) { + $classes .= ' um-editing'; + } + + if ( $ultimatemember->fields->viewing == true ) { + $classes .= ' um-viewing'; + } + + $classes = apply_filters('um_form_official_classes__hook', $classes); + return $classes; + } + + /*** + *** @Shortcode + ***/ + function ultimatemember_password( $args = array() ) { + return $this->load( $args ); + } + + /*** + *** @Load a module with global function + ***/ + function load( $args ) { + + global $ultimatemember; + + ob_start(); + + $defaults = array( + 'template' => 'password-reset', + 'mode' => 'password', + 'form_id' => 'um_password_id', + 'max_width' => '450px', + 'align' => 'center', + ); + $args = wp_parse_args( $args, $defaults ); + + if ( isset( $args['use_globals'] ) && $args['use_globals'] == 1 ) { + $args = array_merge( $args, $this->get_css_args( $args ) ); + } else { + $args = array_merge( $this->get_css_args( $args ), $args ); + } + + $args = apply_filters('um_reset_password_shortcode_args_filter', $args); + + if ( isset( $this->change_password ) ) { + + $args['user_id'] = $_REQUEST['user_id']; + $args['template'] = 'password-change'; + + } + + extract( $args, EXTR_SKIP ); + + do_action("um_pre_{$mode}_shortcode", $args); + + do_action("um_before_form_is_loaded", $args); + + do_action("um_before_{$mode}_form_is_loaded", $args); + + do_action("um_before_{$template}_form_is_loaded", $args); + + $this->template_load( $template, $args ); + + if ( !is_admin() && !defined( 'DOING_AJAX' ) ) { + $this->dynamic_css( $args ); + } + + $output = ob_get_contents(); + ob_end_clean(); + return $output; + + } + + /*** + *** @Get dynamic css args + ***/ + function get_css_args( $args ) { + $arr = um_styling_defaults( $args['mode'] ); + $arr = array_merge( $arr, array( 'form_id' => $args['form_id'], 'mode' => $args['mode'] ) ); + return $arr; + } + + /*** + *** @Load dynamic css + ***/ + function dynamic_css( $args=array() ) { + extract($args); + $global = um_path . 'assets/dynamic_css/dynamic_global.php'; + $file = um_path . 'assets/dynamic_css/dynamic_'.$mode.'.php'; + include $global; + if ( file_exists( $file ) ) + include $file; + } + + /*** + *** @Loads a template file + ***/ + function template_load( $template, $args=array() ) { + global $ultimatemember; + extract($args); + $file = um_path . 'templates/'. $template . '.php'; + if ( file_exists( $file ) ) include $file; + } +} \ No newline at end of file diff --git a/core/um-permalinks.php b/core/um-permalinks.php index 79eca569..742cc8bb 100644 --- a/core/um-permalinks.php +++ b/core/um-permalinks.php @@ -70,6 +70,7 @@ class UM_Permalinks { $ultimatemember->user->approve(); um_reset_user(); + } } @@ -123,6 +124,7 @@ class UM_Permalinks { ***/ function profile_url() { global $ultimatemember; + $profile_url = $this->core['user']; $profile_url = get_permalink($profile_url); diff --git a/core/um-rewrite.php b/core/um-rewrite.php index 28cd2a4f..12a87f97 100644 --- a/core/um-rewrite.php +++ b/core/um-rewrite.php @@ -59,14 +59,14 @@ class UM_Rewrite { function locate_user_profile() { global $post, $ultimatemember; - if ( um_queried_user() && um_is_user_page_uri() ) { + if ( um_queried_user() && um_is_core_page('user') ) { if ( um_get_option('permalink_base') == 'user_login' ) { $user_id = username_exists( um_queried_user() ); if ( $user_id ) { um_set_requested_user( $user_id ); } else { - exit( wp_redirect( um_user_page_uri() ) ); + exit( wp_redirect( um_get_core_page('user') ) ); } } @@ -75,7 +75,7 @@ class UM_Rewrite { if ( $user_id ) { um_set_requested_user( $user_id ); } else { - exit( wp_redirect( um_user_page_uri() ) ); + exit( wp_redirect( um_get_core_page('user') ) ); } } @@ -84,7 +84,7 @@ class UM_Rewrite { if ( $user_id ) { um_set_requested_user( $user_id ); } else { - exit( wp_redirect( um_user_page_uri() ) ); + exit( wp_redirect( um_get_core_page('user') ) ); } } diff --git a/core/um-short-functions.php b/core/um-short-functions.php index ebfda21a..d2e57c9d 100644 --- a/core/um-short-functions.php +++ b/core/um-short-functions.php @@ -3,13 +3,27 @@ /*** *** @Get core page url ***/ - function um_get_core_page( $slug ) { + function um_get_core_page( $slug, $updated = false) { global $ultimatemember; if ( $ultimatemember->permalinks->core[ $slug ] ) - return get_permalink( $ultimatemember->permalinks->core[ $slug ] ); + $url = get_permalink( $ultimatemember->permalinks->core[ $slug ] ); + if ( $updated ) { + $url = add_query_arg( 'updated', $updated, $url ); + } + return $url; return ''; } + /*** + *** @boolean check if we are on a core page or not + ***/ + function um_is_core_page( $page ) { + global $post, $ultimatemember; + if ( isset($post->ID) && $post->ID == $ultimatemember->permalinks->core[ $page ] ) + return true; + return false; + } + /*** *** @Check value of queried search in text input ***/ @@ -67,57 +81,35 @@ return ''; } + /*** + *** @check if a legitimate password reset request is in action + ***/ + function um_requesting_password_reset() { + global $post, $ultimatemember; + if ( um_is_core_page('password-reset') && isset( $_POST['_um_password_reset'] ) == 1 ) + return true; + return false; + } + + /*** + *** @check if a legitimate password change request is in action + ***/ + function um_requesting_password_change() { + global $post, $ultimatemember; + if ( um_is_core_page('password-reset') && isset( $_POST['_um_password_change'] ) == 1 ) + return true; + return false; + } + /*** *** @boolean for account page editing ***/ function um_submitting_account_page() { - if ( um_is_account_page() && isset($_POST['_um_account']) == 1 && is_user_logged_in() ) + if ( um_is_core_page('account') && isset($_POST['_um_account']) == 1 && is_user_logged_in() ) return true; return false; } - /*** - *** @if we're on account page - ***/ - function um_is_account_page() { - global $post, $ultimatemember; - if ( isset($post->ID) && $post->ID == $ultimatemember->permalinks->core['account'] ) - return true; - return false; - } - - /*** - *** @account page URI - ***/ - function um_account_page_url(){ - global $ultimatemember; - return get_permalink( $ultimatemember->permalinks->core['account'] ); - } - - /*** - *** @if we're on logout page - ***/ - function um_is_logout_page() { - global $post, $ultimatemember; - if ( isset($post->ID) && $post->ID == $ultimatemember->permalinks->core['logout'] ) - return true; - return false; - } - - /*** - *** @show logout page url - ***/ - function um_logout_page( $redirect_to = false ) { - global $ultimatemember; - if ( isset( $ultimatemember->permalinks->core['logout'] ) && is_user_logged_in() ) - $link = get_permalink( $ultimatemember->permalinks->core['logout'] ); - if ( $redirect_to ) { - $link = add_query_arg( 'redirect_to', $redirect_to, $link ); - } - return $link; - return false; - } - /*** *** @get a user's display name ***/ @@ -161,39 +153,10 @@ ***/ function um_is_my_profile() { if ( !is_user_logged_in() ) return false; - if ( um_is_user_page_uri() && get_current_user_id() == um_get_requested_user() ) return true; + if ( um_is_core_page('user') && get_current_user_id() == um_get_requested_user() ) return true; return false; } - /*** - *** @The UM's profile page URI - ***/ - function um_user_page_uri(){ - global $ultimatemember; - return get_permalink( $ultimatemember->permalinks->core['user'] ); - } - - /*** - *** @checks whether we're on UM profile page - ***/ - function um_is_user_page_uri() { - global $post, $ultimatemember; - if ( isset($post->ID) && $post->ID == $ultimatemember->permalinks->core['user'] ) - return true; - return false; - } - - /*** - *** @user's profile ID - ***/ - function um_user_page_id() { - global $post, $ultimatemember; - if ( isset( $ultimatemember->permalinks->core['user'] ) ) { - return $ultimatemember->permalinks->core['user']; - } - return ''; - } - /*** *** @gets the queried user ***/ @@ -543,6 +506,10 @@ return $array; break; + case 'password_reset_link': + return $ultimatemember->password->reset_url(); + break; + case 'account_activation_link': return $ultimatemember->permalinks->activate_url(); break; diff --git a/core/um-user.php b/core/um-user.php index db5f1304..caaaa6bb 100644 --- a/core/um-user.php +++ b/core/um-user.php @@ -207,6 +207,17 @@ class UM_User { } + /*** + *** @Set user's hash for password reset + ***/ + function password_reset_hash(){ + global $ultimatemember; + + $this->profile['reset_pass_hash'] = $ultimatemember->validation->generate(30); + $this->update_usermeta_info('reset_pass_hash'); + + } + /*** *** @Set user's hash ***/ @@ -222,6 +233,15 @@ class UM_User { } + /*** + *** @password reset email + ***/ + function password_reset(){ + global $ultimatemember; + $this->password_reset_hash(); + $ultimatemember->mail->send( um_user('user_email'), 'resetpw_email' ); + } + /*** *** @approves a user ***/ diff --git a/templates/password-change.php b/templates/password-change.php new file mode 100644 index 00000000..0340dd79 --- /dev/null +++ b/templates/password-change.php @@ -0,0 +1,25 @@ +
+ +
+ +
+ + password->reset_request ) ) { + + do_action('um_change_password_page_hidden_fields', $args ); + + do_action('um_change_password_form', $args ); + + do_action("um_after_form_fields", $args); + + } + + ?> + +
+ +
+ +
\ No newline at end of file diff --git a/templates/password-reset.php b/templates/password-reset.php new file mode 100644 index 00000000..a4f4b24e --- /dev/null +++ b/templates/password-reset.php @@ -0,0 +1,35 @@ +
+ +
+ +
+ + password->reset_request ) ) { + + do_action('um_reset_password_page_hidden_fields', $args ); + + do_action('um_reset_password_form', $args ); + + do_action("um_after_form_fields", $args); + + } else { + + echo '
'; + + echo '

A password reset link has been sent to '. $ultimatemember->password->reset_request['user_email'] . ' for your '. um_get_option('site_name') . ' account.

'; + + echo '

Please check your inbox!

'; + + echo '
'; + + } + + ?> + +
+ +
+ +
\ No newline at end of file diff --git a/um-config.php b/um-config.php index fe237b5e..dddc11c3 100644 --- a/um-config.php +++ b/um-config.php @@ -54,7 +54,7 @@ $this->sections[] = array( 'title' => __( 'Profile Permalink Base' ), 'desc' => __( 'Here you can control the permalink structure of the user profile URL globally' ), 'default' => 'user_login', - 'desc' => 'e.g. ' . trailingslashit( um_user_page_uri() ) .'username/', + 'desc' => 'e.g. ' . trailingslashit( um_get_core_page('user') ) .'username/', 'options' => array( 'user_login' => 'Username', 'name' => 'First and Last Name', @@ -582,6 +582,38 @@ $this->sections[] = array( 'Thanks,' . "\r\n" . '{site_name}', ), + + array( + 'id' => 'resetpw_email_on', + 'type' => 'switch', + 'title' => __( 'Password Reset Email' ), + 'default' => 1, + 'desc' => 'Whether to send the user an email when he request to reset password (Recommended, please keep on)', + ), + + array( + 'id' => 'resetpw_email_sub', + 'type' => 'text', + 'title' => __( 'Password Reset Email' ), + 'subtitle' => __( 'Subject Line' ), + 'default' => 'Reset your password', + 'required' => array( 'resetpw_email_on', '=', 1 ), + 'desc' => 'This is the subject line of the e-mail', + ), + + array( + 'id' => 'resetpw_email', + 'type' => 'textarea', + 'title' => __( 'Password Reset Email' ), + 'subtitle' => __( 'Message Body' ), + '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:' . "\r\n\r\n" . + '{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}', + ), ) diff --git a/um-init.php b/um-init.php index 28e3c7c2..ad25f053 100644 --- a/um-init.php +++ b/um-init.php @@ -32,6 +32,7 @@ class UM_API { require_once um_path . 'core/um-enqueue.php'; require_once um_path . 'core/um-shortcodes.php'; require_once um_path . 'core/um-account.php'; + require_once um_path . 'core/um-password.php'; require_once um_path . 'core/um-fields.php'; require_once um_path . 'core/um-form.php'; require_once um_path . 'core/um-user.php'; @@ -58,12 +59,14 @@ class UM_API { require_once um_path . 'core/um-actions-register.php'; require_once um_path . 'core/um-actions-profile.php'; require_once um_path . 'core/um-actions-account.php'; + require_once um_path . 'core/um-actions-password.php'; require_once um_path . 'core/um-actions-members.php'; require_once um_path . 'core/um-actions-global.php'; require_once um_path . 'core/um-actions-tracking.php'; require_once um_path . 'core/um-actions-user.php'; require_once um_path . 'core/um-actions-save-profile.php'; require_once um_path . 'core/um-actions-modal.php'; + require_once um_path . 'core/um-actions-notices.php'; require_once um_path . 'core/um-filters-login.php'; require_once um_path . 'core/um-filters-register.php'; @@ -85,6 +88,7 @@ class UM_API { $this->styles = new UM_Enqueue(); $this->shortcodes = new UM_Shortcodes(); $this->account = new UM_Account(); + $this->password = new UM_Password(); $this->login = new UM_Login(); $this->register = new UM_Register(); $this->fields = new UM_Fields();