Plugin Navigation Problem: How can I add a dynamic link under Users > Person

Re: Plugin Navigation Problem: How can I add a dynamic link under Users > Person

by Paul M -
Number of replies: 0

That works. I changed the code slightly and put the $nav->find in an 'if' statement as it seemed to break other pages. My code is below.

Many thanks.

function local_reviews_extends_navigation($nav) {
        global $CFG, $PAGE, $USER;
        $id = $PAGE->url->get_param('id');
        $url = new moodle_url('/local/reviews/review_history.php', array('userid' => $USER->id));
        $nav->add('My review history', $url, navigation_node::TYPE_ROOTNODE);
        
        if($usersnode = $nav->find($id, null)){
            $url = new moodle_url('/local/reviews/review_history.php', array('userid' => $id));
            $usersnode->add('User review history', $url);
        }
    }
Average of ratings: Useful (1)