Title: [Plugin: User Access Manager] Feature Request: the_content
Last modified: August 20, 2016

---

# [Plugin: User Access Manager] Feature Request: the_content

 *  [davidnde](https://wordpress.org/support/users/davidnde/)
 * (@davidnde)
 * [14 years, 11 months ago](https://wordpress.org/support/topic/plugin-user-access-manager-feature-request-the_content/)
 * I was wondering if the_content hook stil works with UAM and it does not as a 
   like it.
 * Why am I asking: If you write a plugin, that does some custom content rendering
   using this hook you don’t want this to effect access issues. But actually UAM
   overrides the content of a post when no access is granted. So it depends which
   plugin is ‘faster’.
 * For example, imagine some plugin code like
 *     ```
       add_filter('the_content', 'myplugin_the_content');
       function myplugin_the_content($content){
         return "my custom output";
       }
       ```
   
 * If a user has no access to a post there will most likely show “my custom output”
   up though!
 * I am not sure how to fix this problem nicely. Maybe UAM can suppress the ‘the_content’
   filter for posts with no access…
 * A solution that you can implement in your third party plugin is the following:
 *     ```
       add_filter('the_content', 'myplugin_the_content');
       function myplugin_the_content($content){
           global $post;
           global $userAccessManager;
           $access = true;
           if (isset($userAccessManager)) {
               $uamAccessHandler = $userAccessManager->getAccessHandler();
               $access = $uamAccessHandler -> checkObjectAccess($post->post_type, $post->ID);
           }
           //if UAM says access denied, do not continue!
           if(!$access) return $content;
   
           //otherwise go on with you processing
           return "my custom output";
       }
       ```
   
 * [http://wordpress.org/extend/plugins/user-access-manager/](http://wordpress.org/extend/plugins/user-access-manager/)

The topic ‘[Plugin: User Access Manager] Feature Request: the_content’ is closed
to new replies.

 * ![](https://ps.w.org/user-access-manager/assets/icon.svg?rev=1563783)
 * [User Access Manager](https://wordpress.org/plugins/user-access-manager/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/user-access-manager/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/user-access-manager/)
 * [Active Topics](https://wordpress.org/support/plugin/user-access-manager/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/user-access-manager/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/user-access-manager/reviews/)

## Tags

 * [compatibility](https://wordpress.org/support/topic-tag/compatibility/)
 * [the_content](https://wordpress.org/support/topic-tag/the_content/)

 * 0 replies
 * 1 participant
 * Last reply from: [davidnde](https://wordpress.org/support/users/davidnde/)
 * Last activity: [14 years, 11 months ago](https://wordpress.org/support/topic/plugin-user-access-manager-feature-request-the_content/)
 * Status: not a support question