- fix user page blocks

This commit is contained in:
ashubawork
2023-07-12 11:46:03 +03:00
parent b56573dd9b
commit 973dd64713
3 changed files with 23 additions and 3 deletions
+3
View File
@@ -15,6 +15,9 @@ if ( ! class_exists( 'um\core\Account' ) ) {
*/
class Account {
/**
* @var boolean
*/
public $account_exist = false;
/**
+7 -3
View File
@@ -167,11 +167,15 @@ if ( ! class_exists( 'um\core\Blocks' ) ) {
*/
public function forms_render( $atts ) {
if ( isset( $atts['form_id'] ) && '' !== $atts['form_id'] ) {
$mode = get_post_meta( $atts['form_id'], '_um_mode', true );
if ( 'profile' === $mode && ( um_is_core_page( 'account' ) || um_is_core_page( 'user' ) ) ) {
return '';
if ( um_is_core_page( 'account' ) ) {
if ( defined( 'REST_REQUEST' ) && REST_REQUEST ) {
return '<div class="um-block-notice">' . esc_html__( 'This block cannot be used on this page', 'ultimate-member' ) . '</div>';
} else {
return '';
}
}
}
$shortcode = '[ultimatemember is_block="1"';
if ( isset( $atts['form_id'] ) && '' !== $atts['form_id'] ) {
+13
View File
@@ -13,6 +13,11 @@ if ( ! class_exists( 'um\core\Shortcodes' ) ) {
*/
class Shortcodes {
/**
* @var array
*/
public $forms_exist = array();
/**
* @var string
*/
@@ -597,6 +602,14 @@ if ( ! class_exists( 'um\core\Shortcodes' ) ) {
* @return string
*/
public function ultimatemember( $args = array() ) {
if ( isset( $args['form_id'] ) ) {
$id = $args['form_id'];
if ( isset( $this->forms_exist[ $id ] ) && true === $this->forms_exist[ $id ] ) {
return '';
}
$this->forms_exist[ $id ] = true;
}
return $this->load( $args );
}