Fork me on GitHub

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Try Vanilla Forums Cloud product

In this Discussion

Ready to contribute?

Amazing! Sign our contributors' agreement and then join us on GitHub.

Current release is 2.1.6 (21 Nov 2014).

Users who have not yet upgraded to 2.1 should get security release 2.0.18.14 (1 Nov 2014). We will stop providing these security releases to 2.0 at the end of this year.

[WordPress embed Addon] [Quickfix] Problem on line 51 embed.php in the Wordpress Vanilla Plugin file

edited February 2011 in Vanilla 2.0 Help
This is not a problem as much as it is a solution to a problem that I was having. Hopefully if you are having a similar problem this will help you.

First the problem, when trying to get the Wordpress plugins working I kept getting a 'failed to open stream' error. The error message was pointed to line 51 in embed.php. See below:

copy(__DIR__.'/templates/embed_template.php', get_template_directory().'/embed_template.php');

The solution is to change the '__DIR__' constant in this line to 'dirname(__FILE__)' so it looks like this:

copy( dirname(__FILE__).'/templates/embed_template.php', get_template_directory().'/embed_template.php' );

Now as for why this fixed it, I am no PHP expert but according to the blog post where I found my solution http://www.hermanradtke.com/blog/using-the-php-5-3-__dir__-magic-constant/ the __DIR__ constant is part of the PHP 5.3 release, and because I am running PHP 5.2 the error occurred.

Anyway, so far loving Vanilla but someone might want to update the http://vanillaforums.org/page/Installation-Requirements page to say it requires PHP 5.3 rather than PHP 5.2 or newer.
Sign In or Register to comment.