mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-06-05 15:09:37 +09:00
- fixed PHP notices/warnings;
This commit is contained in:
@@ -40,6 +40,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Metabox' ) ) {
|
|||||||
function __construct() {
|
function __construct() {
|
||||||
$this->in_edit = false;
|
$this->in_edit = false;
|
||||||
$this->edit_mode_value = null;
|
$this->edit_mode_value = null;
|
||||||
|
$this->edit_array = [];
|
||||||
|
|
||||||
add_action( 'admin_head', array( &$this, 'admin_head' ), 9);
|
add_action( 'admin_head', array( &$this, 'admin_head' ), 9);
|
||||||
add_action( 'admin_footer', array( &$this, 'load_modal_content' ), 9);
|
add_action( 'admin_footer', array( &$this, 'load_modal_content' ), 9);
|
||||||
@@ -1233,7 +1234,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Metabox' ) ) {
|
|||||||
|
|
||||||
if ( $this->in_edit == true ) { // we're editing a field
|
if ( $this->in_edit == true ) { // we're editing a field
|
||||||
$real_attr = substr( $attribute, 1 );
|
$real_attr = substr( $attribute, 1 );
|
||||||
$this->edit_mode_value = (isset( $this->edit_array[ $real_attr ] ) ) ? $this->edit_array[ $real_attr ] : null;
|
$this->edit_mode_value = isset( $this->edit_array[ $real_attr ] ) ? $this->edit_array[ $real_attr ] : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ( $attribute ) {
|
switch ( $attribute ) {
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ if ( ! class_exists( 'um\core\Roles_Capabilities' ) ) {
|
|||||||
function um_on_roles_update( $option, $old_value, $value ) {
|
function um_on_roles_update( $option, $old_value, $value ) {
|
||||||
global $wp_roles;
|
global $wp_roles;
|
||||||
|
|
||||||
if ( isset( $wp_roles->role_key ) && $option == $wp_roles->role_key ) {
|
if ( is_object( $wp_roles ) && isset( $wp_roles->role_key ) && $option == $wp_roles->role_key ) {
|
||||||
foreach ( $value as $role_key => $role_data ) {
|
foreach ( $value as $role_key => $role_data ) {
|
||||||
$role_keys = get_option( 'um_roles', array() );
|
$role_keys = get_option( 'um_roles', array() );
|
||||||
$role_keys = array_map( function( $item ) {
|
$role_keys = array_map( function( $item ) {
|
||||||
|
|||||||
@@ -536,13 +536,21 @@ function um_submit_form_errors_hook_( $args ) {
|
|||||||
|
|
||||||
if ( isset( $array['min_chars'] ) && $array['min_chars'] > 0 ) {
|
if ( isset( $array['min_chars'] ) && $array['min_chars'] > 0 ) {
|
||||||
if ( $args[ $key ] && strlen( utf8_decode( $args[ $key ] ) ) < $array['min_chars'] ) {
|
if ( $args[ $key ] && strlen( utf8_decode( $args[ $key ] ) ) < $array['min_chars'] ) {
|
||||||
UM()->form()->add_error( $key, sprintf( __( 'Your %s must contain at least %s characters', 'ultimate-member' ), $array['label'], $array['min_chars'] ) );
|
if ( empty( $array['label'] ) ) {
|
||||||
|
UM()->form()->add_error( $key, sprintf( __( 'This field must contain at least %s characters', 'ultimate-member' ), $array['min_chars'] ) );
|
||||||
|
} else {
|
||||||
|
UM()->form()->add_error( $key, sprintf( __( 'Your %s must contain at least %s characters', 'ultimate-member' ), $array['label'], $array['min_chars'] ) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isset( $array['max_chars'] ) && $array['max_chars'] > 0 ) {
|
if ( isset( $array['max_chars'] ) && $array['max_chars'] > 0 ) {
|
||||||
if ( $args[ $key ] && strlen( utf8_decode( $args[ $key ] ) ) > $array['max_chars'] ) {
|
if ( $args[ $key ] && strlen( utf8_decode( $args[ $key ] ) ) > $array['max_chars'] ) {
|
||||||
UM()->form()->add_error( $key, sprintf( __( 'Your %s must contain less than %s characters', 'ultimate-member' ), $array['label'], $array['max_chars'] ) );
|
if ( empty( $array['label'] ) ) {
|
||||||
|
UM()->form()->add_error( $key, sprintf( __( 'This field must contain less than %s characters', 'ultimate-member' ), $array['max_chars'] ) );
|
||||||
|
} else {
|
||||||
|
UM()->form()->add_error( $key, sprintf( __( 'Your %s must contain less than %s characters', 'ultimate-member' ), $array['label'], $array['max_chars'] ) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user