Title: Compatibility with Uncode theme
Last modified: April 21, 2023

---

# Compatibility with Uncode theme

 *  Resolved [Antony Booker](https://wordpress.org/support/users/antonynz/)
 * (@antonynz)
 * [3 years, 1 month ago](https://wordpress.org/support/topic/compatibility-with-uncode-theme/)
 * Hello,
 * Is it possible to please make the content restriction feature compatible with
   the Uncode theme and themes that don’t use the_content in the traditional way?(
   I think it uses get_the_content instead)
   I have been able to achieve this by 
   editing the plugin and hooking into the_post to hide content earlier in the page
   request with the below code, dded to simple-membership/classes/class.simple-wp-
   membership.php.
 *     ```wp-block-code
       add_filter('the_post', array(&$this, 'filter_content_post'), 999, 1);
   
       public function filter_content_post($post){
               if (is_preview() || is_admin()) {
                   //If the user is logged-in as an admin user then do not apply filtering for admin side viewing or preview page viewing.
                   if ( current_user_can('administrator') ){
                       //The user is logged in as admin in this browser.
                       return $content;
                   }
               }
               $acl = SwpmAccessControl::get_instance();
         		$content = $post->post_content;
               $post->post_content = $acl->filter_post($post, $content);
       		return $post;
           }
       ```
   
 * Would you be able to look into testing and adding that code?

Viewing 8 replies - 1 through 8 (of 8 total)

 *  Plugin Support [mbrsolution](https://wordpress.org/support/users/mbrsolution/)
 * (@mbrsolution)
 * [3 years, 1 month ago](https://wordpress.org/support/topic/compatibility-with-uncode-theme/#post-16674299)
 * Hi, we currently have the following addon that might be what you are looking 
   for. This addon can help those using divi type themes and any type of theme that
   does not follow WordPress theme development conventional process.
 * [https://simple-membership-plugin.com/full-page-protection-addon-simple-membership/](https://simple-membership-plugin.com/full-page-protection-addon-simple-membership/)
 * Kind regards.
 *  Thread Starter [Antony Booker](https://wordpress.org/support/users/antonynz/)
 * (@antonynz)
 * [3 years, 1 month ago](https://wordpress.org/support/topic/compatibility-with-uncode-theme/#post-16674319)
 * Thanks for the reply. I had a look at the plugin but it won’t be suitable as 
   it hides the entire page and the header/footer option doesn’t work with Uncode.
   
   Would appreciate if you could look into integrating the above as is done with
   other membership plugins.
 *  Plugin Support [mbrsolution](https://wordpress.org/support/users/mbrsolution/)
 * (@mbrsolution)
 * [3 years, 1 month ago](https://wordpress.org/support/topic/compatibility-with-uncode-theme/#post-16674330)
 * Thank you for providing more information. I have submitted a message to the developers
   to investigate further your request.
 * Kind regards.
 *  Plugin Author [wp.insider](https://wordpress.org/support/users/wpinsider-1/)
 * (@wpinsider-1)
 * [3 years, 1 month ago](https://wordpress.org/support/topic/compatibility-with-uncode-theme/#post-16677151)
 * Thank you. I will check it out.
 *  Plugin Author [wp.insider](https://wordpress.org/support/users/wpinsider-1/)
 * (@wpinsider-1)
 * [3 years, 1 month ago](https://wordpress.org/support/topic/compatibility-with-uncode-theme/#post-16683727)
 * Hi, Is this something specified to the theme that you are using? I tested the
   code you shared but for me (using the default WordPress 2023 theme), it doesn’t
   work.
 * If this solution is specified to this theme then the best option will be to apply
   this via a custom code in a custom plugin. If you need any action or filter hook
   in our plugin, you can suggest it and I will look into adding the hook.
 *  Thread Starter [Antony Booker](https://wordpress.org/support/users/antonynz/)
 * (@antonynz)
 * [3 years, 1 month ago](https://wordpress.org/support/topic/compatibility-with-uncode-theme/#post-16687202)
 * The additional code above would be for themes that don’t use the_content to display
   content (such as Uncode which uses get_the_content instead of the_content).
 * I’ll see if I can add the code separately as it looks like the SwpmAccessControl
   class might be retrievable outside of the plugin.
 *  Plugin Author [wp.insider](https://wordpress.org/support/users/wpinsider-1/)
 * (@wpinsider-1)
 * [3 years, 1 month ago](https://wordpress.org/support/topic/compatibility-with-uncode-theme/#post-16687394)
 * That code that you shared can be added outside of the plugin. That should not
   be an issue.
 * If there is a filter/hook from WordPress then I will definitely look into to 
   add an alternative. The issue is that the filter hook you referenced (`the_post`)
   is not a WordPress filter. WordPress has an action hook with that same name. 
   An action hook used “add_action” which is different than a filter. So I am not
   sure if you are referring to a filter hook that your theme only offers.
 * Are you referring to the following action hook of WordPress?
 * [https://developer.wordpress.org/reference/hooks/the_post/](https://developer.wordpress.org/reference/hooks/the_post/)
 *  Thread Starter [Antony Booker](https://wordpress.org/support/users/antonynz/)
 * (@antonynz)
 * [3 years, 1 month ago](https://wordpress.org/support/topic/compatibility-with-uncode-theme/#post-16687415)
 * Thanks for the correction, it was running but yes you’re right it should be add_action
   and wouldn’t need the post returned. I have added it below in case other users
   may wish to use it:
 *     ```wp-block-code
       add_action('the_post','filter_content_post', 999, 1);
       function filter_content_post($post){
       	if (!class_exists('SimpleWpMembership')) {
       		return $post;
       	}
   
           if (is_preview() || is_admin()) {
               //If the user is logged-in as an admin user then do not apply filtering for admin side viewing or preview page viewing.
               if ( current_user_can('administrator') ){
                   //The user is logged in as admin in this browser.
                   return $content;
               }
           }
           $acl = SwpmAccessControl::get_instance();
       	$content = $post->post_content;
           $post->post_content = $acl->filter_post($post, $content);
       }
       ```
   

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘Compatibility with Uncode theme’ is closed to new replies.

 * ![](https://ps.w.org/simple-membership/assets/icon-128x128.png?rev=974529)
 * [Simple Membership](https://wordpress.org/plugins/simple-membership/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/simple-membership/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/simple-membership/)
 * [Active Topics](https://wordpress.org/support/plugin/simple-membership/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/simple-membership/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/simple-membership/reviews/)

 * 8 replies
 * 3 participants
 * Last reply from: [Antony Booker](https://wordpress.org/support/users/antonynz/)
 * Last activity: [3 years, 1 month ago](https://wordpress.org/support/topic/compatibility-with-uncode-theme/#post-16687415)
 * Status: resolved