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

If you have questions about the platform, click here to ask and please use English.

If you just want to try Q2A, please use the demo, which also grants admin access.

Apr 29: Q2A 1.5.2

New plugin - Tag Synonyms (auto-editor)

+4 votes

I've just finished the first draft of a "tag synonyms" plugin. The idea is to avoid repeated similar tags - this site for example has 49 questions tagged users and 32 tagged user. With this plugin you can choose one and new questions will automatically rewrite 'user' to 'users' (or vice-versa, whatever you choose!).

I've set up a Github account to hold all the Q2A stuff I develop. The Tag Synonym plugin is here. You can download a zip file and extract that to a subfolder in qa-plugins. Then head to /admin/plugins to add your tag synonyms (one pair per line, separated by a comma).

Known issues:

  • It doesn't yet retag older questions but I am working on an option for that. DONE
  • If you set a tag to be deleted and the user only uses that tag, you will end up with an untagged question, even if you've set a minimum number of tags. Unfortunately I don't see a way round this currently. A Javascript solution like the one NoahY posted may be the way to go.

I'd appreciate any feedback!

asked Aug 16, 2011 in Plugins by DisgruntledGoat
recategorized Nov 13, 2011 by gidgreen
@Another one, I will likely fold Noah's changes into my version soon. Noah's doesn't retag older questions (since he branched it before I added that) so if you want that feature use mine and update it later.
Noah, I'll keep a notes of updates here. You can also follow my repo on Github :)
No, I've merged your changes, if you've put them on github... please see my latest source.

2 Answers

0 votes
Sounds great :) One thing that would really help is to restrict new tags to a specific member level, ala stack exchange; that would certainly ameleorate this problem.
answered Aug 16, 2011 by NoahY
Yes that is true, but that would need to be done in the core code, because this plugin is run *after* the post is already saved to the database. Therefore it can't "interject" to tell the user not to use a certain tag.

One issue with this plugin is that it ignores the minimum/maximum tags you set. If you set the tag "help" to be deleted and the user only puts "help" as their tags, you'll end up with an untagged question.
Yeah, it would be a whole other project, or aspect of the same project... but you could do it the same way I worked the ajax comment submission - hack the submit button to let you check.  Probably pretty easy, actually, given there's already ajax tag recognition in the core.  I'll take a look :) first to download your code.
0 votes

I don't know if this is the proper way to go, but my feeling is, better a few comprehensive plugins than many specialized ones, so I've added tag checking to your plugin... forked on github, the source is here:

https://github.com/NoahY/Q2A-Tag-Synonyms

All it does is check your reputation (unless you are expert level), and if you don't qualify, it gives you a "button", rather than a submit.  When you click the button, if one of your tags doesn't exist, it returns an error.  If they all match, it calls .submit() on the form.

As I think about it, you could still submit the form by editing the page in, say, firebug.  To really stop new tags from being submitted, you'd have to edit the core, I guess.  I doubt anyone's really that paranoid about new tag submission, though, and this works for most cases, I think.

Edit: screenshot:

answered Aug 17, 2011 by NoahY
edited Aug 17, 2011 by NoahY
Can you issue a "pull request" back to me? AFAIK you need to do that before I can integrate your changes. See here for more info: http://help.github.com/send-pull-requests/
Okay, I did... but you can also just merge it with git:

git remote add noah git@github.com:NoahY/Q2A-Tag-Synonyms.git
git pull noah master
git mergetool (if necessary)