mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-07-16 13:13:33 +09:00
Update 1.0.60
This commit is contained in:
+27
-1
@@ -6,6 +6,8 @@ class UM_Account {
|
||||
|
||||
add_shortcode('ultimatemember_account', array(&$this, 'ultimatemember_account'), 1);
|
||||
|
||||
add_filter('um_account_page_default_tabs_hook', array(&$this, 'core_tabs'), 1);
|
||||
|
||||
add_action('template_redirect', array(&$this, 'account'), 10001 );
|
||||
|
||||
add_action('template_redirect', array(&$this, 'form_init'), 10002);
|
||||
@@ -14,6 +16,29 @@ class UM_Account {
|
||||
|
||||
}
|
||||
|
||||
/***
|
||||
*** @get core account tabs
|
||||
***/
|
||||
function core_tabs() {
|
||||
|
||||
$tabs[100]['general']['icon'] = 'um-faicon-user';
|
||||
$tabs[100]['general']['title'] = __('Account','ultimatemember');
|
||||
|
||||
$tabs[200]['password']['icon'] = 'um-faicon-asterisk';
|
||||
$tabs[200]['password']['title'] = __('Change Password','ultimatemember');
|
||||
|
||||
$tabs[300]['privacy']['icon'] = 'um-faicon-lock';
|
||||
$tabs[300]['privacy']['title'] = __('Privacy','ultimatemember');
|
||||
|
||||
$tabs[400]['notifications']['icon'] = 'um-faicon-bell';
|
||||
$tabs[400]['notifications']['title'] = __('Notifications','ultimatemember');
|
||||
|
||||
$tabs[500]['delete']['icon'] = 'um-faicon-trash-o';
|
||||
$tabs[500]['delete']['title'] = __('Delete Account','ultimatemember');
|
||||
|
||||
return $tabs;
|
||||
}
|
||||
|
||||
/***
|
||||
*** @account page form
|
||||
***/
|
||||
@@ -160,7 +185,8 @@ class UM_Account {
|
||||
break;
|
||||
|
||||
default :
|
||||
$args = null;
|
||||
$output = apply_filters("um_account_content_hook_{$id}", $output);
|
||||
return $output;
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
@@ -22,6 +22,9 @@
|
||||
unset( $changes['hide_in_members'] );
|
||||
}
|
||||
|
||||
// fired on account page, just before updating profile
|
||||
do_action('um_account_pre_update_profile', $changes, um_user('ID') );
|
||||
|
||||
$ultimatemember->user->update_profile( $changes );
|
||||
|
||||
// delete account
|
||||
@@ -211,7 +214,6 @@
|
||||
function um_account_tab__password( $info ) {
|
||||
global $ultimatemember;
|
||||
extract( $info );
|
||||
extract( $info );
|
||||
|
||||
$output = $ultimatemember->account->get_tab_output('password');
|
||||
|
||||
@@ -235,7 +237,6 @@
|
||||
function um_account_tab__notifications( $info ) {
|
||||
global $ultimatemember;
|
||||
extract( $info );
|
||||
extract( $info );
|
||||
|
||||
$output = $ultimatemember->account->get_tab_output('notifications');
|
||||
|
||||
@@ -314,22 +315,9 @@
|
||||
global $ultimatemember;
|
||||
extract( $args );
|
||||
|
||||
$tabs[100]['general']['icon'] = 'um-faicon-user';
|
||||
$tabs[100]['general']['title'] = __('Account','ultimatemember');
|
||||
$ultimatemember->account->tabs = apply_filters('um_account_page_default_tabs_hook', $tabs=array() );
|
||||
|
||||
$tabs[200]['password']['icon'] = 'um-faicon-asterisk';
|
||||
$tabs[200]['password']['title'] = __('Change Password','ultimatemember');
|
||||
|
||||
$tabs[300]['privacy']['icon'] = 'um-faicon-lock';
|
||||
$tabs[300]['privacy']['title'] = __('Privacy','ultimatemember');
|
||||
|
||||
$tabs[400]['notifications']['icon'] = 'um-faicon-bell';
|
||||
$tabs[400]['notifications']['title'] = __('Notifications','ultimatemember');
|
||||
|
||||
$tabs[500]['delete']['icon'] = 'um-faicon-trash-o';
|
||||
$tabs[500]['delete']['title'] = __('Delete Account','ultimatemember');
|
||||
|
||||
$ultimatemember->account->tabs = apply_filters('um_account_page_default_tabs_hook', $tabs );
|
||||
ksort( $ultimatemember->account->tabs );
|
||||
|
||||
?>
|
||||
|
||||
|
||||
+28
-10
@@ -93,7 +93,7 @@
|
||||
|
||||
$words = array_map("rtrim", explode("\n", $words));
|
||||
foreach( $fields as $key => $array ) {
|
||||
if ( isset( $args[$key] ) ) {
|
||||
if ( isset( $args[$key] ) && !empty( $args[$key] ) ) {
|
||||
if ( isset($array['validate']) && in_array( $array['validate'], array('unique_username','unique_email','unique_username_or_email') ) ) {
|
||||
if ( preg_grep( "/".$args[$key]."/i" , $words ) ) {
|
||||
$ultimatemember->form->add_error( $key, __('You are not allowed to use this word as your username.','ultimatemember') );
|
||||
@@ -155,11 +155,17 @@
|
||||
|
||||
foreach( $fields as $key => $array ) {
|
||||
|
||||
if ( $key == 'role_select' || $key == 'role_radio' ) {
|
||||
if ( isset($args['role']) && empty($args['role']) && isset( $array['required'] ) && $array['required'] == 1 ) {
|
||||
$ultimatemember->form->add_error($key, __('Please specify account type.','ultimatemember') );
|
||||
}
|
||||
}
|
||||
|
||||
if ( isset( $args[$key] ) ) {
|
||||
|
||||
if ( isset( $array['required'] ) && $array['required'] == 1 ) {
|
||||
if ( !isset($args[$key]) || $args[$key] == '' ) {
|
||||
$ultimatemember->form->add_error($key, sprintf( __('%s is required','ultimatemember'), $array['label'] ) );
|
||||
$ultimatemember->form->add_error($key, sprintf( __('%s is required','ultimatemember'), $array['label'] ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -302,14 +308,26 @@
|
||||
|
||||
case 'unique_email':
|
||||
|
||||
if ( $args[$key] == '' ) {
|
||||
$ultimatemember->form->add_error($key, __('You must provide your email','ultimatemember') );
|
||||
} else if ( $mode == 'register' && email_exists( $args[$key] ) ) {
|
||||
$ultimatemember->form->add_error($key, __('This email is already linked to an existing account','ultimatemember') );
|
||||
} else if ( !is_email( $args[$key] ) ) {
|
||||
$ultimatemember->form->add_error($key, __('This is not a valid email','ultimatemember') );
|
||||
} else if ( !$ultimatemember->validation->safe_username( $args[$key] ) ) {
|
||||
$ultimatemember->form->add_error($key, __('Your email contains invalid characters','ultimatemember') );
|
||||
if ( in_array( $key, array('user_email') ) ) {
|
||||
|
||||
if ( $args[$key] == '' && in_array( $key, array('user_email') ) ) {
|
||||
$ultimatemember->form->add_error($key, __('You must provide your email','ultimatemember') );
|
||||
} else if ( $mode == 'register' && email_exists( $args[$key] ) ) {
|
||||
$ultimatemember->form->add_error($key, __('This email is already linked to an existing account','ultimatemember') );
|
||||
} else if ( !is_email( $args[$key] ) ) {
|
||||
$ultimatemember->form->add_error($key, __('This is not a valid email','ultimatemember') );
|
||||
} else if ( !$ultimatemember->validation->safe_username( $args[$key] ) ) {
|
||||
$ultimatemember->form->add_error($key, __('Your email contains invalid characters','ultimatemember') );
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
if ( $args[$key] != '' && !is_email($args[$key]) ) {
|
||||
$ultimatemember->form->add_error($key, __('This is not a valid email','ultimatemember') );
|
||||
} else if ( $args[$key] != '' && email_exists( $args[$key] ) ) {
|
||||
$ultimatemember->form->add_error($key, __('This email is already linked to an existing account','ultimatemember') );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
@@ -13,15 +13,15 @@
|
||||
$mode = $args['mode'];
|
||||
|
||||
if ( isset( $args['username'] ) && $args['username'] == '' ) {
|
||||
$ultimatemember->form->add_error( 'username', __('Please enter your username or email') );
|
||||
$ultimatemember->form->add_error( 'username', __('Please enter your username or email','ultimatemember') );
|
||||
}
|
||||
|
||||
if ( isset( $args['user_login'] ) && $args['user_login'] == '' ) {
|
||||
$ultimatemember->form->add_error( 'user_login', __('Please enter your username') );
|
||||
$ultimatemember->form->add_error( 'user_login', __('Please enter your username','ultimatemember') );
|
||||
}
|
||||
|
||||
if ( isset( $args['user_email'] ) && $args['user_email'] == '' ) {
|
||||
$ultimatemember->form->add_error( 'user_email', __('Please enter your email') );
|
||||
$ultimatemember->form->add_error( 'user_email', __('Please enter your email','ultimatemember') );
|
||||
}
|
||||
|
||||
if ( isset( $args['username'] ) ) {
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
***/
|
||||
function um_block_wpadmin_by_user_role(){
|
||||
global $ultimatemember;
|
||||
if( is_admin() && !defined('DOING_AJAX') && um_user('ID') && !um_user('can_access_wpadmin')){
|
||||
if( is_admin() && !defined('DOING_AJAX') && um_user('ID') && !um_user('can_access_wpadmin') && !is_super_admin( um_user('ID') ) ){
|
||||
um_redirect_home();
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -420,7 +420,7 @@ class UM_Fields {
|
||||
|
||||
} else {
|
||||
|
||||
if ( isset( $ultimatemember->form->post_form[$key] ) &&$value == $ultimatemember->form->post_form[$key] ) {
|
||||
if ( isset( $ultimatemember->form->post_form[$key] ) && $value == $ultimatemember->form->post_form[$key] ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1387,7 +1387,7 @@ class UM_Fields {
|
||||
}
|
||||
|
||||
$output .= '<option value="'.$option_value.'" ';
|
||||
if ( $this->is_selected($key, $option_value, $data) ) {
|
||||
if ( $this->is_selected($form_key, $option_value, $data) ) {
|
||||
$output.= 'selected';
|
||||
}
|
||||
$output .= '>'.$v.'</option>';
|
||||
|
||||
Reference in New Issue
Block a user