Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

whew .... wordpress vanilla integration

edited March 2010 in Vanilla 2.0 - 2.8
Well after a couple of days of hacking .. learning .. reading . .then hacking some more, I now have a fairly well integrated wordpress and vanilla forum.

http://tivocentral.co.nz/vanilla/

Things I have done.

please note: I have wordpress installed in my web root, and vanilla installed in a subdirectory called vanilla :)
if you place wordpress and vanilla in different locations you will need to change some of these instructions.

setup single sign on (addon)

1. when initially setting up vanilla don't use the same admin username that you used for wordpress, they will clash later on.

2. followed the single sign on instructions, including the bit about upload the wordpress plugin in to your wp-content/plugins/ directory :)

3. after successfully setting up single sign on I manually run some sql to get the admin privileges shared across from my wordpress admin user.

3.1 firstly you need to find out the UserID of the wordpress user (it will have a password of ***** (that's right .. 5 asterisks) ) mine was UserID 2

3.2 based on the assumption that your UserID is 2, you will need to run some manual sql like so:
update GDN_UserRole set RoleID=16 where UserID=2;
update GDN_User set Permissions='arr:{"0":"Garden.Email.Manage","1":"Garden.Settings.Manage","2":"Garden.Routes.Manage","3":"Garden.Messages.Manage","4":"Garden.Applications.Manage","5":"Garden.Plugins.Manage","6":"Garden.Themes.Manage","7":"Garden.SignIn.Allow","8":"Garden.Registration.Manage","9":"Garden.Applicants.Manage","10":"Garden.Roles.Manage","11":"Garden.Users.Add","12":"Garden.Users.Edit","13":"Garden.Users.Delete","14":"Garden.Users.Approve","15":"Garden.Activity.Delete","16":"Vanilla.Settings.Manage","17":"Vanilla.Categories.Manage","18":"Vanilla.Spam.Manage","Vanilla.Discussions.View":["1","2","3"],"Vanilla.Discussions.Add":["1","2","3"],"Vanilla.Discussions.Edit":["1","2","3"],"Vanilla.Discussions.Announce":["1","2","3"],"Vanilla.Discussions.Sink":["1","2","3"],"Vanilla.Discussions.Close":["1","2","3"],"Vanilla.Discussions.Delete":["1","2","3"],"Vanilla.Comments.Add":["1","2","3"],"Vanilla.Comments.Edit":["1","2","3"],"Vanilla.Comments.Delete":["1","2","3"]}' where UserID=2
You should now be a forum admin .. visit in your browser to confirm.



There you have it .. users and administration is now integrated.



Now on to the theme.



1.create a customer wordpress header and footer in your wordpress theme (I called mine vanilla_header.php and vanilla_footer.php)

2. in vanilla_header.php render the vanilla header ( <?php $this->RenderAsset('Head'); ?> )

3. in vanilla create a new theme called wordpress here is a list of files:
./design/garden.css
./design/bckmenu.png
./design/menu.css
./design/conversations.css
./design/profile.css
./design/activity.css
./design/button_bg2.png
./design/reset.css
./design/vanilla.css
./about.php
./views/default.master.php
./views/profile/password.php
4. in the default.master.php (in your vanilla theme named wordpress) load the wordpress template like so:
<?php include_once( TEMPLATEPATH . '/vanilla_header.php' ); ?>

5. load the the wordpress variables . .the best place I could find to do this was in vanilla's index.php so right at the top I do this:
<?php
// PAUL WAS HERE
require_once('../wp-config.php');
$wp->init();
$wp->register_globals();
?>
5.1 interesting note .. most people advise to load wp-blog-header.php however this will cause 404 headers if you have friendly permalinks turned on in wordpress (there is even post on this forum asking about this problem)

5.2 this is the only step that won't survive an upgrade .. if someone could advise a better way to do this, that would be awesome !!!!



I spent quiet a bit of time tuning the vanilla css "just so" :) .. I will likely still fiddle about with the vanilla menu, as the light blue drop down looks a little out of place.



all is well.



Paul.

Comments

  • LincLinc Detroit Admin
    @TerminalAddict This is the sexiest post I've read in a while; thanks for sharing all this. I will definitely be digging into this once I'm done with my current mini-project. You might make the title something more descriptive though so that others can find it easier. :)
  • @Lincoln Thanks, I've changed the title, and slightly tweaked the content.

    If I had this information two days ago life would have been a lot easier. I have however learnt a fair amount of how themes and views work in garden ...

    I'd like to better load wp variables (putting in the index.php is just asking for trouble I reckon)
  • MarkMark Vanilla Staff
    @TerminalAddict - Awesome post. I'm bookmarking this one, and we'll use your comments to help make this implementation easier for others.
  • @Mark thanks .. I'd still like to load the wp variable inside the theme rather than inside the app .. any ideas?
  • MarkMark Vanilla Staff
    @TerminalAddict - If you change your vanilla master view to be php instead of a smarty template, you can include the wp variables at the top of that file, I guess.

    http://vanillaforums.org/page/PHPMasterView
  • nah tried that ... php errors (undefined functions etc etc etc)

    bummer really .. I'll just have to make a note of it before I upgrade :)
  • MarkMark Vanilla Staff
    Oh, I get the problem. Well, it could be done in a plugin - but I understand how you want to have everything packaged in the theme. Hmmm. I wonder if this will be a common enough requirement that it would be worthwhile adding an init file to the theme?
  • LincLinc Detroit Admin
    edited October 2009
    I think having an adjunct addon would both be acceptable for something this complex and more desirable than a hack that must be repeated every upgrade.

    //edit: I plan to go even further and integrate Wordpress comments with Vanilla, so a second addon is inevitable for me anyway.
  • Excellent! Are these written for Vanilla 1 or 2?
  • Is there a way someone can do this for me? I am very confused! Grazi!
  • edited March 2010
    OMFG sorry for the triple post! can someone remove my extra replies? Grazi!
  • MarkMark Vanilla Staff
    @SkinnyInTheCity - There was a little bug causing double posts last night. Fixed this morning :)
  • What file am I supposed to include the wordpress register globals? The index.php file in the root of the garden folder?
  • yes

    code:

    <?php
    /*
    Copyright 2008, 2009 Mark O'Sullivan
    This file is part of Garden.
    Garden is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
    Garden is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
    You should have received a copy of the GNU General Public License along with Garden. If not, see <http://www.gnu.org/licenses/>.
    Contact Mark O'Sullivan at mark [at] lussumo [dot] com
    */

    // WORDPRESS INTEGRATION WAS HERE
    require_once('../wp-config.php');
    $wp->init();
    $wp->register_globals();

    // Report and track all errors.
    error_reporting(E_ALL);
    ini_set('display_errors', 'on');
  • I'm struggling to find all the files you say you need:
    ./design/garden.css
    ./design/bckmenu.png
    ./design/menu.css
    ./design/conversations.css
    ./design/profile.css
    ./design/activity.css
    ./design/button_bg2.png
    ./design/reset.css
    ./design/vanilla.css
    ./about.php
    ./views/default.master.php
    ./views/profile/password.php

    I can find some of them, and others i can't. Am i looking hard enough? If not where should i get these files from?
  • My Wordpress plugins can't seem to find some of their variables when using this method. There is no conflict in the naming conventions. Vanilla 2 fails on me when employing this solution most often due to undefined variables in Wordpress plugins.

    any ideas?
  • the only file i can't find is garden.css. Has anyone found this file because it doesn't seem to be in the folder?
  • @mpraetzel .. not sure sorry, I can't help.

    @Wellsy89
    Garden has evolved considerably :) .. it could quite well be in a different place.

    tail -f /var/log/apache2/error.log
    is your friend :)
  • WeblogianWeblogian New
    edited October 2010
    Does anyone know how to change/redirect the profile link to Wordpress/buddypress profile page?
Sign In or Register to comment.