mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-07-18 06:03:38 +09:00
Update 1.2.2
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
}
|
||||
|
||||
if ( isset($_REQUEST['uid'])){
|
||||
$uid = $_REQUEST['uid'];
|
||||
$uid = $_REQUEST['uid'];
|
||||
}
|
||||
|
||||
switch( $_REQUEST['um_action'] ) {
|
||||
@@ -26,7 +26,7 @@
|
||||
$uid = ( isset( $_REQUEST['uid'] ) ) ? $_REQUEST['uid'] : 0;
|
||||
do_action('um_action_user_request_hook', $_REQUEST['um_action'], $uid);
|
||||
break;
|
||||
|
||||
|
||||
case 'edit':
|
||||
$ultimatemember->fields->editing = true;
|
||||
if ( !um_can_edit_my_profile() ) {
|
||||
@@ -35,6 +35,12 @@
|
||||
}
|
||||
break;
|
||||
|
||||
case 'um_switch_user':
|
||||
if ( !current_user_can('delete_users') ) return;
|
||||
$ultimatemember->user->auto_login( $_REQUEST['uid'] );
|
||||
exit( wp_redirect( $ultimatemember->permalinks->get_current_url( true ) ) );
|
||||
break;
|
||||
|
||||
case 'um_reject_membership':
|
||||
um_fetch_user( $uid );
|
||||
$ultimatemember->user->reject();
|
||||
|
||||
@@ -156,7 +156,11 @@
|
||||
foreach( $fields as $key => $array ) {
|
||||
|
||||
if ( isset( $array['type'] ) && $array['type'] == 'checkbox' && isset( $array['required'] ) && $array['required'] == 1 && !isset( $args[$key] ) ) {
|
||||
$ultimatemember->form->add_error($key, sprintf(__('You must check %s.','ultimatemember'), $array['title'] ) );
|
||||
$ultimatemember->form->add_error($key, sprintf(__('%s is required.','ultimatemember'), $array['title'] ) );
|
||||
}
|
||||
|
||||
if ( isset( $array['type'] ) && $array['type'] == 'radio' && isset( $array['required'] ) && $array['required'] == 1 && !isset( $args[$key] ) ) {
|
||||
$ultimatemember->form->add_error($key, sprintf(__('%s is required.','ultimatemember'), $array['title'] ) );
|
||||
}
|
||||
|
||||
if ( $key == 'role_select' || $key == 'role_radio' ) {
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
exit( wp_redirect( $redirect ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Register screen
|
||||
if ( isset( $pagenow ) && $pagenow == 'wp-login.php' && !is_user_logged_in() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'register' ) {
|
||||
|
||||
@@ -52,6 +52,22 @@
|
||||
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() ) {
|
||||
|
||||
if ( !um_user('can_access_wpadmin') ) {
|
||||
exit( wp_redirect( home_url() ) );
|
||||
} else {
|
||||
exit( wp_redirect( admin_url() ) );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
+23
-6
@@ -30,6 +30,17 @@ class UM_Builtin {
|
||||
return false;
|
||||
}
|
||||
|
||||
/***
|
||||
*** @get a field
|
||||
***/
|
||||
function get_a_field( $field ) {
|
||||
$fields = $this->all_user_fields;
|
||||
if ( isset( $fields[$field] ) ) {
|
||||
return $fields[$field];
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
/***
|
||||
*** @get specific fields
|
||||
***/
|
||||
@@ -576,7 +587,7 @@ class UM_Builtin {
|
||||
),
|
||||
|
||||
'country' => array(
|
||||
'title' => __('Countries','ultimatemember'),
|
||||
'title' => __('Country','ultimatemember'),
|
||||
'metakey' => 'country',
|
||||
'type' => 'select',
|
||||
'label' => __('Country','ultimatemember'),
|
||||
@@ -929,16 +940,20 @@ class UM_Builtin {
|
||||
/***
|
||||
*** @may be used to show a dropdown, or source for user meta
|
||||
***/
|
||||
function all_user_fields( $exclude_types = null ) {
|
||||
function all_user_fields( $exclude_types = null, $show_all = false ) {
|
||||
|
||||
global $ultimatemember;
|
||||
|
||||
$fields_without_metakey = array('block','shortcode','spacing','divider','group');
|
||||
$fields_without_metakey = apply_filters('um_fields_without_metakey', $fields_without_metakey );
|
||||
|
||||
$this->fields_dropdown = array('image','file','password','textarea','rating');
|
||||
$this->fields_dropdown = array_merge( $this->fields_dropdown, $fields_without_metakey );
|
||||
|
||||
if ( !$show_all ) {
|
||||
$this->fields_dropdown = array('image','file','password','textarea','rating');
|
||||
$this->fields_dropdown = array_merge( $this->fields_dropdown, $fields_without_metakey );
|
||||
} else {
|
||||
$this->fields_dropdown = $fields_without_metakey;
|
||||
}
|
||||
|
||||
$custom = $this->custom_fields;
|
||||
$predefined = $this->predefined_fields;
|
||||
|
||||
@@ -968,7 +983,9 @@ class UM_Builtin {
|
||||
unset( $all[$k] );
|
||||
}
|
||||
if ( isset( $arr['account_only'] ) || isset( $arr['private_use'] ) ) {
|
||||
unset( $all[$k] );
|
||||
if ( !$show_all ) {
|
||||
unset( $all[$k] );
|
||||
}
|
||||
}
|
||||
if ( isset( $arr['type'] ) && in_array( $arr['type'], $this->fields_dropdown ) ) {
|
||||
unset( $all[$k] );
|
||||
|
||||
@@ -136,6 +136,8 @@ class UM_Enqueue {
|
||||
$this->load_datetimepicker();
|
||||
|
||||
$this->load_raty();
|
||||
|
||||
$this->load_scrollbar();
|
||||
|
||||
$this->load_imagecrop();
|
||||
|
||||
@@ -285,6 +287,19 @@ class UM_Enqueue {
|
||||
|
||||
}
|
||||
|
||||
/***
|
||||
*** @Load scrollbar
|
||||
***/
|
||||
function load_scrollbar(){
|
||||
|
||||
wp_register_script('um_scrollbar', um_url . 'assets/js/um-scrollbar.js' );
|
||||
wp_enqueue_script('um_scrollbar');
|
||||
|
||||
wp_register_style('um_scrollbar', um_url . 'assets/css/um-scrollbar.css' );
|
||||
wp_enqueue_style('um_scrollbar');
|
||||
|
||||
}
|
||||
|
||||
/***
|
||||
*** @Load rating
|
||||
***/
|
||||
|
||||
+20
-5
@@ -299,10 +299,12 @@ class UM_Fields {
|
||||
if ( isset( $data['help'] ) && !empty( $data['help'] ) && $this->viewing == false && !strstr($key, 'confirm_user_pass') ) {
|
||||
|
||||
if ( !$ultimatemember->mobile->isMobile() ) {
|
||||
$output .= '<span class="um-tip um-tip-w" title="'.$data['help'].'"><i class="um-icon-help-circled"></i></span>';
|
||||
if ( !isset( $this->disable_tooltips ) ) {
|
||||
$output .= '<span class="um-tip um-tip-w" title="'.$data['help'].'"><i class="um-icon-help-circled"></i></span>';
|
||||
}
|
||||
}
|
||||
|
||||
if ( $ultimatemember->mobile->isMobile() ) {
|
||||
if ( $ultimatemember->mobile->isMobile() || isset( $this->disable_tooltips ) ) {
|
||||
$output .= '<span class="um-tip-text">'. $data['help'] . '</span>';
|
||||
}
|
||||
|
||||
@@ -339,7 +341,7 @@ class UM_Fields {
|
||||
$classes .= 'um-timepicker ';
|
||||
}
|
||||
|
||||
if ( isset($data['icon']) && $data['icon'] && $this->field_icons == 'field' ) {
|
||||
if ( isset($data['icon']) && $data['icon'] && isset( $this->field_icons ) && $this->field_icons == 'field' ) {
|
||||
$classes .= 'um-iconed';
|
||||
}
|
||||
|
||||
@@ -514,6 +516,19 @@ class UM_Fields {
|
||||
return '';
|
||||
}
|
||||
|
||||
/***
|
||||
*** @Get Field Title
|
||||
***/
|
||||
function get_field_title( $key ) {
|
||||
global $ultimatemember;
|
||||
$fields = $ultimatemember->builtin->all_user_fields;
|
||||
if ( isset( $fields[$key]['title'] ) )
|
||||
return $fields[$key]['title'];
|
||||
if ( isset( $fields[$key]['label'] ) )
|
||||
return $fields[$key]['label'];
|
||||
return __('Custom Field','ultimatemember');
|
||||
}
|
||||
|
||||
/***
|
||||
*** @Get form fields
|
||||
***/
|
||||
@@ -534,7 +549,7 @@ class UM_Fields {
|
||||
if ( isset( $fields ) && is_array( $fields ) && isset( $fields[$key] ) ) {
|
||||
$array = $fields[$key];
|
||||
} else {
|
||||
$array = $ultimatemember->builtin->predefined_fields[$key];
|
||||
$array = (isset( $ultimatemember->builtin->predefined_fields[$key] ) ) ? $ultimatemember->builtin->predefined_fields[$key] : $ultimatemember->builtin->all_user_fields[$key];
|
||||
}
|
||||
|
||||
$array['classes'] = null;
|
||||
@@ -1069,7 +1084,7 @@ class UM_Fields {
|
||||
|
||||
$output .= '<div class="um-field-area">';
|
||||
|
||||
if ( isset($icon) && $icon && $this->field_icons == 'field' ) {
|
||||
if ( isset($icon) && $icon && isset($this->field_icons) && $this->field_icons == 'field' ) {
|
||||
|
||||
$output .= '<div class="um-field-icon"><i class="'.$icon.'"></i></div>';
|
||||
|
||||
|
||||
@@ -60,6 +60,10 @@
|
||||
|
||||
}
|
||||
|
||||
if ( current_user_can('delete_users') ) {
|
||||
$actions['um_switch_user'] = array( 'label' => __('Login as this user','ultimatemember') );
|
||||
}
|
||||
|
||||
um_fetch_user( um_profile_id() );
|
||||
|
||||
return $actions;
|
||||
|
||||
@@ -207,6 +207,10 @@ class UM_Query {
|
||||
function role_data( $role_slug ) {
|
||||
global $wpdb, $ultimatemember;
|
||||
|
||||
if ( get_option("um_cached_role_{$role_slug}") ) {
|
||||
return get_option("um_cached_role_{$role_slug}");
|
||||
}
|
||||
|
||||
if ($role_slug == 'admin' || $role_slug == 'member'){
|
||||
$try = $this->find_post_id('um_role','_um_core',$role_slug);
|
||||
if ( isset( $try ) ){
|
||||
@@ -235,6 +239,10 @@ class UM_Query {
|
||||
$array = $ultimatemember->setup->get_initial_permissions( $role_slug );
|
||||
|
||||
}
|
||||
|
||||
if ( !get_option("um_cached_role_{$role_slug}") ) {
|
||||
update_option("um_cached_role_{$role_slug}", $array );
|
||||
}
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
+1
-3
@@ -59,9 +59,7 @@ class UM_Rewrite {
|
||||
flush_rewrite_rules( true );
|
||||
update_option('um_flush_rules', true);
|
||||
}
|
||||
|
||||
flush_rewrite_rules( true );
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -62,7 +62,9 @@ class UM_Setup {
|
||||
'_um_secondary_btn_hover',
|
||||
'_um_secondary_btn_text',
|
||||
'_um_form_border',
|
||||
'_um_form_border_hover',
|
||||
'_um_form_bg_color',
|
||||
'_um_form_bg_color_focus',
|
||||
'_um_form_placeholder',
|
||||
'_um_form_icon_color',
|
||||
'_um_form_asterisk_color',
|
||||
@@ -82,8 +84,10 @@ class UM_Setup {
|
||||
'_um_form_icon_color' => '#aaa',
|
||||
'_um_form_asterisk_color' => '#aaa',
|
||||
'_um_form_bg_color' => '#fff',
|
||||
'_um_form_bg_color_focus' => '#fff',
|
||||
'_um_form_placeholder' => '#aaa',
|
||||
'_um_form_border' => '2px solid #ddd',
|
||||
'_um_form_border_hover' => '2px solid #bbb',
|
||||
'_um_primary_btn_color' => '#3ba1da',
|
||||
'_um_primary_btn_hover' => '#44b0ec',
|
||||
'_um_primary_btn_text' => '#fff',
|
||||
|
||||
@@ -647,7 +647,8 @@ function um_reset_user() {
|
||||
***/
|
||||
function um_edit_profile_url(){
|
||||
global $ultimatemember;
|
||||
$url = remove_query_arg('profiletab');
|
||||
$url = um_get_core_page('user');
|
||||
$url = remove_query_arg('profiletab', $url);
|
||||
$url = remove_query_arg('subnav', $url);
|
||||
$url = add_query_arg('profiletab', 'main',$url);
|
||||
$url = add_query_arg('um_action','edit', $url);
|
||||
|
||||
Reference in New Issue
Block a user