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.

Problem with Post Preview extension and Forum Statistics

edited February 2007 in Vanilla 1.0 Help
When I try to use the Post Preview extension (http://lussumo.com/addons/?PostBackAction=AddOn&AddOnID=84) and Forum Statistics extension (http://lussumo.com/addons/?PostBackAction=AddOn&AddOnID=53) I get the following error.

Notice: Undefined variable: Head in ./vanilla/extensions/Statistics/default.php on line 28 Fatal error: Call to a member function AddStyleSheet() on a non-object in ./vanilla/extensions/Statistics/default.php on line 28

If I disable Forum Statistics, it's fine.

Comments

  • edited July 2006
    I fixed it by editing Forum Statistics' default.php.

    Find (around line 28):
    $Head->AddStyleSheet("extensions/Statistics/style.css");

    Replace with:
    if(!eregi("extensions/PreviewPost/ajax.php", $_SERVER['REQUEST_URI'])) { $Head->AddStyleSheet("extensions/Statistics/style.css"); }

    I don't know if there's a better way of doing it...but hey, it works.
  • It's actually easier to simply do something likeif(!isset($Head)) return; $Head->AddStyleSheet(...);
  • Thank you, SirNot. This resolved the conflict for me.
  • Awesome..., apparently works fine to me for the next addons:
    1. BBInsertBar
    2. LiveSearch
    3. SavedSearches
    Umm... IMHO, i think it should be a rule for addons :(

    Many thx
  • Frankly, given how essential Preview Post is, it already is a rule. There's a LOT of extensions out there that now break PreviewPost. I think Mark and Mini may have to update them as well, as some authors aren't very active. Also, perhaps there could be a nice big warning in the Readme of PreviewPost 2.2 about this?
  • well as I mentioned in another thread, you can't go around putting that in for every extension. some extensions' default.php is used in ajax queries as well (eg. attachments, page manager, etc.), so simply throwing in that line of code will break the extension. you'd have to find the place where it attempts to use the variables in question and modify the condition.
  • FireBug throws up exactly where it's causing the error, and I've had success in modifying the following extensions using:&& (isset($Head))
    Or just plain:if (isset($Head)) {
    Smile
    JQuery
    JQThickBox
    MultiFileUpload
    Attachments
    SoftWrap
    AjaxQuote
    AddComments
This discussion has been closed.