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.
Sticky Sunk Closed Whispered
I'd been using ↑↓Ω for Sticky, Sunk and Closed. But now I can't change them in Vanilla 1.1.1?
0
Comments
You can edit them by adding the following lines to your conf/language.php file:
// change as required... $Context->Dictionary['TextWhispered'] = 'Private'; $Context->Dictionary['TextSticky'] = 'Sticky'; $Context->Dictionary['TextClosed'] = 'Closed'; $Context->Dictionary['TextHidden'] = 'Deleted'; $Context->Dictionary['TextSink'] = 'Sink'; $Context->Dictionary['TextBookmarked'] = 'Bookmarked'; $Context->Dictionary['TextPrefix'] = '['; $Context->Dictionary['TextSuffix'] = ']';
This change means that you can also specify an image instead of characters if you like. You could do that by changing one of those settings to something like this:
$Context->Dictionary['TextBookmarked'] = '<img src="ico.bookmark.gif" />';
Now I updated to v.1.1.2 and used Mark's recommended method by adding s.th like this to /conf/language.php
$Context->Dictionary['TextBookmarked'] = '<img src="ico.bookmark.gif" />';
The result looks like this:
I hope you see the problem. WallPhone used a changed function DiscussionPrefix within Vanilla.Functions.php. But when I change this function to WallPhones one, it doesn't work anymore with version 1.1.2
My question is, what do I have to change, so that I get rid of the comma, and that all images are aligned side by side.
Copy
/themes/discussion.php
into the Vanilla folder you see in/themes/
, then copy and paste the DiscussionPrefix function inside it, just below the comments. Rename the function to something else... likeNewDiscussionPrefix
.Now remove all the lines that end with
$Prefix .= ', ';
--yes, the whole line. They are the longer of the line pairs inside the function. We don't need no stinkin' commas!And finally, go about 5-8 lines into the theme file and change the call to DiscussionPrefix already there to the name NewDiscussionPrefix.
<?php // Note: This file is included from the library/Vanilla/Vanilla.Control.SearchForm.php // class and also from the library/Vanilla/Vanilla.Control.DiscussionForm.php's // themes/discussions.php include template. $UnreadUrl = GetUnreadQuerystring($Discussion, $this->Context->Configuration, $CurrentUserJumpToLastCommentPref); $NewUrl = GetUnreadQuerystring($Discussion, $this->Context->Configuration, 1); $LastUrl = GetLastCommentQuerystring($Discussion, $this->Context->Configuration, $CurrentUserJumpToLastCommentPref); function NewDiscussionPrefix(&$Context, &$Discussion) { $Prefix = ''; if (!$Discussion->Active) $Prefix = $Context->GetDefinition('TextHidden'); if ($Discussion->Sticky) $Prefix .= $Context->GetDefinition('TextSticky'); if ($Discussion->Closed) $Prefix .= $Context->GetDefinition('TextClosed'); if ($Discussion->Bookmarked) $Prefix .= $Context->GetDefinition('TextBookmarked'); if ($Discussion->Sink) $Prefix .= $Context->GetDefinition('TextSink'); if ($Discussion->WhisperUserID > 0) $Prefix .= $Context->GetDefinition('TextWhispered'); if ($Prefix != '') return $Context->GetDefinition('TextPrefix').$Prefix.$Context->GetDefinition('TextSuffix').' '; } $DiscussionList .= ' <li id="Discussion_'.$Discussion->DiscussionID.'" class="Discussion'.$Discussion->Status.($Discussion->CountComments == 1?' NoReplies':'').($this->Context->Configuration['USE_CATEGORIES'] ? ' Category_'.$Discussion->CategoryID:'').($Alternate ? ' Alternate' : '').'"> <ul> <li class="DiscussionType"> <span>'.$this->Context->GetDefinition('DiscussionType').'</span>'.NewDiscussionPrefix($this->Context, $Discussion).' </li> .... <rest of theme file continues -->
I followed your instructions, but after uploading and refresing all I see is:
Fatal error: Cannot redeclare newdiscussionprefix() (previously declared in /www/sites/test.inkscapeforum.de/themes/vanilla/discussion.php:10) in /www/sites/test.inkscapeforum.de/themes/vanilla/discussion.php on line 10
The discussion.php within the /themes/vanilla/ subfolder looks like this:
<?php // Note: This file is included from the library/Vanilla/Vanilla.Control.SearchForm.php // class and also from the library/Vanilla/Vanilla.Control.DiscussionForm.php's // themes/discussions.php include template. $UnreadUrl = GetUnreadQuerystring($Discussion, $this->Context->Configuration, $CurrentUserJumpToLastCommentPref); $NewUrl = GetUnreadQuerystring($Discussion, $this->Context->Configuration, 1); $LastUrl = GetLastCommentQuerystring($Discussion, $this->Context->Configuration, $CurrentUserJumpToLastCommentPref); function NewDiscussionPrefix(&$Context, &$Discussion) { $Prefix = ''; if (!$Discussion->Active) $Prefix = $Context->GetDefinition('TextHidden'); if ($Discussion->Sticky) $Prefix .= $Context->GetDefinition('TextSticky'); if ($Discussion->Closed) $Prefix .= $Context->GetDefinition('TextClosed'); if ($Discussion->Bookmarked) $Prefix .= $Context->GetDefinition('TextBookmarked'); if ($Discussion->Sink) $Prefix .= $Context->GetDefinition('TextSink'); if ($Discussion->WhisperUserID > 0) $Prefix .= $Context->GetDefinition('TextWhispered'); if ($Prefix != '') return $Context->GetDefinition('TextPrefix').$Prefix.$Context->GetDefinition('TextSuffix').' '; } $DiscussionList .= ' <li id="Discussion_'.$Discussion->DiscussionID.'" class="Discussion'.$Discussion->Status.($Discussion->CountComments == 1?' NoReplies':'').($this->Context->Configuration['USE_CATEGORIES'] ? ' Category_'.$Discussion->CategoryID:'').($Alternate ? ' Alternate' : '').'"> <ul> <li class="DiscussionType"> <span>'.$this->Context->GetDefinition('DiscussionType').'</span>'.NewDiscussionPrefix($this->Context, $Discussion).' ...
The theme file is included multiple times, so PHP thinks the function is trying redefine itself.
Wrap it in a check if it already exists like this:
if (!function_exists('NewDiscussionPrefix')) { function NewDiscussionPrefix(&$Context, &$Discussion) { $Prefix = ''; if (!$Discussion->Active) $Prefix = $Context->GetDefinition('TextHidden'); if ($Discussion->Sticky) $Prefix .= $Context->GetDefinition('TextSticky'); if ($Discussion->Closed) $Prefix .= $Context->GetDefinition('TextClosed'); if ($Discussion->Bookmarked) $Prefix .= $Context->GetDefinition('TextBookmarked'); if ($Discussion->Sink) $Prefix .= $Context->GetDefinition('TextSink'); if ($Discussion->WhisperUserID > 0) $Prefix .= $Context->GetDefinition('TextWhispered'); if ($Prefix != '') return $Context->GetDefinition('TextPrefix').$Prefix.$Context->GetDefinition('TextSuffix').' '; } }
$Context->Dictionary['TextWhispered'] = '<img src="http://www.xxxxxx.com/img/buttons/private.png" />'; $Context->Dictionary['TextSticky'] = '<img src="http://www.xxxxxxx.com/img/buttons/sticky.png" />';
(with full urls).
also guys, I'm getting the same problem as InkScape and I'm finding the solution provided by wallphone a little hard to follow. Could someone clear things up for me please?
What lines do I delete/what lines do I add & where abouts?