mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-07-11 18:56:10 +09:00
- using slashes in the callback function setting of the dropdown fields;
This commit is contained in:
@@ -144,18 +144,20 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
||||
|
||||
$fields[ $id ] = $args;
|
||||
|
||||
if ( array_key_exists( 'custom_dropdown_options_source', $args ) && function_exists( $args['custom_dropdown_options_source'] ) ) {
|
||||
$allowed_callbacks = UM()->options()->get( 'allowed_choice_callbacks' );
|
||||
if ( ! empty( $allowed_callbacks ) ) {
|
||||
$allowed_callbacks = array_map( 'rtrim', explode( "\n", $allowed_callbacks ) );
|
||||
$allowed_callbacks[] = $args['custom_dropdown_options_source'];
|
||||
} else {
|
||||
$allowed_callbacks = array( $args['custom_dropdown_options_source'] );
|
||||
}
|
||||
$allowed_callbacks = array_unique( $allowed_callbacks );
|
||||
$allowed_callbacks = implode( "\r\n", $allowed_callbacks );
|
||||
if ( array_key_exists( 'custom_dropdown_options_source', $args ) ) {
|
||||
if ( function_exists( wp_unslash( $args['custom_dropdown_options_source'] ) ) ) {
|
||||
$allowed_callbacks = UM()->options()->get( 'allowed_choice_callbacks' );
|
||||
if ( ! empty( $allowed_callbacks ) ) {
|
||||
$allowed_callbacks = array_map( 'rtrim', explode( "\n", $allowed_callbacks ) );
|
||||
$allowed_callbacks[] = $args['custom_dropdown_options_source'];
|
||||
} else {
|
||||
$allowed_callbacks = array( $args['custom_dropdown_options_source'] );
|
||||
}
|
||||
$allowed_callbacks = array_unique( $allowed_callbacks );
|
||||
$allowed_callbacks = implode( "\r\n", $allowed_callbacks );
|
||||
|
||||
UM()->options()->update( 'allowed_choice_callbacks', $allowed_callbacks );
|
||||
UM()->options()->update( 'allowed_choice_callbacks', $allowed_callbacks );
|
||||
}
|
||||
}
|
||||
|
||||
unset( $fields[ $id ]['in_row'] );
|
||||
@@ -197,22 +199,26 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
||||
$args = array_merge( UM()->builtin()->predefined_fields[ $id ], $args );
|
||||
}
|
||||
|
||||
$fields[ $id ] = $args;
|
||||
if ( array_key_exists( 'custom_dropdown_options_source', $args ) ) {
|
||||
if ( function_exists( wp_unslash( $args['custom_dropdown_options_source'] ) ) ) {
|
||||
$allowed_callbacks = UM()->options()->get( 'allowed_choice_callbacks' );
|
||||
if ( ! empty( $allowed_callbacks ) ) {
|
||||
$allowed_callbacks = array_map( 'rtrim', explode( "\n", $allowed_callbacks ) );
|
||||
$allowed_callbacks[] = $args['custom_dropdown_options_source'];
|
||||
} else {
|
||||
$allowed_callbacks = array( $args['custom_dropdown_options_source'] );
|
||||
}
|
||||
$allowed_callbacks = array_unique( $allowed_callbacks );
|
||||
$allowed_callbacks = implode( "\r\n", $allowed_callbacks );
|
||||
|
||||
if ( array_key_exists( 'custom_dropdown_options_source', $args ) && function_exists( $args['custom_dropdown_options_source'] ) ) {
|
||||
$allowed_callbacks = UM()->options()->get( 'allowed_choice_callbacks' );
|
||||
if ( ! empty( $allowed_callbacks ) ) {
|
||||
$allowed_callbacks = array_map( 'rtrim', explode( "\n", $allowed_callbacks ) );
|
||||
$allowed_callbacks[] = $args['custom_dropdown_options_source'];
|
||||
} else {
|
||||
$allowed_callbacks = array( $args['custom_dropdown_options_source'] );
|
||||
UM()->options()->update( 'allowed_choice_callbacks', $allowed_callbacks );
|
||||
|
||||
$args['custom_dropdown_options_source'] = wp_unslash( $args['custom_dropdown_options_source'] );
|
||||
}
|
||||
$allowed_callbacks = array_unique( $allowed_callbacks );
|
||||
$allowed_callbacks = implode( "\r\n", $allowed_callbacks );
|
||||
|
||||
UM()->options()->update( 'allowed_choice_callbacks', $allowed_callbacks );
|
||||
}
|
||||
|
||||
$fields[ $id ] = $args;
|
||||
|
||||
// for group field only
|
||||
if ( $args['type'] == 'group' ) {
|
||||
$fields[ $id ]['in_group'] = '';
|
||||
|
||||
Reference in New Issue
Block a user