Title: problem with UserAccessManager.class.php
Last modified: September 6, 2016

---

# problem with UserAccessManager.class.php

 *  Resolved [woskyp](https://wordpress.org/support/users/woskyp/)
 * (@woskyp)
 * [9 years, 8 months ago](https://wordpress.org/support/topic/problem-with-useraccessmanager-class-php/)
 * Hello, I have a problem with the class UserAccessManager.class.php.
    I have this
   message : Warning: Creating default object from empty value in /home/ecoleste/
   public_html/wp-content/plugins/user-access-manager/class/UserAccessManager.class.
   php on line 1752
 * When I go to see the class, the problem seem to come from the function _getTerm
 * The code is this one, line 1752 is the following code : _$oTerm->isEmpty = false;_
 * Here all the code of this function :
 *     ```
       protected function _getTerm($sTermType, $oTerm)
           {
               $aUamOptions = $this->getAdminOptions();
               $oUamAccessHandler = $this->getAccessHandler();
   
          <strong> $oTerm->isEmpty = false;</strong>
   
               $oTerm->name .= $this->adminOutput('term', $oTerm->term_id);
   
               if ($sTermType == 'post_tag'
                   || ( $sTermType == 'category' || $sTermType == $oTerm->taxonomy)
                   && $oUamAccessHandler->checkObjectAccess('category', $oTerm->term_id)
               ) {
                   if ($this->atAdminPanel() == false
                       && ($aUamOptions['hide_post'] == 'true'
                       || $aUamOptions['hide_page'] == 'true')
                   ) {
                       $iTermRequest = $oTerm->term_id;
                       $sTermRequestType = $sTermType;
   
                       if ($sTermType == 'post_tag') {
                           $iTermRequest = $oTerm->slug;
                           $sTermRequestType = 'tag';
                       }
   
                       $aArgs = array(
                           'numberposts' => - 1,
                           $sTermRequestType => $iTermRequest
                       );
   
                       $aTermPosts = get_posts($aArgs);
                       $oTerm->count = count($aTermPosts);
   
                       if (isset($aTermPosts)) {
                           foreach ($aTermPosts as $oPost) {
                               if ($aUamOptions['hide_'.$oPost->post_type] == 'true'
                                   && !$oUamAccessHandler->checkObjectAccess($oPost->post_type, $oPost->ID)
                               ) {
                                   $oTerm->count--;
                               }
                           }
                       }
   
                       //For post_tags
                       if ($sTermType == 'post_tag' && $oTerm->count <= 0) {
                           return null;
                       }
   
                       //For categories
                       if ($oTerm->count <= 0
                           && $aUamOptions['hide_empty_categories'] == 'true'
                           && ($oTerm->taxonomy == "term"
                           || $oTerm->taxonomy == "category")
                       ) {
                           $oTerm->isEmpty = true;
                       }
   
                       if ($aUamOptions['lock_recursive'] == 'false') {
                           $oCurCategory = $oTerm;
   
                           while ($oCurCategory->parent != 0) {
                               $oCurCategory = get_term($oCurCategory->parent, 'category');
   
                               if ($oUamAccessHandler->checkObjectAccess('term', $oCurCategory->term_id)) {
                                   $oTerm->parent = $oCurCategory->term_id;
                                   break;
                               }
                           }
                       }
                   }
   
                   return $oTerm;
               }
   
               return null;
           }
       ```
   
 * Can anyone could help me to resolve this problem?
 * Thanks per advance for your help 😉

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

 *  [Trebly](https://wordpress.org/support/users/trebly/)
 * (@trebly)
 * [9 years, 8 months ago](https://wordpress.org/support/topic/problem-with-useraccessmanager-class-php/#post-8148375)
 * Hi,
 * Not tested, but quite sure that this happens because the function is called with
   no object $oTerm defined. This is not normal but,
    the most simple to walk around
   his to add at beginning :
 * `if ($oTerm=='null') return 'null';`
 * Then change code to :
 *     ```
       protected function _getTerm($sTermType, $oTerm)
           {
               if ($oTerm=='null') return 'null';
   
               $aUamOptions = $this->getAdminOptions();
               $oUamAccessHandler = $this->getAccessHandler();
   
               $oTerm->isEmpty = false;
   
               $oTerm->name .= $this->adminOutput('term', $oTerm->term_id);
       ....
       ```
   
 * It is sure that if there is an error (no time to check) in the call of the function,
   which don’t define an “term” which should be you will miss this term. This can
   be the true bug. What I offer is a work around for the error displayed.
 * Best regards
 * Trebly
 *  Thread Starter [woskyp](https://wordpress.org/support/users/woskyp/)
 * (@woskyp)
 * [9 years, 8 months ago](https://wordpress.org/support/topic/problem-with-useraccessmanager-class-php/#post-8148596)
 * Hi !
    Thanks for your response. I’ve tried it but unfortunately it doesn’t work
   🙁 The value of oTerm seems to be not null, because I try to put an echo to see
   if the program go into the proposed function, but nothing appear… So I suppose
   that the problem is different. Does anyone have another solution?
 * Thanks !
    -  This reply was modified 9 years, 8 months ago by [woskyp](https://wordpress.org/support/users/woskyp/).
 *  Thread Starter [woskyp](https://wordpress.org/support/users/woskyp/)
 * (@woskyp)
 * [9 years, 8 months ago](https://wordpress.org/support/topic/problem-with-useraccessmanager-class-php/#post-8148712)
 * I’ve found the solution.
    In fact, in my menu, there was a category with no original
   name. oTerm is the object corresponding of each part of the menu. So empty value
   in my case 😉

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

The topic ‘problem with UserAccessManager.class.php’ 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

 * [empty value](https://wordpress.org/support/topic-tag/empty-value/)
 * [warning](https://wordpress.org/support/topic-tag/warning/)

 * 3 replies
 * 2 participants
 * Last reply from: [woskyp](https://wordpress.org/support/users/woskyp/)
 * Last activity: [9 years, 8 months ago](https://wordpress.org/support/topic/problem-with-useraccessmanager-class-php/#post-8148712)
 * Status: resolved