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.

"Fatal Error" after making discussions sticky.

edited July 2007 in Vanilla 1.0 Help
Hey all, I am new to this bb thing and I am not a php developer in the least, but I am a decent web designer and pretty good at puttering around and getting things to work. I installed Vanilla on my HOA website so my neighbors could communicate with each other, and everything was working wonderfully. Changed the theme... and everything still worked wonderfully. Started setting up some categories and some discussions... still everything was fine. Then, as the administrator of this site, I attempted to make my introduction "discussions" sticky. Once I clicked the "make discussion sticky link"... All I can get now is a fatal error. In fact, this is the error verbatim: "Fatal error: Call to a member function on a non-object in /home/content/m/a/r/marilynridge/html/vanillaforum/library/Vanilla/Vanilla.Functions.php on line 18" Any idea what's up? Why would making a discussion sticky do such damage? Like I said, I am not a php guy by any stretch... so you are welcome to talk down to me. That isn't an invitation to be an asshole, but nicely talking to me like I am 6 years old is fine. Thanks so much in advance for your help! Josh


  • There is a pretty good search here on the forum. You could look for the error or sticky and find some posts. When you say changed the theme, you just switched to another theme, right? You didn't edit it did you? Try switching back to the default theme and see what happens. Also can you provide us with a link to your site?
  • Hey there, sure. Here is the url: I did several searches for my problem, but didn't find any relevant results. Checked the troubleshooting and FAQ's section as well. Yes, I did change the theme, but everything worked fine after I changed the theme. My problem started when I tried to make my posts sticky. Hitting the "Make message sticky" link is when this all started. Great. Now neither theme works. NOW what? While I was waiting for an answer, I tried to start from scratch... but that didn't work. I tried to re-install Vanilla incase something was corrupt, but it wouldn't let me use the same directory. So, I deleted the directory and then tried to re-install, but that didn't work either. Finally, I just put the original directory back where it was exactly the way it was... and now neither of the themes work. AND the discussion board still gives me that Fatal Error. Going from bad to worse.
  • Odd... Now the theme I want to work works, but the original does not. I still get the Fatal Error when I try to view the discussions.
  • It says my problem is on line 18 of the Vanilla.Functions.php page. Here is the code: <?php /* * Copyright 2003 Mark O'Sullivan * This file is part of Vanilla. * Vanilla 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 2 of the License, or (at your option) any later version. * Vanilla 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 Vanilla; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * The latest source code for Vanilla is available at * Contact Mark O'Sullivan at mark [at] lussumo [dot] com * * Description: Utility functions specific to Vanilla */ function DiscussionPrefix(&$Context, &$Discussion) { $Prefix = ''; if (!$Discussion->Active) $Prefix = $Context->GetDefinition('TextHidden'); if ($Discussion->Sticky && $Context->GetDefinition('TextSticky') != '' && $Prefix != '') $Prefix .= ', '; if ($Discussion->Sticky) $Prefix .= $Context->GetDefinition('TextSticky'); if ($Discussion->Closed && $Context->GetDefinition('TextClosed') != '' && $Prefix != '') $Prefix .= ', '; if ($Discussion->Closed) $Prefix .= $Context->GetDefinition('TextClosed'); if ($Discussion->Bookmarked && $Context->GetDefinition('TextBookmarked') != '' && $Prefix != '') $Prefix .= ', '; if ($Discussion->Bookmarked) $Prefix .= $Context->GetDefinition('TextBookmarked'); if ($Discussion->Sink && $Context->GetDefinition('TextSink') != '' && $Prefix != '') $Prefix .= ', '; if ($Discussion->Sink) $Prefix .= $Context->GetDefinition('TextSink'); if ($Discussion->WhisperUserID > 0 && $Context->GetDefinition('TextWhispered') != '' && $Prefix != '') $Prefix .= ', '; if ($Discussion->WhisperUserID > 0) $Prefix .= $Context->GetDefinition('TextWhispered'); if ($Prefix != '') return $Context->GetDefinition('TextPrefix').$Prefix.$Context->GetDefinition('TextSuffix').' '; } function GetLastCommentQuerystring(&$Discussion, &$Configuration) { $Suffix = ''; if ($Configuration['URL_BUILDING_METHOD'] == 'mod_rewrite') $Suffix = CleanupString($Discussion->Name).'/'; $JumpToItem = $Discussion->CountComments - (($Discussion->LastPage - 1) * $Configuration['COMMENTS_PER_PAGE']); if ($JumpToItem < 0) $JumpToItem = 0; $LastPage = $Discussion->LastPage; if ($LastPage == 0) $LastPage = ''; return GetUrl($Configuration, 'comments.php', '', 'DiscussionID', $Discussion->DiscussionID, $LastPage, '#Item_'.$JumpToItem, $Suffix); } function GetUnreadQuerystring(&$Discussion, &$Configuration, $CurrentUserJumpToLastCommentPref = '0') { $Suffix = ''; if ($Configuration['URL_BUILDING_METHOD'] == 'mod_rewrite') $Suffix = CleanupString($Discussion->Name).'/'; if ($CurrentUserJumpToLastCommentPref) { $UnreadCommentCount = $Discussion->CountComments - $Discussion->NewComments + 1; $ReadCommentCount = $Discussion->CountComments - $Discussion->NewComments; $PageNumber = CalculateNumberOfPages($ReadCommentCount, $Configuration['COMMENTS_PER_PAGE']); $JumpToItem = $ReadCommentCount - (($PageNumber-1) * $Configuration['COMMENTS_PER_PAGE']); if ($JumpToItem < 0) $JumpToItem = 0; if ($PageNumber == 0) $PageNumber = ''; return GetUrl($Configuration, 'comments.php', '', 'DiscussionID', $Discussion->DiscussionID, $PageNumber, '#Item_'.$JumpToItem, $Suffix); } else { return GetUrl($Configuration, 'comments.php', '', 'DiscussionID', $Discussion->DiscussionID, '', '', $Suffix); } } function HighlightTrimmedString($Haystack, $Needles, $TrimLength = '') { $Highlight = '<span class="Highlight">\1</span>'; $Pattern = '#(?!<.*?)(%s)(?![^<>]*?>)#i'; $TrimLength = ForceInt($TrimLength, 0); if ($TrimLength > 0) $Haystack = SliceString($Haystack, $TrimLength); $WordsToHighlight = count($Needles); if ($WordsToHighlight > 0) { $i = 0; for ($i = 0; $i < $WordsToHighlight; $i++) { if (strlen($Needles[$i]) > 2) { $CurrentWord = preg_quote($Needles[$i]); $Regex = sprintf($Pattern, $CurrentWord); $Haystack = preg_replace($Regex, $Highlight, $Haystack); } } } return $Haystack; } function ParseQueryForHighlighting(&$Context, $Query) { if ($Query != '') { $Query = DecodeHtmlEntities($Query); $Query = eregi_replace('"', '', $Query); $Query = eregi_replace(' '.$Context->GetDefinition('And').' ', ' ', $Query); $Query = eregi_replace(' '.$Context->GetDefinition('Or').' ', ' ', $Query); return explode(' ', $Query); } else { return array(); } } ?> The lines dealing with the "TextSticky" are where the problem seem to be?
  • I would do a search for textsticky. There have been posts about that.
  • yah-- either your language file is missing the sticky definition (not likely--looks like the default English to me) or the tabled theme file is not labeling stickies properly (more likely, but it looks like this has already been fixed?)

    You said neither the default theme nor the tabled one work?? Then maybe it is a language file problem...
  • Did a search on "textsticky"... no results.
  • "You said neither the default theme nor the tabled one work?? Then maybe it is a language file problem... " Actually, the default theme seems not to work, but the newer one I applied does. The Fatal Error occurs in both. Seems to be two different problems. I will do a search on language file problems. I keep you all posted.
  • Did a search on "language file problems". Nothing along these lines that I could see.
  • Look at your languages/English/definitions.php file... about 30 lines up from the bottom you should see something that says // Added for Vanilla 1.1 on 2007-02-20

    Next, look at your themes/tabled/comments.php file, and the themes/tabled/discussions.php file. Look for something labled DiscussionPrefix--you might have to do a find 'cause it might be buried in the middle of a line of code. it should have parentheses following it that makes it look just like this:DiscussionPrefix($this->Context, $this->Discussion)
    If you see $this->Context->Configuration take that ->Configuration out. Save/upload the files and see if that makes any diffrence.
  • I just installed Tabled to check--and it does look like it should run fine--unless you have an old copy from somewhere.

    An addition to the above notes: the discussion.php file will have just $Discussion inside instead of $this->Discussion--that is OK.
This discussion has been closed.