mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-06-05 15:09:37 +09:00
- fix user page blocks
This commit is contained in:
@@ -15,6 +15,9 @@ if ( ! class_exists( 'um\core\Account' ) ) {
|
||||
*/
|
||||
class Account {
|
||||
|
||||
/**
|
||||
* @var boolean
|
||||
*/
|
||||
public $account_exist = false;
|
||||
|
||||
/**
|
||||
|
||||
@@ -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,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 );
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user