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.
Move DiscussionPrefix() into Discussion class
There is a function DiscussionPrefix() function found in Vanilla.Functions.php that could be moved into the Discussion class. Then it would be nice to add a delegate to that function so that extensions could add their own tags in the prefix.
The existing DiscussionPrefix() function could remain as a stub that returns the member of the Discussion object passed to it. Or not, if you don't mind breaking existing templates.
The existing DiscussionPrefix() function could remain as a stub that returns the member of the Discussion object passed to it. Or not, if you don't mind breaking existing templates.
0
This discussion has been closed.
Comments
In library/Vanilla/Vanilla.Class.Discussion.php, add the following lines after line 230:
function DiscussionPrefix() { $Prefix = ''; if (!$this->Active) $Prefix = $this->Context->GetDefinition('TextHidden'); if ($this->Sticky && $this->Context->GetDefinition('TextSticky') != '' && $Prefix != '') $Prefix .= ', '; if ($this->Sticky) $Prefix .= $this->Context->GetDefinition('TextSticky'); if ($this->Closed && $this->Context->GetDefinition('TextClosed') != '' && $Prefix != '') $Prefix .= ', '; if ($this->Closed) $Prefix .= $this->Context->GetDefinition('TextClosed'); if ($this->Bookmarked && $this->Context->GetDefinition('TextBookmarked') != '' && $Prefix != '') $Prefix .= ', '; if ($this->Bookmarked) $Prefix .= $this->Context->GetDefinition('TextBookmarked'); if ($this->Sink && $this->Context->GetDefinition('TextSink') != '' && $Prefix != '') $Prefix .= ', '; if ($this->Sink) $Prefix .= $this->Context->GetDefinition('TextSink'); if ($this->WhisperUserID > 0 && $this->Context->GetDefinition('TextWhispered') != '' && $Prefix != '') $Prefix .= ', '; if ($this->WhisperUserID > 0) $Prefix .= $this->Context->GetDefinition('TextWhispered'); $this->DelegateParameters['Prefix'] = &$Prefix; $this->CallDelegate('PostDiscussionPrefix'); if ($Prefix != '') return $this->Context->GetDefinition('TextPrefix').$Prefix.$this->Context->GetDefinition('TextSuffix').' '; }
In library/Vanilla/Vanilla.Functions.php, replace lines 22-40 with the following:
return $Discussion->DiscussionPrefix();