- optimized account page;

- optimized code of shortcodes/password/account classes;
- fixed some enqueue scripts issues;
This commit is contained in:
nikitozzzzzzz
2017-08-11 14:21:42 +03:00
parent 92ab044b8a
commit af191ee149
11 changed files with 695 additions and 803 deletions
+42
View File
@@ -176,6 +176,48 @@ if ( ! class_exists( 'UM_Functions' ) ) {
}
/*
* redirect
*/
function redirect( $url ) {
if ( headers_sent() || empty( $url ) ) {
$this->cc_js_redirect( $url );
} else {
wp_redirect( $url );
}
exit;
}
/*
* JS redirect
*/
function cc_js_redirect( $url ) {
//for blank redirects
if ( '' == $url ) {
$url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"];
}
$funtext="echo \"<script data-cfasync='false' type='text/javascript'>window.location = '" . $url . "'</script>\";";
register_shutdown_function( create_function( '', $funtext ) );
if ( 1 < ob_get_level() ) {
while ( ob_get_level() > 1 ) {
ob_end_clean();
}
}
?>
<script data-cfasync="false" type="text/javascript">
window.location = '<?php echo $url; ?>';
</script>
<?php
exit;
}
}
}
+2 -2
View File
@@ -180,11 +180,11 @@ if ( ! class_exists( 'UM' ) ) {
load_textdomain( $language_domain, $language_file );
require_once 'um-short-functions.php';
add_action( 'plugins_loaded', array( &$this, 'init' ), 0 );
// init widgets
add_action( 'widgets_init', array( &$this, 'widgets_init' ) );
require_once 'um-short-functions.php';
}
}
+346 -255
View File
@@ -7,66 +7,205 @@ if ( ! defined( 'ABSPATH' ) ) exit;
if ( ! class_exists( 'Account' ) ) {
class Account {
var $tabs;
var $current_tab = 'general';
var $register_fields = array();
var $tab_output = array();
function __construct() {
$this->register_fields = array();
add_shortcode( 'ultimatemember_account', array( &$this, 'ultimatemember_account' ) );
add_shortcode('ultimatemember_account', array(&$this, 'ultimatemember_account') );
add_action( 'template_redirect', array( &$this, 'account_page_restrict' ), 10001 );
add_filter('um_account_page_default_tabs_hook', array(&$this, 'core_tabs'), 1);
add_action( 'template_redirect', array( &$this, 'account_submit' ), 10002 );
add_action('template_redirect', array(&$this, 'account'), 10001 );
add_action('template_redirect', array(&$this, 'form_init'), 10002);
add_filter('um_predefined_fields_hook', array(&$this,'predefined_fields_hook'),1 );
$this->current_tab = 'general';
add_filter( 'um_predefined_fields_hook', array( &$this, 'predefined_fields_hook' ), 1 );
}
/**
* Get Core account tabs
* @return array
* Init AllTabs for user account
*
* @param $args
*/
function core_tabs() {
function init_tabs( $args ) {
$tabs[100]['general']['icon'] = 'um-faicon-user';
$tabs[100]['general']['title'] = __('Account','ultimate-member');
$tabs[100]['general'] = array(
'icon' => 'um-faicon-user',
'title' => __( 'Account', 'ultimate-member' ),
'submit_title' => __( 'Update Account', 'ultimate-member' ),
);
$tabs[200]['password']['icon'] = 'um-faicon-asterisk';
$tabs[200]['password']['title'] = __('Change Password','ultimate-member');
$tabs[200]['password'] = array(
'icon' => 'um-faicon-asterisk',
'title' => __( 'Change Password', 'ultimate-member' ),
'submit_title' => __( 'Update Password', 'ultimate-member' ),
);
$tabs[300]['privacy']['icon'] = 'um-faicon-lock';
$tabs[300]['privacy']['title'] = __('Privacy','ultimate-member');
$tabs[300]['privacy'] = array(
'icon' => 'um-faicon-lock',
'title' => __( 'Privacy', 'ultimate-member' ),
'submit_title' => __( 'Update Privacy', 'ultimate-member' ),
);
$tabs[400]['notifications']['icon'] = 'um-faicon-envelope';
$tabs[400]['notifications']['title'] = __('Notifications','ultimate-member');
$tabs[400]['notifications'] = array(
'icon' => 'um-faicon-envelope',
'title' => __( 'Notifications', 'ultimate-member' ),
'submit_title' => __( 'Update Notifications', 'ultimate-member' ),
);
$tabs[9999]['delete']['icon'] = 'um-faicon-trash-o';
$tabs[9999]['delete']['title'] = __('Delete Account','ultimate-member');
//if user cannot delete profile hide delete tab
if ( um_user( 'can_delete_profile' ) || um_user( 'can_delete_everyone' ) ) {
return $tabs;
$tabs[99999]['delete'] = array(
'icon' => 'um-faicon-trash-o',
'title' => __( 'Delete Account', 'ultimate-member' ),
'submit_title' => __( 'Delete Account', 'ultimate-member' ),
);
}
$this->tabs = apply_filters( 'um_account_page_default_tabs_hook', $tabs );
ksort( $this->tabs );
$tabs_structed = array();
foreach ( $this->tabs as $k => $arr ) {
foreach ( $arr as $id => $info ) {
if ( ! empty( $args['tab'] ) && $id != $args['tab'] )
continue;
$output = $this->get_tab_fields( $id, $args );
if ( ! empty( $output ) )
$tabs_structed[$id] = $info;
}
}
$this->tabs = $tabs_structed;
}
/**
* Account page form
* Account Shortcode
*
* @param array $args
* @return string
*/
function form_init() {
function ultimatemember_account( $args = array() ) {
um_fetch_user( get_current_user_id() );
ob_start();
$defaults = array(
'template' => 'account',
'mode' => 'account',
'form_id' => 'um_account_id',
);
$args = wp_parse_args( $args, $defaults );
$args = apply_filters( 'um_account_shortcode_args_filter', $args );
if ( ! empty( $args['tab'] ) ) {
if ( $args['tab'] == 'account' )
$args['tab'] = 'general';
$this->init_tabs( $args );
$this->current_tab = $args['tab'];
if ( ! empty( $this->tabs[$args['tab']] ) ) { ?>
<div class="um-form">
<form method="post" action="">
<?php do_action( 'um_account_page_hidden_fields', $args );
$this->render_account_tab( $args['tab'], $this->tabs[$args['tab']], $args ); ?>
</form>
</div>
<?php }
} else {
$this->init_tabs( $args );
do_action( "um_pre_{$args['mode']}_shortcode", $args );
do_action( "um_before_form_is_loaded", $args );
do_action( "um_before_{$args['mode']}_form_is_loaded", $args );
UM()->shortcodes()->template_load( $args['template'], $args );
}
if ( ! is_admin() && ! defined( 'DOING_AJAX' ) ) {
UM()->shortcodes()->dynamic_css( $args );
}
$output = ob_get_clean();
return $output;
}
/**
* Restrict access to Account page
*/
function account_page_restrict() {
if ( um_is_core_page( 'account' ) ) {
//redirect to login for not logged in users
if ( ! is_user_logged_in() ) {
$redirect_to = add_query_arg(
'redirect_to',
urlencode_deep( um_get_core_page( 'account' ) ) ,
um_get_core_page( 'login' )
);
exit( wp_redirect( $redirect_to ) );
}
//set data for fields
UM()->fields()->set_mode = 'account';
UM()->fields()->editing = true;
if ( get_query_var('um_tab') )
$this->current_tab = get_query_var('um_tab');
}
}
/**
* Submit Account handler
*/
function account_submit() {
if ( um_submitting_account_page() ) {
UM()->form()->post_form = $_POST;
do_action('um_submit_account_errors_hook', UM()->form()->post_form );
//validate process
do_action( 'um_submit_account_errors_hook', UM()->form()->post_form );
if ( !isset( UM()->form()->errors ) ) {
if ( ! isset( UM()->form()->errors ) ) {
if ( get_query_var('um_tab') ) {
$this->current_tab = get_query_var('um_tab');
if ( um_is_core_page( 'account' ) && get_query_var( 'um_tab' ) ) {
$this->current_tab = get_query_var( 'um_tab' );
} else {
$this->current_tab = UM()->form()->post_form['_um_account_tab'];
}
do_action('um_submit_account_details', UM()->form()->post_form );
do_action( 'um_submit_account_details', UM()->form()->post_form );
}
@@ -74,36 +213,23 @@ if ( ! class_exists( 'Account' ) ) {
}
/**
* Can access account page
* Filter account fields
* @param array $predefined_fields
* @return array
*/
function account(){
if ( um_is_core_page('account') && !is_user_logged_in() ) {
function predefined_fields_hook( $predefined_fields ) {
$redirect_to = add_query_arg(
'redirect_to',
urlencode_deep( um_get_core_page('account') ) ,
um_get_core_page('login')
);
$account_hide_in_directory = um_get_option( 'account_hide_in_directory' );
exit( wp_redirect( $redirect_to ) );
}
if ( um_is_core_page('account') ) {
UM()->fields()->set_mode = 'account';
UM()->fields()->editing = true;
if ( get_query_var('um_tab') ) {
$this->current_tab = get_query_var('um_tab');
}
}
if ( ! $account_hide_in_directory )
unset( $predefined_fields['hide_in_members'] );
return $predefined_fields;
}
/**
* Get Tab Link
* @param integer $id
@@ -125,12 +251,177 @@ if ( ! class_exists( 'Account' ) ) {
return $url;
}
/**
* @param $fields
* @param $shortcode_args
* @return mixed
*/
function filter_fields_by_attrs( $fields, $shortcode_args ) {
foreach ( $fields as $k => $field ) {
if ( isset( $shortcode_args[$field['metakey']] ) && 0 == $shortcode_args[$field['metakey']] )
unset( $fields[$k] );
}
return $fields;
}
/**
* * Get Tab Output
*
* @param integer $id
* @param array $shortcode_args
* @return mixed|null|string|void
*/
function get_tab_fields( $id, $shortcode_args ) {
$output = null;
UM()->fields()->set_mode = 'account';
UM()->fields()->editing = true;
if ( ! empty( $this->tab_output[$id]['content'] ) && ! empty( $this->tab_output[$id]['hash'] ) &&
$this->tab_output[$id]['hash'] == md5( json_encode( $shortcode_args ) ) )
return $this->tab_output[$id]['content'];
switch ( $id ) {
case 'privacy':
$args = 'profile_privacy,hide_in_members';
$args = apply_filters( 'um_account_tab_privacy_fields', $args );
$fields = UM()->builtin()->get_specific_fields( $args );
$fields = apply_filters( 'um_account_secure_fields', $fields, $id );
$fields = $this->filter_fields_by_attrs( $fields, $shortcode_args );
foreach ( $fields as $key => $data ){
$output .= UM()->fields()->edit_field( $key, $data );
}
break;
case 'delete':
$args = 'single_user_password';
$fields = UM()->builtin()->get_specific_fields( $args );
$fields = apply_filters( 'um_account_secure_fields', $fields, $id );
$fields = $this->filter_fields_by_attrs( $fields, $shortcode_args );
foreach ( $fields as $key => $data ) {
$output .= UM()->fields()->edit_field( $key, $data );
}
break;
case 'general':
$args = 'user_login,first_name,last_name,user_email';
if ( ! um_get_option( 'account_name' ) ) {
$args = 'user_login,user_email';
}
if ( ! um_get_option( 'account_email' ) && ! um_user( 'can_edit_everyone' ) ) {
$args = str_replace(',user_email','', $args );
}
$fields = UM()->builtin()->get_specific_fields( $args );
$fields = apply_filters( 'um_account_secure_fields', $fields, $id );
$fields = $this->filter_fields_by_attrs( $fields, $shortcode_args );
foreach ( $fields as $key => $data ) {
$output .= UM()->fields()->edit_field( $key, $data );
}
break;
case 'password':
$args = 'user_password';
$fields = UM()->builtin()->get_specific_fields( $args );
$fields = apply_filters( 'um_account_secure_fields', $fields, $id );
$fields = $this->filter_fields_by_attrs( $fields, $shortcode_args );
foreach ( $fields as $key => $data ) {
$output .= UM()->fields()->edit_field( $key, $data );
}
break;
default :
$output = apply_filters( "um_account_content_hook_{$id}", $output, $shortcode_args );
break;
}
$this->tab_output[$id] = array( 'content' => $output, 'hash' => md5( json_encode( $shortcode_args ) ) );
return $output;
}
/**
* Render Account Tab HTML
*
* @param $tab_id
* @param $tab_data
* @param $args
*/
function render_account_tab( $tab_id, $tab_data, $args ) {
$output = $this->get_tab_fields( $tab_id, $args );
if ( $output ) {
if ( ! empty ( $tab_data['with_header'] ) ) { ?>
<div class="um-account-heading uimob340-hide uimob500-hide"><i class="<?php echo $tab_data['icon'] ?>"></i><?php echo $tab_data['title']; ?></div>
<?php }
do_action( "um_before_account_{$tab_id}" );
echo $output;
do_action( "um_after_account_{$tab_id}" );
if ( ! isset( $tab_data['show_button'] ) || false !== $tab_data['show_button'] ) { ?>
<div class="um-col-alt um-col-alt-b">
<div class="um-left">
<input type="submit" name="um_account_submit" id="um_account_submit" class="um-button" value="<?php echo $tab_data['submit_title']; ?>" />
</div>
<?php do_action( "um_after_account_{$tab_id}_button" ); ?>
<div class="um-clear"></div>
</div>
<?php }
}
}
/**
* Add class based on shortcode
*
* @param string $mode
* @return string
*/
function get_class( $mode ){
function get_class( $mode ) {
$classes = 'um-'.$mode;
@@ -149,205 +440,5 @@ if ( ! class_exists( 'Account' ) ) {
$classes = apply_filters('um_form_official_classes__hook', $classes);
return $classes;
}
/**
* Get Tab Output
* @param integer $id
* @return string
*/
function get_tab_output( $id ) {
$output = null;
switch( $id ) {
case 'notifications':
$output = apply_filters("um_account_content_hook_{$id}", $output);
return $output;
break;
case 'privacy':
$args = 'profile_privacy,hide_in_members';
$args = apply_filters('um_account_tab_privacy_fields', $args );
$fields = UM()->builtin()->get_specific_fields( $args );
$fields = apply_filters('um_account_secure_fields', $fields, $id );
foreach( $fields as $key => $data ){
$output .= UM()->fields()->edit_field( $key, $data );
}
return $output;
break;
case 'delete':
$args = 'single_user_password';
$fields = UM()->builtin()->get_specific_fields( $args );
$fields = apply_filters('um_account_secure_fields', $fields, $id );
foreach( $fields as $key => $data ){
$output .= UM()->fields()->edit_field( $key, $data );
}
return $output;
break;
case 'general':
$args = 'user_login,first_name,last_name,user_email';
if ( !um_get_option('account_name') ) {
$args = 'user_login,user_email';
}
if ( !um_get_option('account_email') && !um_user('can_edit_everyone') ) {
$args = str_replace(',user_email','', $args );
}
$fields = UM()->builtin()->get_specific_fields( $args );
$fields = apply_filters('um_account_secure_fields', $fields, $id );
foreach( $fields as $key => $data ){
$output .= UM()->fields()->edit_field( $key, $data );
}
return $output;
break;
case 'password':
$args = 'user_password';
$fields = UM()->builtin()->get_specific_fields( $args );
$fields = apply_filters('um_account_secure_fields', $fields, $id );
foreach( $fields as $key => $data ){
$output .= UM()->fields()->edit_field( $key, $data );
}
return $output;
break;
default :
$output = apply_filters("um_account_content_hook_{$id}", $output);
return $output;
break;
}
}
/**
* Shortcode
* @param array $args
* @return string
*/
function ultimatemember_account( $args = array() ) {
return $this->load( $args );
}
/**
* Load module with global function
* @param array $args
* @return string
*/
function load( $args ) {
UM()->user()->set( get_current_user_id() );
ob_start();
$defaults = array(
'template' => 'account',
'mode' => 'account',
'form_id' => 'um_account_id',
);
$args = wp_parse_args( $args, $defaults );
$args = apply_filters('um_account_shortcode_args_filter', $args);
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);
$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
* @param array $args
* @return array
*/
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
* @param array $args
*/
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
* @param string $template
* @param array $args
*/
function template_load( $template, $args=array() ) {
if ( is_array( $args ) ) {
UM()->shortcodes()->set_args = $args;
}
UM()->shortcodes()->load_template( $template );
}
/**
* Filter account fields
* @param array $predefined_fields
* @return array
*/
function predefined_fields_hook( $predefined_fields ){
$account_hide_in_directory = um_get_option('account_hide_in_directory');
if( ! $account_hide_in_directory ){
unset( $predefined_fields['hide_in_members'] );
}
return $predefined_fields;
}
}
}
-9
View File
@@ -11,20 +11,11 @@ if ( ! class_exists( 'Enqueue' ) ) {
function __construct() {
add_action('wp_head', array(&$this, 'wp_head'), 999); // high-priority
$priority = apply_filters( 'um_core_enqueue_priority', 100 );
add_action('wp_enqueue_scripts', array(&$this, 'wp_enqueue_scripts'), $priority );
}
/***
*** @Enqueue inline css globally
***/
function wp_head() {
$css = um_get_option('custom_css');
if ( !$css ) return; ?><!-- ULTIMATE MEMBER INLINE CSS BEGIN --><style type="text/css"><?php print $this->minify( $css ); ?></style><!-- ULTIMATE MEMBER INLINE CSS END --><?php
}
/***
*** @Minify css string
+5 -5
View File
@@ -485,7 +485,7 @@ if ( ! class_exists( 'Fields' ) ) {
} else {
if ( !isset( UM()->form()->post_form ) ) {
if ( ! isset( UM()->form()->post_form[$key] ) ) {
$field_value = um_user( $key );
@@ -530,7 +530,7 @@ if ( ! class_exists( 'Fields' ) ) {
} else {
if ( isset( UM()->form()->post_form[ $key ] ) && $value == UM()->form()->post_form[ $key ] ) {
if ( $value == UM()->form()->post_form[ $key ] ) {
return true;
}
@@ -560,7 +560,7 @@ if ( ! class_exists( 'Fields' ) ) {
} else {
if ( ! isset( UM()->form()->post_form ) ) {
if ( ! isset( UM()->form()->post_form[$key] ) ) {
if ( um_user( $key ) && $this->editing == true ) {
@@ -609,7 +609,7 @@ if ( ! class_exists( 'Fields' ) ) {
} else {
if ( isset( UM()->form()->post_form[$key] ) && $value == UM()->form()->post_form[$key] ) {
if ( $value == UM()->form()->post_form[$key] ) {
return true;
}
@@ -1325,7 +1325,7 @@ if ( ! class_exists( 'Fields' ) ) {
} else {
if ( $this->set_mode == 'account' && um_is_core_page('account') ) {
if ( $this->set_mode == 'account' || um_is_core_page( 'account' ) ) {
$key = 'current_' . $original_key;
$output .= '<div class="um-field' . $classes . '"' . $conditional . ' data-key="'.$key.'">';
+7 -38
View File
@@ -116,7 +116,7 @@ if ( ! class_exists( 'Password' ) ) {
/***
*** @Add class based on shortcode
***/
function get_class( $mode ){
function get_class( $mode ) {
$classes = 'um-'.$mode;
@@ -160,9 +160,9 @@ if ( ! class_exists( 'Password' ) ) {
$args = wp_parse_args( $args, $defaults );
if ( empty( $args['use_custom_settings'] ) ) {
$args = array_merge( $args, $this->get_css_args( $args ) );
$args = array_merge( $args, UM()->shortcodes()->get_css_args( $args ) );
} else {
$args = array_merge( $this->get_css_args( $args ), $args );
$args = array_merge( UM()->shortcodes()->get_css_args( $args ), $args );
}
$args = apply_filters('um_reset_password_shortcode_args_filter', $args);
@@ -180,12 +180,12 @@ if ( ! class_exists( 'Password' ) ) {
do_action("um_before_form_is_loaded", $args);
do_action("um_before_{$mode}_form_is_loaded", $args);
do_action( "um_before_{$mode}_form_is_loaded", $args );
$this->template_load( $template, $args );
UM()->shortcodes()->template_load( $template, $args );
if ( !is_admin() && !defined( 'DOING_AJAX' ) ) {
$this->dynamic_css( $args );
if ( ! is_admin() && ! defined( 'DOING_AJAX' ) ) {
UM()->shortcodes()->dynamic_css( $args );
}
$output = ob_get_contents();
@@ -194,36 +194,5 @@ if ( ! class_exists( 'Password' ) ) {
}
/***
*** @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() ) {
if ( is_array( $args ) ) {
UM()->shortcodes()->set_args = $args;
}
UM()->shortcodes()->load_template( $template );
}
}
}
+27 -27
View File
@@ -331,50 +331,50 @@ if ( ! class_exists( 'Shortcodes' ) ) {
return $output;
}
/***
*** @Get dynamic css args
/**
* Get dynamic CSS args
*
* @param $args
* @return array
*/
function get_css_args($args) {
$arr = um_styling_defaults($args['mode']);
$arr = array_merge($arr, array('form_id' => $args['form_id'], 'mode' => $args['mode']));
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
/**
* Load dynamic css
*
* @param array $args
*/
function dynamic_css($args = array()) {
extract($args);
function dynamic_css( $args = array() ) {
extract( $args );
$global = um_path . 'assets/dynamic_css/dynamic_global.php';
include_once um_path . 'assets/dynamic_css/dynamic_global.php';
if (isset($mode)) {
$file = um_path . 'assets/dynamic_css/dynamic_' . $mode . '.php';
if ( isset( $mode ) ) {
$file = um_path . 'assets/dynamic_css/dynamic_' . $mode . '.php';
if ( file_exists( $file ) )
include_once $file;
}
}
include $global;
if (isset($file) && file_exists($file)) {
include $file;
}
if (isset($args['custom_css'])) {
$css = $args['custom_css'];
?><!-- ULTIMATE MEMBER FORM INLINE CSS BEGIN --><style type="text/css"><?php print UM()->enqueue()->minify($css);?></style><!-- ULTIMATE MEMBER FORM INLINE CSS END --><?php
}
}
/***
*** @Loads a template file
*/
function template_load($template, $args = array()) {
if (is_array($args)) {
function template_load( $template, $args = array() ) {
if ( is_array( $args ) ) {
UM()->shortcodes()->set_args = $args;
}
UM()->shortcodes()->load_template($template);
UM()->shortcodes()->load_template( $template );
}
/***
*** @Checks if a template file exists
*/
+184 -398
View File
@@ -1,5 +1,117 @@
<?php
/**
* Validate for errors in account form
*/
add_action( 'um_submit_account_errors_hook', 'um_submit_account_errors_hook' );
function um_submit_account_errors_hook( $args ) {
if ( ! isset( $_POST['um_account_submit'] ) )
return;
$user = get_user_by( 'login', um_user( 'user_login' ) );
if ( isset( $_POST['_um_account_tab'] ) ) {
switch ( $_POST['_um_account_tab'] ) {
case 'delete': {
// delete account
if ( strlen(trim( $_POST['single_user_password'] ) ) == 0 ) {
UM()->form()->add_error('single_user_password', __('You must enter your password','ultimate-member') );
} else {
if ( ! wp_check_password( $_POST['single_user_password'], $user->data->user_pass, $user->data->ID ) ) {
UM()->form()->add_error('single_user_password', __('This is not your password','ultimate-member') );
}
}
UM()->account()->current_tab = 'delete';
break;
}
case 'password': {
// change password
if ( ( isset( $_POST['current_user_password'] ) && $_POST['current_user_password'] != '' ) ||
( isset( $_POST['user_password'] ) && $_POST['user_password'] != '' ) ||
( isset( $_POST['confirm_user_password'] ) && $_POST['confirm_user_password'] != '') ) {
if ( $_POST['current_user_password'] == '' || ! wp_check_password( $_POST['current_user_password'], $user->data->user_pass, $user->data->ID ) ) {
UM()->form()->add_error('current_user_password', __('This is not your password','ultimate-member') );
UM()->account()->current_tab = 'password';
} else { // correct password
if ( $_POST['user_password'] != $_POST['confirm_user_password'] && $_POST['user_password'] ) {
UM()->form()->add_error('user_password', __('Your new password does not match','ultimate-member') );
UM()->account()->current_tab = 'password';
}
if ( um_get_option('account_require_strongpass') ) {
if ( strlen( utf8_decode( $_POST['user_password'] ) ) < 8 ) {
UM()->form()->add_error('user_password', __('Your password must contain at least 8 characters','ultimate-member') );
}
if ( strlen( utf8_decode( $_POST['user_password'] ) ) > 30 ) {
UM()->form()->add_error('user_password', __('Your password must contain less than 30 characters','ultimate-member') );
}
if ( ! UM()->validation()->strong_pass( $_POST['user_password'] ) ) {
UM()->form()->add_error('user_password', __('Your password must contain at least one lowercase letter, one capital letter and one number','ultimate-member') );
}
}
}
}
break;
}
case 'account':
case 'general': {
// errors on general tab
$account_name_require = um_get_option( "account_name_require" );
if ( ! empty( $_POST['user_login'] ) && ! validate_username( $_POST['user_login'] ) ) {
UM()->form()->add_error('user_login', __( 'Your username is invalid', 'ultimate-member' ) );
return;
}
if ( isset( $_POST['first_name'] ) && ( strlen( trim( $_POST['first_name'] ) ) == 0 && $account_name_require ) ) {
UM()->form()->add_error( 'first_name', __( 'You must provide your first name', 'ultimate-member' ) );
}
if ( isset( $_POST['last_name'] ) && ( strlen( trim( $_POST['last_name'] ) ) == 0 && $account_name_require ) ) {
UM()->form()->add_error( 'last_name', __( 'You must provide your last name', 'ultimate-member' ) );
}
if ( isset( $_POST['user_email'] ) ) {
if ( strlen( trim( $_POST['user_email'] ) ) == 0 )
UM()->form()->add_error( 'user_email', __( 'You must provide your e-mail', 'ultimate-member' ) );
if ( ! is_email( $_POST['user_email'] ) )
UM()->form()->add_error( 'user_email', __( 'Please provide a valid e-mail', 'ultimate-member' ) );
if ( email_exists( $_POST['user_email'] ) && email_exists( $_POST['user_email'] ) != get_current_user_id() )
UM()->form()->add_error( 'user_email', __( 'Email already linked to another account', 'ultimate-member' ) );
}
break;
}
default:
do_action( 'um_submit_account_' . $_POST['_um_account_tab'] . '_tab_errors_hook' );
break;
}
UM()->account()->current_tab = $_POST['_um_account_tab'];
}
}
/**
* Submit account page changes
*/
@@ -7,39 +119,63 @@
function um_submit_account_details( $args ) {
$tab = ( get_query_var('um_tab') ) ? get_query_var('um_tab') : 'general';
if ( $_POST['user_password'] && $_POST['confirm_user_password'] ) {
$current_tab = isset( $_POST['_um_account_tab'] ) ? $_POST['_um_account_tab']: '';
//change password account's tab
if ( 'password' == $current_tab && $_POST['user_password'] && $_POST['confirm_user_password'] ) {
$changes['user_pass'] = $_POST['user_password'];
$args['user_id'] = um_user('ID');
do_action('send_password_change_email', $args );
do_action( 'send_password_change_email', $args );
wp_set_password( $changes['user_pass'], um_user('ID') );
wp_set_password( $changes['user_pass'], um_user( 'ID' ) );
wp_signon( array('user_login' => um_user('user_login'), 'user_password' => $changes['user_pass']) );
wp_signon( array( 'user_login' => um_user( 'user_login' ), 'user_password' => $changes['user_pass'] ) );
}
$arr_fields = array();
$account_fields = get_user_meta( um_user('ID'), 'um_account_secure_fields', true );
$secure_fields = apply_filters('um_secure_account_fields', $account_fields , um_user('ID') );
if( isset( $secure_fields ) ){
foreach ( $secure_fields as $tab_key => $fields ) {
if( isset( $fields ) ){
foreach ($fields as $key => $value) {
$arr_fields[ ] = $key;
// delete account
$user = get_user_by( 'login', um_user( 'user_login' ) );
if ( 'delete' == $current_tab && isset( $_POST['single_user_password'] ) && wp_check_password( $_POST['single_user_password'], $user->data->user_pass, $user->data->ID ) ) {
if ( current_user_can( 'delete_users' ) || um_user( 'can_delete_profile' ) ) {
if ( ! um_user( 'super_admin' ) ) {
UM()->user()->delete();
if ( um_user( 'after_delete' ) && um_user( 'after_delete' ) == 'redirect_home' ) {
um_redirect_home();
} elseif ( um_user( 'delete_redirect_url' ) ) {
exit( wp_redirect( um_user( 'delete_redirect_url' ) ) );
} else {
um_redirect_home();
}
}
}
}
$arr_fields = array();
$account_fields = get_user_meta( um_user('ID'), 'um_account_secure_fields', true );
$secure_fields = apply_filters( 'um_secure_account_fields', $account_fields , um_user( 'ID' ) );
if ( is_array( $secure_fields ) ) {
foreach ( $secure_fields as $tab_key => $fields ) {
foreach ( $fields as $key => $value ) {
$arr_fields[ ] = $key;
}
}
}
$changes = array();
foreach( $_POST as $k => $v ) {
if ( !strstr( $k, 'password' ) && !strstr( $k, 'um_account' ) && in_array( $k, $arr_fields ) ) {
$changes[ $k ] = $v;
}
}
foreach ( $_POST as $k => $v ) {
if ( strstr( $k, 'password' ) || strstr( $k, 'um_account' ) || ! in_array( $k, $arr_fields ) )
continue;
$changes[ $k ] = $v;
}
if ( isset( $changes['hide_in_members'] ) && $changes['hide_in_members'] == __('No','ultimate-member') ) {
delete_user_meta( um_user('ID'), 'hide_in_members' );
@@ -51,140 +187,33 @@
UM()->user()->update_profile( $changes );
// delete account
$user = get_user_by('login', um_user('user_login') );
$current_tab = isset( $_POST['_um_account_tab'] ) ? $_POST['_um_account_tab']: '';
if ( isset( $_POST['single_user_password'] ) && wp_check_password( $_POST['single_user_password'], $user->data->user_pass, $user->data->ID ) && $current_tab == 'delete' ) {
if ( current_user_can('delete_users') || um_user('can_delete_profile') ) {
if ( !um_user('super_admin') ) {
UM()->user()->delete();
if ( um_user('after_delete') && um_user('after_delete') == 'redirect_home' ) {
um_redirect_home();
} elseif ( um_user('delete_redirect_url') ) {
exit( wp_redirect( um_user('delete_redirect_url') ) );
} else {
um_redirect_home();
}
}
}
}
do_action('um_post_account_update');
do_action('um_after_user_account_updated', get_current_user_id() );
$url = UM()->account()->tab_link( $tab );
$url = '';
if ( um_is_core_page( 'account' ) ) {
$url = add_query_arg( 'updated', 'account', $url );
$url = UM()->account()->tab_link( $tab );
if ( function_exists('icl_get_current_language') ) {
if ( icl_get_current_language() != icl_get_default_language() ) {
$url = UM()->permalinks()->get_current_url( true );
$url = add_query_arg( 'updated', 'account', $url );
exit( wp_redirect( $url ) );
$url = add_query_arg( 'updated', 'account', $url );
if ( function_exists( 'icl_get_current_language' ) ) {
if ( icl_get_current_language() != icl_get_default_language() ) {
$url = UM()->permalinks()->get_current_url( true );
$url = add_query_arg( 'updated', 'account', $url );
UM()->redirect( $url );
exit;
}
}
}
exit( wp_redirect( $url ) );
UM()->redirect( $url );
exit;
}
/**
* Validate for errors in account form
*/
add_action('um_submit_account_errors_hook','um_submit_account_errors_hook');
function um_submit_account_errors_hook( $args ) {
$current_tab = isset( $_POST['_um_account_tab'] ) ? $_POST['_um_account_tab']: '';
$user = get_user_by('login', um_user('user_login') );
if( isset( $_POST['_um_account_tab'] ) && $current_tab != "delete" ){
// errors on general tab
if ( isset($_POST['um_account_submit']) ) {
if( $current_tab != 'password' ){
$account_name_require = um_get_option("account_name_require");
if ( isset($_POST['first_name']) && ( strlen(trim( $_POST['first_name'] ) ) == 0 && $account_name_require ) ) {
UM()->form()->add_error('first_name', __('You must provide your first name','ultimate-member') );
}
if ( isset($_POST['last_name']) && ( strlen(trim( $_POST['last_name'] ) ) == 0 && $account_name_require ) ) {
UM()->form()->add_error('last_name', __('You must provide your last name','ultimate-member') );
}
if ( isset($_POST['user_email']) && strlen(trim( $_POST['user_email'] ) ) == 0 ) {
UM()->form()->add_error('user_email', __('You must provide your e-mail','ultimate-member') );
}
if ( isset($_POST['user_email']) && !is_email( $_POST['user_email'] ) ) {
UM()->form()->add_error('user_email', __('Please provide a valid e-mail','ultimate-member') );
}
if ( email_exists( $_POST['user_email'] ) && email_exists( $_POST['user_email'] ) != get_current_user_id() ) {
UM()->form()->add_error('user_email', __('Email already linked to another account','ultimate-member') );
}
}
}
UM()->account()->current_tab = 'general';
// change password
if ( ( isset( $_POST['current_user_password'] ) && $_POST['current_user_password'] != '' ) ||
( isset( $_POST['user_password'] ) && $_POST['user_password'] != '' ) ||
( isset( $_POST['confirm_user_password'] ) && $_POST['confirm_user_password'] != '') ) {
if ( $_POST['current_user_password'] == '' || ! wp_check_password( $_POST['current_user_password'], $user->data->user_pass, $user->data->ID ) ) {
UM()->form()->add_error('current_user_password', __('This is not your password','ultimate-member') );
UM()->account()->current_tab = 'password';
} else { // correct password
if ( $_POST['user_password'] != $_POST['confirm_user_password'] && $_POST['user_password'] ) {
UM()->form()->add_error('user_password', __('Your new password does not match','ultimate-member') );
UM()->account()->current_tab = 'password';
}
if ( um_get_option('account_require_strongpass') ) {
if ( strlen( utf8_decode( $_POST['user_password'] ) ) < 8 ) {
UM()->form()->add_error('user_password', __('Your password must contain at least 8 characters','ultimate-member') );
}
if ( strlen( utf8_decode( $_POST['user_password'] ) ) > 30 ) {
UM()->form()->add_error('user_password', __('Your password must contain less than 30 characters','ultimate-member') );
}
if ( ! UM()->validation()->strong_pass( $_POST['user_password'] ) ) {
UM()->form()->add_error('user_password', __('Your password must contain at least one lowercase letter, one capital letter and one number','ultimate-member') );
UM()->account()->current_tab = 'password';
}
}
}
}
if ( ! empty( $_POST['user_login'] ) && ! validate_username( $_POST['user_login'] ) ) {
UM()->form()->add_error('user_login', __('Your username is invalid','ultimate-member') );
return;
}
}
// delete account
if ( isset( $_POST['um_account_submit'] ) && $_POST['_um_account_tab'] == "delete" ) {
if ( strlen(trim( $_POST['single_user_password'] ) ) == 0 ) {
UM()->form()->add_error('single_user_password', __('You must enter your password','ultimate-member') );
} else {
if ( ! wp_check_password( $_POST['single_user_password'], $user->data->user_pass, $user->data->ID ) ) {
UM()->form()->add_error('single_user_password', __('This is not your password','ultimate-member') );
}
}
UM()->account()->current_tab = 'delete';
}
}
/**
* Hidden inputs for account form
@@ -194,284 +223,41 @@
?>
<input type="hidden" name="_um_account" id="_um_account" value="1" />
<?php $current_tab = UM()->account()->current_tab; ?>
<input type="hidden" name="_um_account_tab" id="_um_account_tab" value="<?php echo $current_tab;?>" />
<input type="hidden" name="_um_account_tab" id="_um_account_tab" value="<?php echo UM()->account()->current_tab;?>" />
<?php
}
/**
* Display "Delete" tab
* Before delete account tab content
*/
add_action('um_account_tab__delete', 'um_account_tab__delete');
function um_account_tab__delete( $info ) {
extract( $info );
$output = UM()->account()->get_tab_output('delete');
if ( $output ) { ?>
<div class="um-account-heading uimob340-hide uimob500-hide"><i class="<?php echo $icon; ?>"></i><?php echo $title; ?></div>
<?php echo wpautop( um_get_option('delete_account_text') ); ?>
<?php echo $output; ?>
<?php do_action('um_after_account_delete'); ?>
<div class="um-col-alt um-col-alt-b">
<div class="um-left"><input type="submit" name="um_account_submit" id="um_account_submit" value="<?php _e('Delete Account','ultimate-member'); ?>" class="um-button" /></div>
<?php do_action('um_after_account_delete_button'); ?>
<div class="um-clear"></div>
</div>
<?php
}
add_action( 'um_before_account_delete', 'um_before_account_delete' );
function um_before_account_delete() {
echo wpautop( um_get_option( 'delete_account_text' ) );
}
/**
* Display "Privacy" tab
*/
add_action('um_account_tab__privacy', 'um_account_tab__privacy');
function um_account_tab__privacy( $info ) {
extract( $info );
$output = UM()->account()->get_tab_output('privacy');
if ( $output ) { ?>
<div class="um-account-heading uimob340-hide uimob500-hide"><i class="<?php echo $icon; ?>"></i><?php echo $title; ?></div>
<?php echo $output; ?>
<?php do_action('um_after_account_privacy'); ?>
<div class="um-col-alt um-col-alt-b">
<div class="um-left"><input type="submit" name="um_account_submit" id="um_account_submit" value="<?php _e('Update Privacy','ultimate-member'); ?>" class="um-button" /></div>
<?php do_action('um_after_account_privacy_button'); ?>
<div class="um-clear"></div>
</div>
<?php
}
}
/**
* Display "General" tab
* Before notifications account tab content
*/
add_action('um_account_tab__general', 'um_account_tab__general');
function um_account_tab__general( $info ) {
extract( $info );
$output = UM()->account()->get_tab_output('general');
if ( $output ) { ?>
<div class="um-account-heading uimob340-hide uimob500-hide"><i class="<?php echo $icon; ?>"></i><?php echo $title; ?></div>
<?php echo $output; ?>
<?php do_action('um_after_account_general'); ?>
<div class="um-col-alt um-col-alt-b">
<div class="um-left"><input type="submit" name="um_account_submit" id="um_account_submit" value="<?php _e('Update Account','ultimate-member'); ?>" class="um-button" /></div>
<?php do_action('um_after_account_general_button'); ?>
<div class="um-clear"></div>
</div>
<?php
}
}
/**
* Display "Password" tab
*/
add_action('um_account_tab__password', 'um_account_tab__password');
function um_account_tab__password( $info ) {
extract( $info );
$output = UM()->account()->get_tab_output('password');
if ( $output ) { ?>
<div class="um-account-heading uimob340-hide uimob500-hide"><i class="<?php echo $icon; ?>"></i><?php echo $title; ?></div>
<?php echo $output; ?>
<?php do_action('um_after_account_password'); ?>
<div class="um-col-alt um-col-alt-b">
<div class="um-left"><input type="submit" name="um_account_submit" id="um_account_submit" value="<?php _e('Update Password','ultimate-member'); ?>" class="um-button" /></div>
<?php do_action('um_after_account_password_button'); ?>
<div class="um-clear"></div>
</div>
<?php
}
}
/**
* Display "Notifications" tab
*/
add_action('um_account_tab__notifications', 'um_account_tab__notifications');
function um_account_tab__notifications( $info ) {
extract( $info );
$output = UM()->account()->get_tab_output('notifications');
if ( $output ) { ?>
<div class="um-account-heading uimob340-hide uimob500-hide"><i class="<?php echo $icon; ?>"></i><?php echo $title; ?></div>
<?php if ( class_exists('UM_Messaging_API') || class_exists('UM_Followers_API') ) { ?>
add_action( 'um_before_account_notifications', 'um_before_account_notifications' );
function um_before_account_notifications() { ?>
<div class="um-field">
<div class="um-field-label"><label for=""><?php _e('Email me when','ultimate-member'); ?></label><div class="um-clear"></div></div>
</div>
<?php } ?>
<?php echo $output; ?>
<?php do_action('um_after_account_notifications'); ?>
<div class="um-col-alt um-col-alt-b">
<div class="um-left"><input type="submit" name="um_account_submit" id="um_account_submit" value="<?php _e('Update Notifications','ultimate-member'); ?>" class="um-button" /></div>
<?php do_action('um_after_account_notifications_button'); ?>
<div class="um-clear"></div>
</div>
<?php
}
}
/**
* Display account photo and username in mobile
*/
add_action('um_account_user_photo_hook__mobile', 'um_account_user_photo_hook__mobile');
function um_account_user_photo_hook__mobile( $args ) {
extract( $args );
?>
<div class="um-account-meta radius-<?php echo um_get_option('profile_photocorner'); ?> uimob340-show uimob500-show">
<div class="um-account-meta-img"><a href="<?php echo um_user_profile_url(); ?>"><?php echo get_avatar( um_user('ID'), 120); ?></a></div>
<div class="um-account-name">
<a href="<?php echo um_user_profile_url(); ?>"><?php echo um_user('display_name'); ?></a>
<div class="um-account-profile-link"><a href="<?php echo um_user_profile_url(); ?>" class="um-link"><?php _e('View profile','ultimate-member'); ?></a></div>
<div class="um-field-label">
<label for=""><?php _e( 'Email me when', 'ultimate-member' ); ?></label>
<div class="um-clear"></div>
</div>
</div>
<?php }
<?php
}
/**
* Display account photo and username
*/
add_action('um_account_user_photo_hook', 'um_account_user_photo_hook');
function um_account_user_photo_hook( $args ) {
extract( $args );
?>
<div class="um-account-meta radius-<?php echo um_get_option('profile_photocorner'); ?>">
<div class="um-account-meta-img uimob800-hide"><a href="<?php echo um_user_profile_url(); ?>"><?php echo get_avatar( um_user('ID'), 120); ?></a></div>
<?php if ( UM()->mobile()->isMobile() ) { ?>
<div class="um-account-meta-img-b uimob800-show" title="<?php echo um_user('display_name'); ?>"><a href="<?php echo um_user_profile_url(); ?>"><?php echo get_avatar( um_user('ID'), 120); ?></a></div>
<?php } else { ?>
<div class="um-account-meta-img-b uimob800-show um-tip-w" title="<?php echo um_user('display_name'); ?>"><a href="<?php echo um_user_profile_url(); ?>"><?php echo get_avatar( um_user('ID'), 120); ?></a></div>
<?php } ?>
<div class="um-account-name uimob800-hide">
<a href="<?php echo um_user_profile_url(); ?>"><?php echo um_user('display_name', 'html'); ?></a>
<div class="um-account-profile-link"><a href="<?php echo um_user_profile_url(); ?>" class="um-link"><?php _e('View profile','ultimate-member'); ?></a></div>
</div>
</div>
<?php
}
/**
* Display account page tabs
*/
add_action('um_account_display_tabs_hook', 'um_account_display_tabs_hook');
function um_account_display_tabs_hook( $args ) {
extract( $args );
UM()->account()->tabs = apply_filters('um_account_page_default_tabs_hook', $tabs=array() );
ksort( UM()->account()->tabs );
?>
<ul>
<?php
foreach( UM()->account()->tabs as $k => $arr ) {
foreach( $arr as $id => $info ) { extract( $info );
$current_tab = UM()->account()->current_tab;
if ( isset($info['custom']) || um_get_option('account_tab_'.$id ) == 1 || $id == 'general' ) { ?>
<li>
<a data-tab="<?php echo $id; ?>" href="<?php echo UM()->account()->tab_link($id); ?>" class="um-account-link <?php if ( $id == $current_tab ) echo 'current'; ?>">
<?php if ( UM()->mobile()->isMobile() ) { ?>
<span class="um-account-icontip uimob800-show" title="<?php echo $title; ?>"><i class="<?php echo $icon; ?>"></i></span>
<?php } else { ?>
<span class="um-account-icontip uimob800-show um-tip-w" title="<?php echo $title; ?>"><i class="<?php echo $icon; ?>"></i></span>
<?php } ?>
<span class="um-account-icon uimob800-hide"><i class="<?php echo $icon; ?>"></i></span>
<span class="um-account-title uimob800-hide"><?php echo $title; ?></span>
<span class="um-account-arrow uimob800-hide"><?php echo ( is_rtl() ) ? '<i class="um-faicon-angle-left"></i>' : '<i class="um-faicon-angle-right"></i>'; ?></span>
</a>
</li>
<?php
}
}
}
?>
</ul>
<?php
}
/**
* Update account fields to secure the account submission
*/
add_action('wp_footer','um_account_secure_registered_fields');
add_action( 'wp_footer', 'um_account_secure_registered_fields' );
function um_account_secure_registered_fields(){
$secure_fields = UM()->account()->register_fields;
update_user_meta( um_user('ID'), 'um_account_secure_fields', $secure_fields );
}
}
-30
View File
@@ -1,35 +1,5 @@
<?php
/**
* Account default tabs
* @param array $tabs
* @return array $tabs
* @uses um_account_page_default_tabs_hook
*/
add_filter('um_account_page_default_tabs_hook', 'um_account_page_default_tabs_hook' );
function um_account_page_default_tabs_hook( $tabs ) {
foreach ($tabs as $k => $arr ) {
foreach( $arr as $id => $info ) {
$output = UM()->account()->get_tab_output( $id );
if ( !$output ) {
unset( $tabs[$k][$id] );
}
if ( $id == 'delete' ) {
if ( !um_user('can_delete_profile') && !um_user('can_delete_everyone') ) {
unset( $tabs[$k][$id] );
}
}
}
}
return $tabs;
}
/**
* Account secure fields
* @param array $fields
+1 -1
View File
@@ -875,7 +875,7 @@
*** @boolean for account page editing
***/
function um_submitting_account_page() {
if ( um_is_core_page('account') && isset($_POST['_um_account']) == 1 && is_user_logged_in() )
if ( isset( $_POST['_um_account'] ) && $_POST['_um_account'] == 1 && is_user_logged_in() )
return true;
return false;
}
+81 -38
View File
@@ -4,60 +4,103 @@
<form method="post" action="">
<?php do_action('um_account_page_hidden_fields', $args ); ?>
<?php do_action('um_account_user_photo_hook__mobile', $args ); ?>
<?php do_action( 'um_account_page_hidden_fields', $args ); ?>
<div class="um-account-meta radius-<?php echo um_get_option( 'profile_photocorner' ); ?> uimob340-show uimob500-show">
<div class="um-account-meta-img">
<a href="<?php echo um_user_profile_url(); ?>"><?php echo get_avatar( um_user('ID'), 120 ); ?></a>
</div>
<div class="um-account-name">
<a href="<?php echo um_user_profile_url(); ?>"><?php echo um_user( 'display_name' ); ?></a>
<div class="um-account-profile-link">
<a href="<?php echo um_user_profile_url(); ?>" class="um-link"><?php _e( 'View profile', 'ultimate-member' ); ?></a>
</div>
</div>
</div>
<div class="um-account-side uimob340-hide uimob500-hide">
<?php do_action('um_account_user_photo_hook', $args ); ?>
<?php do_action('um_account_display_tabs_hook', $args ); ?>
<div class="um-account-meta radius-<?php echo um_get_option('profile_photocorner'); ?>">
<div class="um-account-meta-img uimob800-hide"><a href="<?php echo um_user_profile_url(); ?>"><?php echo get_avatar( um_user('ID'), 120 ); ?></a></div>
<?php if ( UM()->mobile()->isMobile() ) { ?>
<div class="um-account-meta-img-b uimob800-show" title="<?php echo um_user( 'display_name' ); ?>"><a href="<?php echo um_user_profile_url(); ?>"><?php echo get_avatar( um_user('ID'), 120 ); ?></a></div>
<?php } else { ?>
<div class="um-account-meta-img-b uimob800-show um-tip-w" title="<?php echo um_user( 'display_name' ); ?>"><a href="<?php echo um_user_profile_url(); ?>"><?php echo get_avatar( um_user('ID'), 120 ); ?></a></div>
<?php } ?>
<div class="um-account-name uimob800-hide">
<a href="<?php echo um_user_profile_url(); ?>"><?php echo um_user( 'display_name', 'html' ); ?></a>
<div class="um-account-profile-link"><a href="<?php echo um_user_profile_url(); ?>" class="um-link"><?php _e( 'View profile', 'ultimate-member' ); ?></a></div>
</div>
</div>
<ul>
<?php foreach ( UM()->account()->tabs as $id => $info ) {
if ( isset( $info['custom'] ) || um_get_option( "account_tab_{$id}" ) == 1 || $id == 'general' ) { ?>
<li>
<a data-tab="<?php echo $id ?>" href="<?php echo UM()->account()->tab_link( $id ); ?>" class="um-account-link <?php if ( $id == UM()->account()->current_tab ) echo 'current'; ?>">
<?php if ( UM()->mobile()->isMobile() ) { ?>
<span class="um-account-icontip uimob800-show" title="<?php echo $info['title']; ?>"><i class="<?php echo $info['icon']; ?>"></i></span>
<?php } else { ?>
<span class="um-account-icontip uimob800-show um-tip-w" title="<?php echo $info['title']; ?>"><i class="<?php echo $info['icon']; ?>"></i></span>
<?php } ?>
<span class="um-account-icon uimob800-hide"><i class="<?php echo $info['icon']; ?>"></i></span>
<span class="um-account-title uimob800-hide"><?php echo $info['title']; ?></span>
<span class="um-account-arrow uimob800-hide">
<i class="<?php if ( is_rtl() ) { ?>um-faicon-angle-left<?php } else { ?>um-faicon-angle-right<?php } ?>"></i>
</span>
</a>
</li>
<?php }
} ?>
</ul>
</div>
<div class="um-account-main" data-current_tab="<?php echo UM()->account()->current_tab; ?>">
<?php
<?php do_action( 'um_before_form', $args );
do_action('um_before_form', $args);
foreach( UM()->account()->tabs as $k => $arr ) {
foreach ( UM()->account()->tabs as $id => $info ) {
foreach( $arr as $id => $info ) { extract( $info );
$current_tab = UM()->account()->current_tab;
$current_tab = UM()->account()->current_tab;
if ( isset($info['custom']) || um_get_option('account_tab_'.$id ) == 1 || $id == 'general' ) {
if ( isset( $info['custom'] ) || um_get_option( 'account_tab_' . $id ) == 1 || $id == 'general' ) { ?>
?>
<div class="um-account-nav uimob340-show uimob500-show"><a href="#" data-tab="<?php echo $id; ?>" class="<?php if ( $id == $current_tab ) echo 'current'; ?>"><?php echo $title; ?>
<span class="ico"><i class="<?php echo $icon; ?>"></i></span>
<span class="arr"><i class="um-faicon-angle-down"></i></span>
</a></div>
<?php
echo '<div class="um-account-tab um-account-tab-'.$id.'" data-tab="'.$id.'">';
<div class="um-account-nav uimob340-show uimob500-show">
<a href="#" data-tab="<?php echo $id; ?>" class="<?php if ( $id == $current_tab ) echo 'current'; ?>">
<?php echo $info['title']; ?>
<span class="ico"><i class="<?php echo $info['icon']; ?>"></i></span>
<span class="arr"><i class="um-faicon-angle-down"></i></span>
</a>
</div>
do_action("um_account_tab__{$id}", $info );
echo '</div>';
<div class="um-account-tab um-account-tab-<?php echo $id ?>" data-tab="<?php echo $id ?>">
<?php $info['with_header'] = true;
UM()->account()->render_account_tab( $id, $info, $args ); ?>
</div>
<?php }
}
}
}
} ?>
?>
</div><div class="um-clear"></div>
</div>
<div class="um-clear"></div>
</form>
<?php do_action('um_after_account_page_load'); ?>
<?php do_action( 'um_after_account_page_load' ); ?>
</div>