HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Please upgrade here. These earlier versions are no longer being updated and have security issues.

Controller in discussion header

edited April 2016 in Vanilla 2.0 - 2.8

So i'm using Quotes (1.6.9) plugin on V2.2 without the Reaction area below.
Instead my 'Quote' is in the Comment Header.
The issue with that is that i do not have a 'Quote' link in the first post.

    public function DiscussionController_CommentOptions_Handler($Sender, $Args) {
        echo Gdn_Theme::BulletItem('Flags');
        $this->addQuoteButton($Sender, $Args);
    }

This is my code for Comment Header and it works great.
Which controller do i need to use to also add that 'Quote' link into the first post?
Somewhere in this area https://github.com/vanilla/vanilla/blob/18498916ac071fd2f9778183c3972764b022154c/applications/vanilla/views/discussion/discussion.php#L53

Full disclaimer: I have no PHP skills

Comments

  • R_JR_J Ex-Fanboy Munich Admin

    In Vanilla there is no thread which is a group of posts like it is in many other forum software scripts. Vanilla has a discussion with comments. So you only have to copy those lines and change Comment into Discussion.

    The code you have posted does the following:

    Whenever a discussion is requested (hence DiscussionController) use the event CommentOptions which is fired in the DiscussionController. Then write directly html.

    The event that you have used normally takes an array in order to add another option to the menu. I would either recommend to really make it an option or to use public function DiscussionController_BeforeCommentMeta_Handler($Sender, $Args) {.


    CrazyLemonhgtonight
  • BeforeCommentMeta does basically the same thing as CommentOptions does..just on a different place.
    It still doesn't insert the 'Quote' button in the first post of the discussion.

    It does work if i use 'AfterDiscussionMeta' tho.. so thanks for the hint.

    P.s. How do i mark this as solved?

  • R_JR_J Ex-Fanboy Munich Admin

    @CrazyLemon said:
    BeforeCommentMeta does basically the same thing as CommentOptions does..just on a different place.

    True. Using CommentOptions inserts the button into the div.CommentOptions while the other event would add it below, which feels "semantically more correct" to me, but I guess it doesn't really matter at all.

    @CrazyLemon said:
    It still doesn't insert the 'Quote' button in the first post of the discussion.

    It does work if i use 'AfterDiscussionMeta' tho.. so thanks for the hint.

    Do you know of the plugin "Eventi"? It might be helpful for you. It shows you which events are available.

    @CrazyLemon said:
    P.s. How do i mark this as solved?

    You haven't asked a question, so you cannot mark this as answered. A moderator might change the title but I guess it is not important.


  • @R_J said:

    @CrazyLemon said:
    It still doesn't insert the 'Quote' button in the first post of the discussion.

    It does work if i use 'AfterDiscussionMeta' tho.. so thanks for the hint.

    Do you know of the plugin "Eventi"? It might be helpful for you. It shows you which events are available.

    Looks a bit outdated but i'll bookmark if for future issues/features. Thanks.

Sign In or Register to comment.