original_string: public function extend_for_user($userid) {
          global $CFG;
  
          if (!in_array($userid, $this->userstoextendfor)) {
              $this->userstoextendfor[] = $userid;
              if ($this->initialised) {
                  $this->generate_user_settings($this->page->course->id, $userid, 'userviewingsettings');
                  $children = array();
                  foreach ($this->children as $child) {
                      $children[] = $child;
                  }
                  array_unshift($children, array_pop($children));
                  $this->children = new navigation_node_collection();
                  foreach ($children as $child) {
                      $this->children->add($child);
                  }
              }
          }
      }
code: public function extend_for_user($userid) {
          global $CFG;
  
          if (!in_array($userid, $this->userstoextendfor)) {
              $this->userstoextendfor[] = $userid;
              if ($this->initialised) {
                  $this->generate_user_settings($this->page->course->id, $userid, 'userviewingsettings');
                  $children = array();
                  foreach ($this->children as $child) {
                      $children[] = $child;
                  }
                  array_unshift($children, array_pop($children));
                  $this->children = new navigation_node_collection();
                  foreach ($children as $child) {
                      $this->children->add($child);
                  }
              }
          }
      }
code_tokens: public function extend_for_user ( $ userid ) { global $ CFG ; if ( ! in_array ( $ userid , $ this -> userstoextendfor ) ) { $ this -> userstoextendfor [ ] = $ userid ; if ( $ this -> initialised ) { $ this -> generate_user_settings ( $ this -> page -> course -> id , $ userid , 'userviewingsettings' ) ; $ children = array ( ) ; foreach ( $ this -> children as $ child ) { $ children [ ] = $ child ; } array_unshift ( $ children , array_pop ( $ children ) ) ; $ this -> children = new navigation_node_collection ( ) ; foreach ( $ children as $ child ) { $ this -> children -> add ( $ child ) ; } } } }
docstring: Extends the settings navigation for the given user.
  
  Note: This method gets called automatically if you call
  $PAGE->navigation->extend_for_user($userid)
  
  @param int $userid
docstring_tokens: Extends the settings navigation for the given user .