Show Pages in User Blueprint

I’m having some trouble with a custom userMethod that retrieves all articles authored by this user and is supposed to show them in a pages section inside the users panel page.

The userMethod looks like this

class EditorUser extends User {

… 

    public function articles() {
        return site()->pages()->find('blog')->children()->filterBy('intendedTemplate', 'article')->filter(function($article) {
            return $article->author()->toUsers()->has($this);
        });
    }

…

}

This function is confirmed working in a template and returns all articles in which this user is set as author.

When trying to add this to a pages section inside the editor.yml blueprint, the pages are not showing up:

    sections:
      authored_articles:
        type: pages
        headline: Authored articles
        parent: site
        query: user.articles
        status: all
        create: false
        help: "{{ user.articles }}"

I can confirm the context of “user” is working in this case, as the help text will actually show the queried pages:

They just don’t show up as actual pages inside the section. Changing the parent from site to page(‘blog') (which is where my articles live) also doesn’t help.

Is this a bug by any chance? I’m currently on v4.8). I feel like I’ve tried everything I can think of – any hints?

I think the problem is context. In the query, `user` seems to refer to the current user, and that’s why the section remains empty.

Thank you! It seems odd to me that user means something different inside the query than inside the help text. I have already tried using model instead, but with the same result – the help text shows the method working as expected, the query does not:

      authored_articles:
        type: pages
        headline: Authored articles
        parent: page('blog')
        query: model.articles
        status: all
        create: false
        help: "This user has written {{ model.articles.count }} Articles"

Is there a way to access a user and its methods inside a query?

`user.articles` works if you are in your account to see your own articles. It won’t work if you want to see the articles of user A while being logged-in as user B. So the context of the `user` in the `help` text query is different from the `query` context.

Thanks! I do understand that the context is different. I do wonder though wether there is some other way I could access the user whose profile I’m looking at inside the query.