diff --git a/includes/core/class-shortcodes.php b/includes/core/class-shortcodes.php
index bd5c5ddd..4f04b5fb 100644
--- a/includes/core/class-shortcodes.php
+++ b/includes/core/class-shortcodes.php
@@ -392,21 +392,18 @@ if ( ! class_exists( 'um\core\Shortcodes' ) ) {
return $classes;
}
-
/**
* Logged-in only content
*
- * @param array $args
+ * @param array $args
* @param string $content
*
* @return string
*/
- function um_loggedin( $args = array(), $content = "" ) {
- ob_start();
-
+ public function um_loggedin( $args = array(), $content = '' ) {
$args = shortcode_atts(
array(
- 'lock_text' => __( 'This content has been restricted to logged in users only. Please login to view this content.', 'ultimate-member' ),
+ 'lock_text' => __( 'This content has been restricted to logged-in users only. Please login to view this content.', 'ultimate-member' ),
'show_lock' => 'yes',
),
$args,
@@ -414,50 +411,32 @@ if ( ! class_exists( 'um\core\Shortcodes' ) ) {
);
if ( ! is_user_logged_in() ) {
+ // Hide content for not logged-in users. Maybe display locked content notice.
if ( 'no' === $args['show_lock'] ) {
- echo '';
- } else {
- $args['lock_text'] = $this->convert_locker_tags( $args['lock_text'] );
- UM()->get_template( 'login-to-view.php', '', $args, true );
- }
- } else {
- if ( version_compare( get_bloginfo('version'),'5.4', '<' ) ) {
- echo do_shortcode( $this->convert_locker_tags( wpautop( $content ) ) );
- } else {
- echo apply_shortcodes( $this->convert_locker_tags( wpautop( $content ) ) );
+ return '';
}
+
+ $args['lock_text'] = $this->convert_locker_tags( $args['lock_text'] );
+ return UM()->get_template( 'login-to-view.php', '', $args );
}
- $output = ob_get_clean();
-
- return htmlspecialchars_decode( $output, ENT_NOQUOTES );
+ return apply_shortcodes( $this->convert_locker_tags( wpautop( $content ) ) );
}
-
/**
* Logged-out only content
*
- * @param array $args
+ * @param array $args
* @param string $content
*
* @return string
*/
- function um_loggedout( $args = array(), $content = '' ) {
- ob_start();
-
- // Hide for logged in users
+ public function um_loggedout( $args = array(), $content = '' ) {
if ( is_user_logged_in() ) {
- echo '';
- } else {
- if ( version_compare( get_bloginfo('version'),'5.4', '<' ) ) {
- echo do_shortcode( wpautop( $content ) );
- } else {
- echo apply_shortcodes( wpautop( $content ) );
- }
+ // Hide for logged-in users
+ return '';
}
-
- $output = ob_get_clean();
- return $output;
+ return apply_shortcodes( $this->convert_locker_tags( wpautop( $content ) ) );
}
/**
@@ -1192,9 +1171,9 @@ if ( ! class_exists( 'um\core\Shortcodes' ) ) {
*
* @return mixed|string
*/
- function convert_locker_tags( $str ) {
- add_filter( 'um_template_tags_patterns_hook', array( &$this, 'add_placeholder' ), 10, 1 );
- add_filter( 'um_template_tags_replaces_hook', array( &$this, 'add_replace_placeholder' ), 10, 1 );
+ public function convert_locker_tags( $str ) {
+ add_filter( 'um_template_tags_patterns_hook', array( &$this, 'add_placeholder' ) );
+ add_filter( 'um_template_tags_replaces_hook', array( &$this, 'add_replace_placeholder' ) );
return um_convert_tags( $str, array(), false );
}
@@ -1319,18 +1298,22 @@ if ( ! class_exists( 'um\core\Shortcodes' ) ) {
* @param string $content
* @return string
*/
- function um_shortcode_show_content_for_role( $atts = array() , $content = '' ) {
+ public function um_shortcode_show_content_for_role( $atts = array(), $content = '' ) {
global $user_ID;
if ( ! is_user_logged_in() ) {
- return;
+ return '';
}
- $a = shortcode_atts( array(
- 'roles' => '',
- 'not' => '',
- 'is_profile' => false,
- ), $atts );
+ $a = shortcode_atts(
+ array(
+ 'roles' => '',
+ 'not' => '',
+ 'is_profile' => false,
+ ),
+ $atts,
+ 'um_show_content'
+ );
if ( $a['is_profile'] ) {
um_fetch_user( um_profile_id() );
@@ -1341,39 +1324,26 @@ if ( ! class_exists( 'um\core\Shortcodes' ) ) {
$current_user_roles = um_user( 'roles' );
if ( ! empty( $a['not'] ) && ! empty( $a['roles'] ) ) {
- if ( version_compare( get_bloginfo('version'),'5.4', '<' ) ) {
- return do_shortcode( $this->convert_locker_tags( $content ) );
- } else {
- return apply_shortcodes( $this->convert_locker_tags( $content ) );
- }
+ return apply_shortcodes( $this->convert_locker_tags( $content ) );
}
if ( ! empty( $a['not'] ) ) {
- $not_in_roles = explode( ",", $a['not'] );
+ $not_in_roles = explode( ',', $a['not'] );
if ( is_array( $not_in_roles ) && ( empty( $current_user_roles ) || count( array_intersect( $current_user_roles, $not_in_roles ) ) <= 0 ) ) {
- if ( version_compare( get_bloginfo('version'),'5.4', '<' ) ) {
- return do_shortcode( $this->convert_locker_tags( $content ) );
- } else {
- return apply_shortcodes( $this->convert_locker_tags( $content ) );
- }
+ return apply_shortcodes( $this->convert_locker_tags( $content ) );
}
} else {
- $roles = explode( ",", $a['roles'] );
+ $roles = explode( ',', $a['roles'] );
if ( ! empty( $current_user_roles ) && is_array( $roles ) && count( array_intersect( $current_user_roles, $roles ) ) > 0 ) {
- if ( version_compare( get_bloginfo('version'),'5.4', '<' ) ) {
- return do_shortcode( $this->convert_locker_tags( $content ) );
- } else {
- return apply_shortcodes( $this->convert_locker_tags( $content ) );
- }
+ return apply_shortcodes( $this->convert_locker_tags( $content ) );
}
}
return '';
}
-
/**
* @param array $args
* @param string $content
@@ -1426,36 +1396,36 @@ if ( ! class_exists( 'um\core\Shortcodes' ) ) {
$search_value = array_values( $query );
- $template = UM()->get_template( 'searchform.php', '', array( 'query' => $query, 'search_value' => $search_value[0], 'members_page' => um_get_core_page( 'members' ) ) );
-
- return $template;
+ $t_args = array(
+ 'query' => $query,
+ 'search_value' => $search_value[0],
+ 'members_page' => um_get_core_page( 'members' ),
+ );
+ return UM()->get_template( 'searchform.php', '', $t_args );
}
-
/**
* UM Placeholders for login referrer
*
- * @param $placeholders
+ * @param array $placeholders
*
* @return array
*/
- function add_placeholder( $placeholders ) {
+ public function add_placeholder( $placeholders ) {
$placeholders[] = '{login_referrer}';
return $placeholders;
}
-
/**
* UM Replace Placeholders for login referrer
*
- * @param $replace_placeholders
+ * @param array $replace_placeholders
*
* @return array
*/
- function add_replace_placeholder( $replace_placeholders ) {
+ public function add_replace_placeholder( $replace_placeholders ) {
$replace_placeholders[] = um_dynamic_login_page_redirect();
return $replace_placeholders;
}
-
}
}
diff --git a/includes/um-short-functions.php b/includes/um-short-functions.php
index b4179d30..1a8bf60c 100644
--- a/includes/um-short-functions.php
+++ b/includes/um-short-functions.php
@@ -120,7 +120,6 @@ function um_replace_placeholders() {
'{user_account_link}',
);
-
/**
* UM hook
*
diff --git a/templates/account.php b/templates/account.php
index 58be0bc9..aa7c5d99 100644
--- a/templates/account.php
+++ b/templates/account.php
@@ -2,7 +2,7 @@
/**
* Template for the account page
*
- * This template can be overridden by copying it to yourtheme/ultimate-member/templates/account.php
+ * This template can be overridden by copying it to your-theme/ultimate-member/templates/account.php
*
* Page: "Account"
*
diff --git a/templates/gdpr-register.php b/templates/gdpr-register.php
index 64202327..c89e43b7 100644
--- a/templates/gdpr-register.php
+++ b/templates/gdpr-register.php
@@ -2,7 +2,7 @@
/**
* Template for the GDPR checkbox in register form
*
- * This template can be overridden by copying it to yourtheme/ultimate-member/templates/gdpr-register.php
+ * This template can be overridden by copying it to your-theme/ultimate-member/templates/gdpr-register.php
*
* Page: "Register"
* Call: function display_option()
diff --git a/templates/login-to-view.php b/templates/login-to-view.php
index aaf5e87b..829cd560 100644
--- a/templates/login-to-view.php
+++ b/templates/login-to-view.php
@@ -2,20 +2,18 @@
/**
* Template for the login only content, locked message
*
- * This template can be overridden by copying it to yourtheme/ultimate-member/login-to-view.php
+ * This template can be overridden by copying it to your-theme/ultimate-member/login-to-view.php
*
* Call: function um_loggedin()
*
- * @version 2.6.1
+ * @version 2.8.7
*
* @var string $lock_text
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
-} ?>
-
+}
+?>
-
-
-
+
get_allowed_html( 'templates' ) ); ?>
diff --git a/templates/login.php b/templates/login.php
index cacb42e6..180d38d8 100644
--- a/templates/login.php
+++ b/templates/login.php
@@ -2,7 +2,7 @@
/**
* Template for the login form
*
- * This template can be overridden by copying it to yourtheme/ultimate-member/templates/login.php
+ * This template can be overridden by copying it to your-theme/ultimate-member/templates/login.php
*
* Page: "Login"
*
diff --git a/templates/logout.php b/templates/logout.php
index 2857ab80..b87c1eae 100644
--- a/templates/logout.php
+++ b/templates/logout.php
@@ -2,7 +2,7 @@
/**
* Template for the logout
*
- * This template can be overridden by copying it to yourtheme/ultimate-member/templates/logout.php
+ * This template can be overridden by copying it to your-theme/ultimate-member/templates/logout.php
*
* Page: "Logout"
*
diff --git a/templates/members-grid.php b/templates/members-grid.php
index 0b326965..e6e02c15 100644
--- a/templates/members-grid.php
+++ b/templates/members-grid.php
@@ -2,7 +2,7 @@
/**
* Template for the members directory grid
*
- * This template can be overridden by copying it to yourtheme/ultimate-member/members-grid.php
+ * This template can be overridden by copying it to your-theme/ultimate-member/members-grid.php
*
* Page: "Members"
*
diff --git a/templates/members-header.php b/templates/members-header.php
index 4e0b1875..331aa4f6 100644
--- a/templates/members-header.php
+++ b/templates/members-header.php
@@ -2,7 +2,7 @@
/**
* Template for the members directory header JS-template
*
- * This template can be overridden by copying it to yourtheme/ultimate-member/members-header.php
+ * This template can be overridden by copying it to your-theme/ultimate-member/members-header.php
*
* Page: "Members"
*
diff --git a/templates/members-list.php b/templates/members-list.php
index 78f2f6b7..5c92bf38 100644
--- a/templates/members-list.php
+++ b/templates/members-list.php
@@ -2,7 +2,7 @@
/**
* Template for the members directory list
*
- * This template can be overridden by copying it to yourtheme/ultimate-member/members-list.php
+ * This template can be overridden by copying it to your-theme/ultimate-member/members-list.php
*
* Page: "Members"
*
diff --git a/templates/members-pagination.php b/templates/members-pagination.php
index f1664b5f..e3cbf0ce 100644
--- a/templates/members-pagination.php
+++ b/templates/members-pagination.php
@@ -2,7 +2,7 @@
/**
* Template for the members directory pagination JS template
*
- * This template can be overridden by copying it to yourtheme/ultimate-member/members-pagination.php
+ * This template can be overridden by copying it to your-theme/ultimate-member/members-pagination.php
*
* Page: "Members"
*
diff --git a/templates/members.php b/templates/members.php
index c1ba9c6b..88c74c79 100644
--- a/templates/members.php
+++ b/templates/members.php
@@ -2,7 +2,7 @@
/**
* Template for the members directory
*
- * This template can be overridden by copying it to yourtheme/ultimate-member/templates/members.php
+ * This template can be overridden by copying it to your-theme/ultimate-member/templates/members.php
*
* Page: "Members"
*
diff --git a/templates/message.php b/templates/message.php
index d48a05de..c7b1e8f1 100644
--- a/templates/message.php
+++ b/templates/message.php
@@ -2,7 +2,7 @@
/**
* Template for the message after registration process
*
- * This template can be overridden by copying it to yourtheme/ultimate-member/templates/message.php
+ * This template can be overridden by copying it to your-theme/ultimate-member/templates/message.php
*
* Call: function parse_shortcode_args()
*
diff --git a/templates/modal/upload-single.php b/templates/modal/upload-single.php
index d6c6b701..f071477b 100644
--- a/templates/modal/upload-single.php
+++ b/templates/modal/upload-single.php
@@ -2,7 +2,7 @@
/**
* Template for the modal form
*
- * This template can be overridden by copying it to yourtheme/ultimate-member/modal/upload-single.php
+ * This template can be overridden by copying it to your-theme/ultimate-member/modal/upload-single.php
*
* @version 2.8.6
*/
diff --git a/templates/modal/view-photo.php b/templates/modal/view-photo.php
index 0ec49f81..d0ef6fbc 100644
--- a/templates/modal/view-photo.php
+++ b/templates/modal/view-photo.php
@@ -2,7 +2,7 @@
/**
* Template for the modal photo
*
- * This template can be overridden by copying it to yourtheme/ultimate-member/modal/view-photo.php
+ * This template can be overridden by copying it to your-theme/ultimate-member/modal/view-photo.php
*
* @version 2.8.6
*/
diff --git a/templates/password-change.php b/templates/password-change.php
index 6ad5b9c1..185ea490 100644
--- a/templates/password-change.php
+++ b/templates/password-change.php
@@ -2,7 +2,7 @@
/**
* Template for the password change
*
- * This template can be overridden by copying it to yourtheme/ultimate-member/templates/password-change.php
+ * This template can be overridden by copying it to your-theme/ultimate-member/templates/password-change.php
*
* Call: function ultimatemember_password()
*
diff --git a/templates/password-reset.php b/templates/password-reset.php
index 33b61756..6dcf9cb8 100644
--- a/templates/password-reset.php
+++ b/templates/password-reset.php
@@ -2,7 +2,7 @@
/**
* Template for the password reset
*
- * This template can be overridden by copying it to yourtheme/ultimate-member/templates/password-reset.php
+ * This template can be overridden by copying it to your-theme/ultimate-member/templates/password-reset.php
*
* Call: function ultimatemember_password()
*
diff --git a/templates/profile.php b/templates/profile.php
index 5c0cdefc..de84b96a 100644
--- a/templates/profile.php
+++ b/templates/profile.php
@@ -2,7 +2,7 @@
/**
* Template for the profile page
*
- * This template can be overridden by copying it to yourtheme/ultimate-member/templates/profile.php
+ * This template can be overridden by copying it to your-theme/ultimate-member/templates/profile.php
*
* Page: "Profile"
*
diff --git a/templates/profile/comments-single.php b/templates/profile/comments-single.php
index c6d635a6..a507987e 100644
--- a/templates/profile/comments-single.php
+++ b/templates/profile/comments-single.php
@@ -2,7 +2,7 @@
/**
* Template for the profile single comments
*
- * This template can be overridden by copying it to yourtheme/ultimate-member/profile/comments-single.php
+ * This template can be overridden by copying it to your-theme/ultimate-member/profile/comments-single.php
*
* Page: "Profile"
*
diff --git a/templates/profile/comments.php b/templates/profile/comments.php
index 7535a0ad..349fdb51 100644
--- a/templates/profile/comments.php
+++ b/templates/profile/comments.php
@@ -2,7 +2,7 @@
/**
* Template for the profile comments
*
- * This template can be overridden by copying it to yourtheme/ultimate-member/profile/comments.php
+ * This template can be overridden by copying it to your-theme/ultimate-member/profile/comments.php
*
* Page: "Profile"
* Call: function add_comments(), function load_comments()
diff --git a/templates/profile/posts-single.php b/templates/profile/posts-single.php
index ac81db3a..0f829839 100644
--- a/templates/profile/posts-single.php
+++ b/templates/profile/posts-single.php
@@ -2,7 +2,7 @@
/**
* Template for the profile single post
*
- * This template can be overridden by copying it to yourtheme/ultimate-member/profile/posts-single.php
+ * This template can be overridden by copying it to your-theme/ultimate-member/profile/posts-single.php
*
* Page: "Profile"
*
diff --git a/templates/profile/posts.php b/templates/profile/posts.php
index 791c8f87..b72cb3e8 100644
--- a/templates/profile/posts.php
+++ b/templates/profile/posts.php
@@ -2,7 +2,7 @@
/**
* Template for the profile posts
*
- * This template can be overridden by copying it to yourtheme/ultimate-member/profile/posts.php
+ * This template can be overridden by copying it to your-theme/ultimate-member/profile/posts.php
*
* Page: "Profile"
*
diff --git a/templates/register.php b/templates/register.php
index 43993db9..6ab617f6 100644
--- a/templates/register.php
+++ b/templates/register.php
@@ -2,7 +2,7 @@
/**
* Template for the register page
*
- * This template can be overridden by copying it to yourtheme/ultimate-member/templates/register.php
+ * This template can be overridden by copying it to your-theme/ultimate-member/templates/register.php
*
* Page: "Register"
*
diff --git a/templates/restricted-blog.php b/templates/restricted-blog.php
index 8fe0168f..fb50fb9c 100644
--- a/templates/restricted-blog.php
+++ b/templates/restricted-blog.php
@@ -2,7 +2,7 @@
/**
* Template for the blog restricted message
*
- * This template can be overridden by copying it to yourtheme/ultimate-member/restricted-blog.php
+ * This template can be overridden by copying it to your-theme/ultimate-member/restricted-blog.php
*
* Call: function blog_message()
*
diff --git a/templates/restricted-taxonomy.php b/templates/restricted-taxonomy.php
index 4e996616..a764a2f2 100644
--- a/templates/restricted-taxonomy.php
+++ b/templates/restricted-taxonomy.php
@@ -2,7 +2,7 @@
/**
* Template for the taxonomy restricted message
*
- * This template can be overridden by copying it to yourtheme/ultimate-member/restricted-taxonomy.php
+ * This template can be overridden by copying it to your-theme/ultimate-member/restricted-taxonomy.php
*
* Call: function taxonomy_message()
*
diff --git a/templates/searchform.php b/templates/searchform.php
index 68938a9f..acdc6a2d 100644
--- a/templates/searchform.php
+++ b/templates/searchform.php
@@ -2,7 +2,7 @@
/**
* Template for the search form
*
- * This template can be overridden by copying it to yourtheme/ultimate-member/searchform.php
+ * This template can be overridden by copying it to your-theme/ultimate-member/searchform.php
*
* Call: function ultimatemember_searchform()
*