Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.

[Free Plugin] Hashtagger v1.1

+26 votes
asked Feb 11, 2014 in Plugins by Victor

Hashtagger is a free plugin for Q2A which automatically converts hashtags (#some_word) and mentions (@some_name) into HTML links when users publish/edit questions, answers or comments.

When a user submits a message, the plugin will replace hashtag (#some_word) with HTML link to the tag page. For example: the #free-plugin will be replaced with <a href="/tag/%23free-plugin">#free-plugin</a>. Please note, that all missed tags will be automatically inserted into question tags, with no matter where it was added — question, answer or comment. This is done to prevent broken links.

When a user submits a message, the plugin will replace mention (@some_name) with a HTML link to user profile and will send an email to the mentioned user. For example: the @admin will be replaced with <a href="/user/admin">@admin</a> and he will receive an email which contains the name of user which mentioned it and a full URL where he can read the message. Please note that plugin will skip mention, if mentioned user cannot be found in database.

Depending on options of the URL structure, on your site the URL examples specified above may have a different format, as the plugin automatically detects which URL format need be used

In Administration Centre you can enable or disable any of the following options:

  • Handle questions
  • Handle comments
  • Handle answers
  • Enable hashtags (convert #some_word to tag link)
  • Keep "#" symbol for tags names
  • Enable mentions (convert @some_name to user profile link)
  • Notify the user when it is mentioned


  1. Download hashtagger.zip
  2. Extract files to the ./qa-plugin/ directory
  3. Enjoy!
Q2A version: 1.6.3
commented May 27 by q2a.info
@Kappagantula Aditya, you can download plugin from below location.

Let us know if you see any issues, we can improve.
commented May 30 by Kappagantula Aditya

I was playing around this plugin and i am confused about what is the username field that will get converted to a hyperlink and how the notifications work?

Are there any special instructions for external-user integration?

Is there any db table that we need to create ?
Any set of instructions on making this plugin work would be great!

Thanks in advance!
- AK

12 Answers

+2 votes
answered Feb 14, 2014 by rgd
Thank you very much. I activated hashtagger with Q2A 1.6.3 and is working fine.
0 votes
answered Feb 14, 2014 by amiraldo1

Thank u, it does not work with version 1.6.2 :( 

Disabled - requires Question2Answer 1.6.3 or later

commented Feb 18, 2014 by Victor
I cannot test it now and I don't know if will work for 1.6.2, but you can edit the plugin file (./qa-plugin.php) and instead of "Plugin Minimum Question2Answer Version: 1.6.3" write "Plugin Minimum Question2Answer Version: 1.6.2"
commented Feb 18, 2014 by amiraldo1
i have tested, it and it"s work.
for next version :)
1- add autosuggest box under the textarea, then can user select tags or username that are from 2 word or more.
0 votes
answered Feb 18, 2014 by yerbol89kz
Very nice plugin. Everything works with Latin characters, but does not work with Cyrillic characters. Please what can be done to Cyrillic character work?
commented Feb 18, 2014 by Victor
Very strange, because I have tested it and its works perfectly with Russian. Maybe your server is not configured properly? Anyway, try to replace in ./qa-plugin.php all "\w" with "\pL". Please let me know if it worked.
commented Feb 18, 2014 by yerbol89kz
Thank you Victor. Works fine. Changed codes qa-hashtagger.php all "\w" with "\pL"

p.s. Спасибо большое. Все работает отлично без проблем. Я вот хотел спросить как можно решить проблему с пробелом? Так как у меня на сайте люди заригиструется например Иван Иванов.
commented Feb 18, 2014 by Victor
Great. I’ll add this fix in the next release.

ps. Рад то смог помочь. Насчёт пробелов — очень трудно сделать, так чтобы всё работало нормальным образом. Дело в том, что плагин не может «знать» если после пробела идёт слово или имя пользователя. Более того, в имени пользователя могу быть более двух пробелов и почти нереально угадать кому было адресовано сообщение (например, если у вас есть такие пользователи «Иван», «Иван Иванов» и «Иван Иванов Димитрович»). Единственное что можно сделать, так это запретить пользователям использовать пробелы в имени пользователя.
0 votes
answered Feb 18, 2014 by yerbol89kz
Can I remove links from a tag rel="nofollow" . Since these links on the tag and opt user within the site.
commented Feb 18, 2014 by Victor
The "nofollow" is added when the page is displayed (not when saved). This is why you should use another solution which removes the "nofollow" attributes.
commented Feb 18, 2014 by yerbol89kz
Hm. Thnaks. It's clear.
0 votes
answered Feb 22, 2014 by yerbol89kz

How can I fix the problem with the question. At issue hashtag works but seems ID, issue the following link. And in response to the comments and works without problems.

+2 votes
answered Mar 26, 2014 by amstaff
Hi, thanks for your plug-in. I love it and works fine! I noticed just a little issue using "wysiwyg-editor" plug-in. If you edit the text, applying a color, the hashtagger plug-in automatically reads colors like #cccccc as hashtag. So the colors don't be applied on text and the plug-in creates new hashtags for each color applied on text. For now I disabled the color palette from the editor with this code in my css, waiting for a fix:

#cke_14 {display:none !important;}

Sorry for my english, best regards
commented Jun 13, 2014 by q2apro
@Victor: This is a good point, the plugin should ignore all # within <tags>, this way this bug can be prevented. Probably this needs a DOM parser. That's why I would, by the way, implement this plugin in jquery ;) http://stackoverflow.com/a/21422891/1066234
0 votes
answered May 8, 2014 by bobbyscon
This is a great plugin! Thanks so much!

Only request/question I have is if there's a way to override the tag requirement if a hashtag is used. I have our site set up so that questions require at least 1 tag in order to be posted. It would be really nice, and I'm sure a giant pain to code, if the # tagged items in the body text could count towards that limit so that users don't have to enter them twice. I know I could turn off the requirement, but I know half of our users will use the # indicator while the other half will use the tag field.

Thanks again for the great work and for making it FREE!
0 votes
answered Dec 17, 2015 by vdamanafshan

The plugin works fine except that it doesn't work for  usernames like john smith. Is there a way to fix this problem?

commented Dec 17, 2015 by fara
You could use @john+smith.( I didn't test this but I think it works)
commented Dec 17, 2015 by vdamanafshan
@fara: Your solution didn't work:-(
commented May 7, 2016 by Praneeth Nilanga Pei
Any solution for this?
+2 votes
answered May 7, 2016 by Praneeth Nilanga Pei

This only captures the user names which are wither single word or in the format of demo-admin or demo_admin. But it won't accept users with two names which is the case in most of the scenarios. If we ask the users to type "+" instead of a space, how could the user name matching can be changed to @(?P<name>[\w\-\+]+) . But how can I derive the actual user name out of it ?

Please help.

Update :

I used the above regex to validate a user name (where the space is considered as a +), then I changed the build_user_link function as below.

private static function build_user_link($match)
    $match['name'] = str_replace('+', ' ', $match['name']); // I added this line
    $userid = qa_handle_to_userid($match['name']);
    if ($userid) {
        self::$userids[] = $userid;
        $url = qa_path_html("user/{$match['name']}");
        return "<a href='{$url}'>@{$match['name']}</a>";
    else {
        // If user does not exists in DB the string is returned as is
        return $match[0];
commented Oct 7 by hasan tahsin
did not work as well in 1.7.5
should i miss something? This is the most clever and best possible way to solve the issue. But it did not :((
commented Oct 7 by hasan tahsin
finally it worked. Praneeth Nilanga Pei you are genius :)
+2 votes
answered May 15, 2016 by Tibriz

in the question form if I mention a user, it changes it to:


as you know it must be without the question number, so that a correct user link. 

BTW it works fine in answers, why in questions?

0 votes
answered May 30, 2016 by artdesigner

Thank you very much!!! 

+2 votes
answered Apr 12 by Aykut Büyükkılıç
Thanks, but download link is broken. Can you upload hasttagger.zip again :)
commented May 27 by q2a.info
@Aykut Büyükkılıç, you can download from here