private function get_favourites(stdClass $user) : array {
        $ids = [];

        if (isloggedin()) {
            $usercontext = \context_user::instance($user->id);
            $ufservice = \core_favourites\service_factory::get_service_for_user_context($usercontext);
            $favourites = $ufservice->find_favourites_by_type('mod_forum', 'discussions');
            foreach ($favourites as $favourite) {
                $ids[] = $favourite->itemid;
            }
        }

        return $ids;
    }
private function get_favourites(stdClass $user) : array {
        $ids = [];

        if (isloggedin()) {
            $usercontext = \context_user::instance($user->id);
            $ufservice = \core_favourites\service_factory::get_service_for_user_context($usercontext);
            $favourites = $ufservice->find_favourites_by_type('mod_forum', 'discussions');
            foreach ($favourites as $favourite) {
                $ids[] = $favourite->itemid;
            }
        }

        return $ids;
    }
private function get_favourites ( stdClass $ user ) : array { $ ids = [ ] ; if ( isloggedin ( ) ) { $ usercontext = \ context_user :: instance ( $ user -> id ) ; $ ufservice = \ core_favourites \ service_factory :: get_service_for_user_context ( $ usercontext ) ; $ favourites = $ ufservice -> find_favourites_by_type ( 'mod_forum' , 'discussions' ) ; foreach ( $ favourites as $ favourite ) { $ ids [ ] = $ favourite -> itemid ; } } return $ ids ; }
Get a list of all favourited discussions.

@param stdClass $user The user we are getting favourites for
@return int[] A list of favourited itemids
Get a list of all favourited discussions .