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.
Options

Sticky Sunk Closed Whispered

edited April 2009 in Vanilla 1.0 Help
I'd been using ↑↓Ω for Sticky, Sunk and Closed. But now I can't change them in Vanilla 1.1.1?
«1

Comments

  • Options
    MarkMark Vanilla Staff
    edited March 2007
    They have been moved to the language dictionary in an effort to make Vanilla a truly multilingual application.

    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" />';
  • Options
    Sweet. Thanks.
  • Options
    edited March 2007
    (Note to self: Save text file as UTF-8 and upload as ASCII.)
  • Options
    I've added this to the FAQ as I've wondered about this before, and I'm pretty sure that I've seen numerous other people ask this question. Now that it's so easy to do, everyone should be able to find out (and I want to remember) :)
  • Options
    edited March 2007
    Back in the days of v.1.0.3 I used Wallphones method to display little images for sticky, bookmarked, ...

    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:
    Image Hosted by ImageShack.us

    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.
  • Options
    edited March 2007
    Thinking about this, its probably better to package this funtion in a theme file and droping it in your Themes/Vanilla folder so that it doesn't get overwritten by updates.

    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... like NewDiscussionPrefix.

    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.
  • Options
    You should end up with something 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).' </li> .... <rest of theme file continues -->
  • Options
    Could this be done as an extension so as to not limit your use of themes or is it so different for each theme that you may as well do this?
  • Options
    I suppose this could be an extension, but this is easier than attaching to the delegate later in that theme file and parsing out the commas. On second thought, extensions are easier for users than editing core themes. o_0 If enough people want it, I can spit out an extension.
  • Options
    edited March 2007
    Hi WallPhone,

    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).' ...
  • Options
    ::slaps forehead::

    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').' '; } }
  • Options
    Works like a charm. Thanks very, very much, Wallphone. :)
  • Options
    First update Pimped my Vanilla, then make this an extension ;)
  • Options
    edited July 2007
    I cannot get the image to replace the text. I even tried just changing the [Sticky] text and it didnt work. What am I doing wrong? I'm using v1.1.2 would that make a difference?
  • Options
    I pasted the text that Mark gave above into the languages file under the conf folder, but maybe I didn't do it right. is this still the proper method?
  • Options
    VazVaz New
    edited September 2007
    Sorry for the late reply, yes it still is. I've just tried it and it works. A stupid mistake I made was that I had the images in the wrong location. Then I got it working by making it like:
    $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?
  • Options
    bump
  • Options
    If there is still interest, I would find this (in extension form, ideally) really useful. I'm looking to deploy several multilingual forums, and having images depict actions instead of words is a good thing and 2. upgrading multiple installations will make using a bit tricky, as mentioned in the thread.
  • Options
    I still get a set of empty brackets above the newly placed image [] any ideas how to remove them?
  • Options
    edited April 2009
    When the discussion is active there is NOT a icon before the discussion name how to change it? EDIT: When there is a new post how you can get there an icon Example:" When some one post a new post or start a discussion there must be an other icon
Sign In or Register to comment.