We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 19328
    • 433 Posts
    Hi, I'm trying to show the latest comments using this code:

    [[!Articles? &container=`12`]]
    <ul>
    [[+latest_comments]]
    </ul>
    


    The Articles container I'm referring to is in another context (the web context). I'm trying to display the comments in a different context.

    This results in the following error:
    Fatal error: Call to a member function get() on a non-object in /home/xxx/domains/xxx.nl/public_html/core/components/quip/model/quip/quipcomment.class.php on line 111


    I'm not sure if it has anything to do with it but the comments are from an imported Wordpress blog. In the manager the comments are visible in the Articles container.

    Am I doing something wrong here?
      • 19328
      • 433 Posts
      Such a bummer, I'm still having this problem...

      I found out it's not related to Articles, because the error is also there when using the QuipLatestComments snippet.

      I'm trying to display latest comments from another context.

      The line in core/components/quip/model/quip/quipcomment.class.php the error is referring to is as follows:
      $options['context_key'] = $modresource->get('context_key');


      Could it be that the resource the comment belongs to is somehow not found, because it's in another context? If so, how can I make it look in a different context? I hope someone can help me out!
        • 19328
        • 433 Posts
        I found a workaround for my project, although it's not universally usable.

        In core/components/quip/model/quip/quipcomment.class.php
        around line 108, change this line:
        $options['context_key'] = $this->get('context_key');
                   

        to
         $options['context_key'] = 'web';


        I figured that it must be looking in the wrong context, because no context-setting is found. And if there's no setting, the current context is used. In my case the wrong context. So I changed this line to force it to look into the web context.

        How can I set $options['context_key']?