Doesn't work with Elementor
Hi, I am having the same issue as described here: https://github.com/GM-Alex/user-access-manager/issues/213
User access works as expected on pages which don't use Elementor, but content on restricted pages is displayed to the public on pages which were built with Elementor. Disabling then enabling restriction after using Elementor doesn't fix it, and enabling access restriction before editing with Elementor also doesn't fix it. Converting the page from Elementor to standard Wordpress editor causes the page to become restricted but all Elementor formatting is lost.
I also encountered this problem. Elementor is a widely used editor, sow it should work.
But when the page is build with Elementor all pages with restricted access are visible for all visitors. Please look into this.
Hey,
I tested it again with Elementor for pages and posts and everything works as expected. I need more information, or even better full access (sftp or ssh and a wordpress backend user) to a demo environment where you can reproduce the issue.
Hello, I see that there is a problem with Elementor with the members area I work with Elementor in one of my sites which has a member area. it is a cardiology site and therefore certain articles according to the law must only be accessible via an account. The management of the members is done by the UAM plugin. I introduced the Elementor pages which do not take into account subscriptions. So whether you subscribe or not, you can open all the pages created by Elementor.
Page created with Elementor (normally accessible to subscribers but everyone can see it): http://lecardiologue.com/epidemie-exceptionnelle-mesures-exceptionnels/
Page produced without Elementor and which is accessible only to subscribers: http://lecardiologue.com/teleconsultation-du-cardiologue-en-periode-de-covid-19/
Thanks for your reading time!
Hi @passcool,
for http://lecardiologue.com/epidemie-exceptionnelle-mesures-exceptionnels/ I'm getting a 404, maybe that is the reason it's not reproducible for me, because here happens some kind of browser caching. Could you please try to access the first page with incognito mode.
Greetings, Alex
Sorry, there is a fault in the url.
Here is the right url:
http://lecardiologue.com/epidemie-exceptionnelle-mesures-exceptionnelles/
Le 25 mai 2020 à 10:56, Alexander Schneider [email protected] a écrit :
Hi @passcool,
for http://lecardiologue.com/epidemie-exceptionnelle-mesures-exceptionnels/ I'm getting a 404, maybe that is the reason it's not reproducible for me, because here happens some kind of browser caching. Could you please try to access the first page with incognito mode.
Greetings, Alex
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.
I know you have already been asked the question, but I would like to know if you with the intentin to update the plugin. I work with Elementor on several sites and I need your compatible plug. Thank you for your reply passcool
I too use Elementor on many projects. I also use User Access Manager on many projects. But I finally had one that needed both. So I spent a few hours figuring out a workaround. The problem is that Elementor replaces the_content after UAM has already overridden the post. Because of the way that UAM overrides the entire post and not just the the_content, there doesn't seem to be an ideal solution. So my workaround uses Elementor's hooks to override the Elementor content and uses UAM functions to check access a second time.
The site I'm working on uses Elementor to build the header, body, and footer, so it's only the body Elementor content I want to override. Here's my solution that I placed in my child theme's functions.php file:
// When using Elementor on a page that is restricted by User Access Manager, the Elementor content overwrites the UAM no access content
// Using Elementor hooks, we'll just have to do a second check to overwrite the Elementor content with the UAM content.
function uam_elementor_check_access( $content ) {
global $post, $userAccessManager;
// Remove the Elementor the_content hook so that it doesn't perform the check on content below the main body (the footer())
remove_action( 'elementor/frontend/the_content', 'uam_elementor_check_access' );
// Check that UAM is in use
if ($userAccessManager) {
// Check that the post has user access and if not, display the configured no access content
$accessHandler = $userAccessManager->getAccessHandler();
if ($accessHandler->checkObjectAccess($post->post_type, $post->ID) === false) {
$mainConfig = $userAccessManager->getConfig();
$postContent = htmlspecialchars_decode($mainConfig->getPostTypeContent($post->post_type));
return $postContent;
}
}
return $content;
}
// Only check the Elementor the_content hook if the builder is about to provide the content of the main body (not in the header())
function uam_elementor_check_access_if_mainbody( $data, $post_id ) {
if ( get_queried_object_id() === $post_id ) {
add_action( 'elementor/frontend/the_content', 'uam_elementor_check_access' );
}
return $data;
}
add_filter( 'elementor/frontend/builder_content_data', 'uam_elementor_check_access_if_mainbody', 10, 2 );
@JboyJW Thank you for that, I will see that I can implement a solution based on your code within the plugin.
I too use Elementor on many projects. I also use User Access Manager on many projects. But I finally had one that needed both. So I spent a few hours figuring out a workaround. The problem is that Elementor replaces the_content after UAM has already overridden the post. Because of the way that UAM overrides the entire post and not just the the_content, there doesn't seem to be an ideal solution. So my workaround uses Elementor's hooks to override the Elementor content and uses UAM functions to check access a second time.
The site I'm working on uses Elementor to build the header, body, and footer, so it's only the body Elementor content I want to override. Here's my solution that I placed in my child theme's functions.php file:
// When using Elementor on a page that is restricted by User Access Manager, the Elementor content overwrites the UAM no access content // Using Elementor hooks, we'll just have to do a second check to overwrite the Elementor content with the UAM content. function uam_elementor_check_access( $content ) { global $post, $userAccessManager; // Remove the Elementor the_content hook so that it doesn't perform the check on content below the main body (the footer()) remove_action( 'elementor/frontend/the_content', 'uam_elementor_check_access' ); // Check that UAM is in use if ($userAccessManager) { // Check that the post has user access and if not, display the configured no access content $accessHandler = $userAccessManager->getAccessHandler(); if ($accessHandler->checkObjectAccess($post->post_type, $post->ID) === false) { $mainConfig = $userAccessManager->getConfig(); $postContent = htmlspecialchars_decode($mainConfig->getPostTypeContent($post->post_type)); return $postContent; } } return $content; } // Only check the Elementor the_content hook if the builder is about to provide the content of the main body (not in the header()) function uam_elementor_check_access_if_mainbody( $data, $post_id ) { if ( get_queried_object_id() === $post_id ) { add_action( 'elementor/frontend/the_content', 'uam_elementor_check_access' ); } return $data; } add_filter( 'elementor/frontend/builder_content_data', 'uam_elementor_check_access_if_mainbody', 10, 2 );
Thanks, the solution worked for me.
晚上好打扰了,If a shortcode [elementor-template id=""] is introduced in an article, it only takes effect on the shortcode part, while the rest remains inactive.