Restricts the characters in username to standard English characters A-Z, numbers 0-9, and the underscore sign.
Disallow spaces among username characters.
Mention other users if you type @Nickname in the question, answer or comment contents. {Beta}
Note:
#1: Caps Lock still works, just like in Twitter and Reddit. If you want usernames to be in normal case like in Instagram, you have to add more codes by yourself. Hint: the simplest way is to convert capitalized letters into normal case.
#2: The mention feature has some drawbacks:
-
If users type emails in the content, it will not be displayed properly (can be improved if I have more time, but I don't think people will type emails these days)
-
No autocomplete when you type the usernames (if you want this, you have to sacrifice performance because you need to load ajax, as well as some MySQL queries. There is a paid plugin by pupi1985)
#3: If you want to apply specific CSS effects to the mention links, modify the code with
<a class="mention" href=......>.
a.mention { display: inline-block; font-weight: bold; font-size: 0.93em; color: red; padding: 0 4px 1px; background: silver; border-radius: 8px; }
#4: To autostart a comment with @nickname, please understand that an aswer or a question is the parent post of all comments in a group. So, all "comment" buttons return the same textarea. We can only autostart with the @nickname of the post author, not individual commentators.
Modify qa_page_q_add_a_form function in /qa-include/pages/question-view.php with these codes:
if (qa_get_logged_in_userid() != $parent['userid'])
{$form['fields']['content']['value'] = '@'.$parent['handle'];}
You can only override this function indirectly by overriding qa_routing function, so if you are lazy, just hack Q2A core.