Blog Comments

Add comment section to blog post! Available for registered users and guests.

Back to Blog Comments Support

aurelien_roy38976
aurelien_roy38976

Issue : With Rainlab Translate plugin, blog slugs can be translated for multiple locales. When browsing the website with another locale than the default, if the slug is translated too, the Comments plugin is unable to find the blog post when posting a comment.

Fix : Didn't find the plugin repo on Github. So I post the fix here. The issue can be fixed by editing this file : /plugins/tallpro/blogcomments/components/Comments.php - Line 92.

Replace :

    $post = PostModel::where('slug', '=', $blog_slug)->first();

By :

    $post = new PostModel;
    $post = ($post->isClassExtendedWith('RainLab.Translate.Behaviors.TranslatableModel')
        ? $post->transWhere('slug', $blog_slug)
        : $post->where('slug', $blog_slug))->first();

Last updated

ambrazevicius.deividas34885
ambrazevicius.deividas34885

aurelien_roy38976 said:

Issue : With Rainlab Translate plugin, blog slugs can be translated for multiple locales. When browsing the website with another locale than the default, if the slug is translated too, the Comments plugin is unable to find the blog post when posting a comment.

Fix : Didn't find the plugin repo on Github. So I post the fix here. The issue can be fixed by editing this file : /plugins/tallpro/blogcomments/components/Comments.php - Line 92.

Replace :

   $post = PostModel::where('slug', '=', $blog_slug)->first();

By :

   $post = new PostModel;
   $post = ($post->isClassExtendedWith('RainLab.Translate.Behaviors.TranslatableModel')
       ? $post->transWhere('slug', $blog_slug)
       : $post->where('slug', $blog_slug))->first();

Already deployed. Fix should be updated today! Thanks for your help!

1-2 of 2