mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-07-11 18:56:10 +09:00
- fixed saving Access admin settings;
This commit is contained in:
@@ -83,6 +83,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
|
||||
add_action( 'um_settings_before_save', array( $this, 'before_licenses_save' ) );
|
||||
add_action( 'um_settings_save', array( $this, 'licenses_save' ) );
|
||||
|
||||
add_filter( 'um_change_settings_before_save', array( $this, 'set_default_if_empty' ), 9, 1 );
|
||||
add_filter( 'um_change_settings_before_save', array( $this, 'remove_empty_values' ), 10, 1 );
|
||||
|
||||
add_action( 'admin_init', array( &$this, 'um_download_install_info' ) );
|
||||
@@ -487,7 +488,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
|
||||
'tooltip' => __( 'Here you can exclude URLs beside the redirect URI to be accessible to everyone', 'ultimate-member' ),
|
||||
'add_text' => __( 'Add New URL', 'ultimate-member' ),
|
||||
'conditional' => array( 'accessible', '=', 2 ),
|
||||
'show_default_number' => 1,
|
||||
'show_default_number' => 0,
|
||||
),
|
||||
array(
|
||||
'id' => 'home_page_accessible',
|
||||
@@ -2204,6 +2205,28 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
|
||||
}
|
||||
|
||||
|
||||
function set_default_if_empty( $settings ) {
|
||||
$tab = '';
|
||||
if ( ! empty( $_GET['tab'] ) ) {
|
||||
$tab = sanitize_key( $_GET['tab'] );
|
||||
}
|
||||
|
||||
$section = '';
|
||||
if ( ! empty( $_GET['section'] ) ) {
|
||||
$section = sanitize_key( $_GET['section'] );
|
||||
}
|
||||
|
||||
|
||||
if ( 'access' === $tab && empty( $section ) ) {
|
||||
if ( ! array_key_exists( 'access_exclude_uris', $settings ) ) {
|
||||
$settings['access_exclude_uris'] = array();
|
||||
}
|
||||
}
|
||||
|
||||
return $settings;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Remove empty values from multi text fields
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user