$v ) { if ( !strstr( $k, 'password' ) && !strstr( $k, 'um_account' ) ) { $changes[ $k ] = $v; } } if ( isset( $changes['hide_in_members'] ) && $changes['hide_in_members'] == 'No' ){ delete_user_meta( um_user('ID'), 'hide_in_members' ); unset( $changes['hide_in_members'] ); } $ultimatemember->user->update_profile( $changes ); // delete account if ( $_POST['single_user_password'] && isset($_POST['um_account_submit']) && $_POST['um_account_submit'] == __('Delete Account') ) { if ( current_user_can('delete_users') || um_user('can_delete_profile') ) { if ( !um_user('super_admin') ) { $ultimatemember->user->delete(); if ( um_user('after_delete') == 'redirect_home' ) { um_redirect_home(); } else { exit( wp_redirect( um_user('delete_redirect_url') ) ); } } } } exit( wp_redirect( um_get_core_page('account') ) ); } /*** *** @validate for errors in account page ***/ add_action('um_submit_account_errors_hook','um_submit_account_errors_hook'); function um_submit_account_errors_hook( $args ) { global $ultimatemember; if ( strlen(trim( $_POST['first_name'] ) ) == 0 ) { $ultimatemember->form->add_error('first_name', 'You must provide your first name'); } if ( strlen(trim( $_POST['last_name'] ) ) == 0 ) { $ultimatemember->form->add_error('last_name', 'You must provide your last name'); } if ( strlen(trim( $_POST['user_email'] ) ) == 0 ) { $ultimatemember->form->add_error('user_email', 'You must provide your e-mail'); } if ( !is_email( $_POST['user_email'] ) ) { $ultimatemember->form->add_error('user_email', 'Please provide a valid e-mail'); } $ultimatemember->account->current_tab = 'general'; if ( $_POST['current_user_password'] != '' ) { if ( !wp_check_password( $_POST['current_user_password'], um_user('user_pass'), um_user('ID') ) ) { $ultimatemember->form->add_error('current_user_password', 'This is not your password'); $ultimatemember->account->current_tab = 'password'; } else { // correct password if ( $_POST['user_password'] != $_POST['confirm_user_password'] && $_POST['user_password'] ) { $ultimatemember->form->add_error('user_password', 'Your new password does not match'); $ultimatemember->account->current_tab = 'password'; } if ( strlen( utf8_decode( $_POST['user_password'] ) ) < 8 ) { $ultimatemember->form->add_error('user_password', __('Your password must contain at least 8 characters') ); } if ( strlen( utf8_decode( $_POST['user_password'] ) ) > 30 ) { $ultimatemember->form->add_error('user_password', __('Your password must contain less than 30 characters') ); } if ( !$ultimatemember->validation->strong_pass( $_POST['user_password'] ) ) { $ultimatemember->form->add_error('user_password', 'Your password must contain at least one capital letter and one number'); $ultimatemember->account->current_tab = 'password'; } } } if ( isset($_POST['um_account_submit']) && $_POST['um_account_submit'] == __('Delete Account') ) { if ( strlen(trim( $_POST['single_user_password'] ) ) == 0 ) { $ultimatemember->form->add_error('single_user_password', 'You must enter your password'); } else { if ( !wp_check_password( $_POST['single_user_password'], um_user('user_pass'), um_user('ID') ) ) { $ultimatemember->form->add_error('single_user_password', 'This is not your password'); } } $ultimatemember->account->current_tab = 'delete'; } } /*** *** @hidden inputs for account page ***/ add_action('um_account_page_hidden_fields','um_account_page_hidden_fields'); function um_account_page_hidden_fields( $args ) { ?> account->get_tab_output('delete'); if ( $output ) { ?>