Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with disqus-comment-system plugin #2035

Closed
5 of 6 tasks
jlariza opened this issue Mar 1, 2018 · 5 comments
Closed
5 of 6 tasks

Issue with disqus-comment-system plugin #2035

jlariza opened this issue Mar 1, 2018 · 5 comments

Comments

@jlariza
Copy link

jlariza commented Mar 1, 2018

Submit a feature request or bug report


What is the current behavior?

When activating disqus-comment-system plugin, some pages return

Fatal error: Uncaught InvalidArgumentException: Unrecognized extension in file: in /path/to/wp-project/wp-content/themes/swapps/vendor/illuminate/view/Factory.php:258 

and the page does not load

What is the expected or desired behavior?

disqus-comment-system plugin should not affect the theme behaviour


Bug report

Please provide steps to reproduce, including full log output:

Fatal error: Uncaught InvalidArgumentException: Unrecognized extension in file: in /home/jose/Desktop/proyectos/wp-project/wp-content/themes/swapps/vendor/illuminate/view/Factory.php:258 Stack trace: #0 /home/jose/Desktop/proyectos/wp-project/wp-content/themes/swapps/vendor/illuminate/view/Factory.php(227): Illuminate\View\Factory->getEngineFromPath('') #1 /home/jose/Desktop/proyectos/wp-project/wp-content/themes/swapps/vendor/illuminate/view/Factory.php(112): Illuminate\View\Factory->viewInstance('', '', Array) #2 [internal function]: Illuminate\View\Factory->file('', Array, Array) #3 /home/jose/Desktop/proyectos/wp-project/wp-content/themes/swapps/vendor/roots/sage-lib/Template/Blade.php(138): call_user_func_array(Array, Array) #4 /home/jose/Desktop/proyectos/wp-project/wp-content/themes/swapps/vendor/roots/sage-lib/Template/Blade.php(69): Roots\Sage\Template\Blade->__call('file', Array) #5 /home/jose/Desktop/proyectos/wp-project/wp-content/themes/swapps/app/helpers.php(70): Roots\Sage\Template\Blade->compiledPath('', in /home/jose/Desktop/proyectos/wp-project/wp-content/themes/swapps/vendor/illuminate/view/Factory.php on line 258

I am using builder beaver plugin and the error raises when I am seeing or editing a global component
http://www.wpbase.dev/es/blog/fl-builder-template/clients/

Please describe your local environment:

WordPress version: 4.9.4

OS: ubuntu 16.04

NPM/Node version: 6.11

Where did the bug happen? Development or remote servers?

development and remote servers

Is there a related Discourse thread or were any utilized (please link them)?

https://discourse.roots.io/t/uncaught-invalidargumentexception/9956/2


@alwaysblank
Copy link
Member

alwaysblank commented Mar 1, 2018

I ran into this problem, or a very similar one, when trying to fix a problem with Disqus comments on another site. From what I recall, the issue boils down to this line in disqus-comment-system/includes/class-disqus.php:

$this->loader->add_filter( 'comments_template', $plugin_public, 'dsq_comments_template' );

That line attempts to run this:

public function dsq_comments_template($file) {
    global $post;

    if ( $this->dsq_embed_can_load_for_post( $post ) ) {

        do_action( 'dsq_before_comments' );
        do_action( 'dsq_enqueue_comments_script' );

        return plugin_dir_path( dirname( __FILE__ ) ) . 'public/partials/disqus-public-display.php';
    }
}

The problem is that this then returns a file that Blade is unable to load, and it complains.

The solution I ultimately used was to just manually include the HTML element and JS embed code Disqus is trying to insert, right in my Blade:

<div id="disqus_thread"></div>
<script>
  var disqus_config = function () {
    this.page.url = '{{ get_permalink() }}';
    this.page.identifier = '{{ $post->ID }} {{ $post->guid }}';
  };
  (function() {
    var d = document, s = d.createElement('script');
    s.src = '//droidlife.disqus.com/embed.js';
    s.setAttribute('data-timestamp', +new Date());
    (d.head || d.body).appendChild(s);
  })();
</script>

It's possible there's a way to remove Disqus's hook on comments_template and nip that bad behavior in the bud, but I wasn't able to figure out how to get inside the class they're instantiating it from to turn that off.

@Ojay
Copy link

Ojay commented Mar 27, 2018

I've ran into this problem too. I decided to drop the plugin in favor of this Laravel / Disqus setup. Only issue is I'm struggling to get it installed...

  • In my theme folder I've ran $composer require yajra/laravel-disqus
  • I've added the necessary html to /resources/views/partials/commnets.blade
  • I've created an .env file in the root of my theme with the necessary data
  • I've ran $composer update & then yarn build

From what I gather that's about it if you're using Blade 5.5 but I'm not having any luck. Have I undertaken the right process??

Any help appreciated :-)

@alwaysblank
Copy link
Member

@Ojay I'm not sure you'll be able to make that work. The Laravel/Disqus plugin you linked to seems to require the Laravel framework (specifically service providers and middleware). Sage is only using Blade, which is just Laravel's templating system. There's been some interest in adding app containers and service providers to Sage, as discussed in this issue, but right now it doesn't exist.

I think the simplest solution is probably some variation on the one I posted.

@Ojay
Copy link

Ojay commented Mar 27, 2018

Ahh, schoolboy error on my part... thanks for letting me know, haha!
I'll adopt your workaround and then look into it further when I get some time.

Thanks

@retlehs
Copy link
Member

retlehs commented Apr 25, 2018

closing since we're unable to do anything to fix this

noted on https://roots.io/sage/docs/sage-compatibility/ - hopefully they'll make changes upstream in the future

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants