- fixed "is_block" argument for ultimatemember shortcodes;

- added sanitize shortcode arguments functions;
This commit is contained in:
Mykyta Synelnikov
2023-09-02 00:53:51 +03:00
parent fca7b4b0d5
commit 6e9d122494
3 changed files with 19 additions and 15 deletions
+6 -2
View File
@@ -606,12 +606,16 @@ if ( ! class_exists( 'um\core\Shortcodes' ) ) {
$args = shortcode_atts(
array(
'form_id' => '',
'is_block' => 0,
'is_block' => false,
),
$args,
'ultimatemember'
);
// Sanitize shortcode arguments.
$args['form_id'] = ! empty( $args['form_id'] ) ? absint( $args['form_id'] ) : '';
$args['is_block'] = (bool) $args['is_block'];
/**
* Filters variable for enable singleton shortcode loading on the same page.
* Note: Set it to `false` if you don't need to render the same form twice or more on the same page.
@@ -779,7 +783,7 @@ if ( ! class_exists( 'um\core\Shortcodes' ) ) {
}
}
if ( isset( $args['is_block'] ) && 1 === (int) $args['is_block'] && 'profile' === $mode && ! is_user_logged_in() ) {
if ( 'profile' === $mode && ! empty( $args['is_block'] ) && ! is_user_logged_in() ) {
ob_get_clean();
return '';
}