Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Integrating Vanilla with Wordpress themes

edited January 2009 in Vanilla 1.0 Help

I'm trying to integrate Vanilla into my Wordpress theme.

I've followed the instructions from Il Filosofo:
First, you need to include the WordPress files. A good place to do this is at the bottom of the Vanilla conf/database.php file, where you should put
<?php require_once('../wp-blog-header.php'); ?>
(of course make sure that’s the path to wp-blog-header.php–yours may be in a different directory).

Second, you need to re-connect WordPress to the database, because Vanilla will close the connection early. Edit Vanilla’s library/Framework/Framework.Class.MySQL.php file, adding the two lines in boldface to this section near the top of the file:

class MySQL extends Database {
function CloseConnection() {
if ($this->Connection) @mysql_close($this-&gt;Connection);
global $wpdb;
$wpdb = new wpdb(DB_USER, DB_PASSWORD, DB_NAME, DB_HOST);

That’s it! Now you can use WordPress functions, such as get_header(), in the Vanilla theme.

However, those changes mean that I can't enable/disable my extensions. It comes up with an Alert box that says... nothing! anyone have any idea how to solve this?


  • Options
    I'm have the exact same error, i'm guessing it has to do with a change to the newer versions of Wordpress, since all the Vanilla + WP integration guides are a few years old now. If using WP 2.7 (not sure about the older versions) once you include the line "require_once('../wp-blog-header.php');" you can use the wordpress functions, but the vanilla extensions can then not be managed and you just get an alert box saying nothing at all. I've been trying to solve it for a few days now, but no luck so far.
  • Options
    Has anybody managed to get WP 2.7 and Vanilla to play together nicely? The problem seems to be independent of merging the databases and instead something in the wp-blog-header.php that is causing the incompadibility.
  • Options
    Finally got it working thanks to this:

    Cee wrote: "It worked almost totally as-is, except that Ajax broke. This meant that I could not enable/disable extensions, remove posts or check for updates. I changed it from a relative path (../wp-blog-header.php) to an exact path in my server (/var/www/mydomain/wp-blog-header.php) and Ajax works perfectly now."
Sign In or Register to comment.