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

Is it possible to have #hashtag and @mention hyperlinks appear on the headline on the comments page?

I know you can make them appear on the discussions list as those are links and @hgtonight explained here:

However, I was wondering if it's in anyway possible to customise so you can make those hyperlinks appear in the headline on the comments page also, just like you can on Twitter?

This would be great as users can put @mentions and #hashtags in the headlines and they will be clickable when looking at the main comments page


  • Options
    hgtonighthgtonight ∞ · New MVP

    I am confused as to what you are trying to do. Could you create a screenshot of what you want to do/where the hashtags should appear?

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • Options

    Yes here is a screenshot showing at the top an example of links showing in the headline and below is a screenshot of this page with no links in the headline!

  • Options

    It is called a title.

    Why you would want to do this? It would encourage poor quality titles IMO.

    Acording to this code discussion model it should already notify.

                   // Notify users of mentions
                   $DiscussionName = ArrayValue('Name', $Fields, '');
                   $Usernames = GetMentions($DiscussionName);
                   $UserModel = Gdn::UserModel();
                   foreach ($Usernames as $Username) {
                      $User = $UserModel->GetByUsername($Username);
                      if ($User && $User->UserID != $Session->UserID) {

    I noticed something odd in the code though The code to formatting (replacing) the mentions is Gdn_Format::Mentions() the code for getting the matches is GetMentions They both allow for overide with

    $Formatter = Gdn::Factory('MentionsFormatter'); except that is confusing matching with replacing. So if anyone uses that override it would break the notification or they would need to tell if they are in the model or not. It would make more sense to have $Matcher = Gdn::Factory('MentionsMatcher');

    grep is your friend.

  • Options
    R_JR_J Ex-Fanboy Munich Admin

    @TownFish said:
    Yes here is a screenshot showing at the top an example of links showing in the headline and below is a screenshot of this page with no links in the headline!

    I guess @hgtonight has answered that question here:

    Don't focus on the code, he also said this:

    @hgtonight said:
    (...) It would only work on the individual discussion page (since the title is a link in the discussions list).

    So basically it is easy for a page where the title is not a link. When the title is already a link to the discussion, like in the Recent Discussions view, it would be a little bit harder, though not impossible. If I understand your job right, you're doing research and have developers who do the work for you*.

    You cannot simply replace the title like that:

    public function DiscussionsController_BeforeDiscussionContent_Handler($Sender) {
       $Sender->EventArguments['DiscussionName'] = Gdn_Format::Mentions($Sender->EventArguments['DiscussionName']);   

    This would output nested links in the discussion list, which is not allowed and would break the html.

    But the discussion title is echoed with that command in the WriteDiscussion function: Anchor($DiscussionName, $DiscussionUrl); and your developers can override the function Anchor so that it takes care for nested profile and hashtag links. That function is in /library/core/functions.render.php. If that is done, you can hook into the relevant FireEvents like shown above and that should work.

    * = oh man, I’m really jealous! I wish I could just say: hey, hgtonight, tonight I dreamed of a new plugin that can do this and that. I'd like you to show me the first drafts on Monday. Thanks. Ah, and when you leave my room, can you please send in x00 and peregrine? I've had a good sleep with a lot of dreams tonight - well, forget about it. Lets have a meeting after lunch with all my dozens of developers in the big conference room!
  • Options

    Tbh TownFish if these developers are around, theywould better off learning the framework, rather than yourself trying to get together scrap of code.

    grep is your friend.

  • Options

    Thanks for everyone's info and @x00 you are right, they are learning the framework and customising it like you wouldn't believe, although I am quite far ahead of where they are in the development, in terms of scoping the website and designing new concepts - they are not in-house so communication goes on via email, but I think now I have enough answers on here to understand what is and isn't possible.

    Also the reason why we would want to add links to the posts is becuase currently our community is on our Twitter feed and they communicate with each other through that using hashtags and @mentions. Twitter in fairness is limited, since there are tags on Vanilla here #hashtags are not so neccesary and I actually agree it will encourage messy and poor quality titles, I just want to explore the option.

    Is it possible to make the discussion block on the list page clickable rather than the actual text which is what Twitter does and how they are able to put hyperlinks with the title text (or tweet)?

  • Options
    R_JR_J Ex-Fanboy Munich Admin

    As you've said somewhere else: everything is possible ;) Most things could be done quite easily while other things need some effort.

    If I look at the discussions list, I wouldn't know where to insert the clickable area.
    You can insert a few lines of the discussion body and make that div clickable, though. There are some plugins that do something similar. Maybe something like that:

  • Options
    R_JR_J Ex-Fanboy Munich Admin
Sign In or Register to comment.