original_string: public function can_view_user_preferences($userid) {
          if (is_siteadmin()) {
              return true;
          }
          // See if any nodes are present in the preferences section for this user.
          $preferencenode = $this->find('userviewingsettings' . $userid, null);
          if ($preferencenode && $preferencenode->has_children()) {
              // Run through each child node.
              foreach ($preferencenode->children as $childnode) {
                  // If the child node has children then this user has access to a link in the preferences page.
                  if ($childnode->has_children()) {
                      return true;
                  }
              }
          }
          // No links found for the user to access on the preferences page.
          return false;
      }
code: public function can_view_user_preferences($userid) {
          if (is_siteadmin()) {
              return true;
          }
          // See if any nodes are present in the preferences section for this user.
          $preferencenode = $this->find('userviewingsettings' . $userid, null);
          if ($preferencenode && $preferencenode->has_children()) {
              // Run through each child node.
              foreach ($preferencenode->children as $childnode) {
                  // If the child node has children then this user has access to a link in the preferences page.
                  if ($childnode->has_children()) {
                      return true;
                  }
              }
          }
          // No links found for the user to access on the preferences page.
          return false;
      }
code_tokens: public function can_view_user_preferences ( $ userid ) { if ( is_siteadmin ( ) ) { return true ; } // See if any nodes are present in the preferences section for this user. $ preferencenode = $ this -> find ( 'userviewingsettings' . $ userid , null ) ; if ( $ preferencenode && $ preferencenode -> has_children ( ) ) { // Run through each child node. foreach ( $ preferencenode -> children as $ childnode ) { // If the child node has children then this user has access to a link in the preferences page. if ( $ childnode -> has_children ( ) ) { return true ; } } } // No links found for the user to access on the preferences page. return false ; }
docstring: Checks to see if there are child nodes available in the specific user's preference node.
  If so, then they have the appropriate permissions view this user's preferences.
  
  @since Moodle 2.9.3
  @param int $userid The user's ID.
  @return bool True if child nodes exist to view, otherwise false.
docstring_tokens: Checks to see if there are child nodes available in the specific user s preference node . If so then they have the appropriate permissions view this user s preferences .