Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+8 votes
7.4k views
in Plugins by
edited by

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!

by
So wich plugin i should use, from noahy or from Scott ?
by
I'm trying to keep up with Scott's modifications (Scott, please let us know when you update :) ), so the only difference should be mine has the optional jQuery check for new users submitting new tags.
by
@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 :)
by
No, I've merged your changes, if you've put them on github... please see my latest source.

3 Answers

+2 votes
by
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.
by
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.
by
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
by
edited by

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:

by
Okay, I've merged them... you can try to pull my changes now, not sure if github will do it for you.

I've also fixed the notification to mimic the built-in style.
by
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/
by
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)
by
I have selected "Prevent new users from creating new tags "
and input 200 in "Minimum reputation to create new tags"
But still the user who has less than 200 points can create new tags.
Please guide me.
+1 vote
by
Hi there,

Thank you guys for sharing your plugin with us

The option below is not working at all!. I tested it in 1.5.2 and 1.6.2 it doesnt seem to be doing anything!

The option "Prevent new users from creating new tags" adds a Javascript barrier preventing low-rep users from creating new tags. Currently there is no way to replicate this on the server side without hacking the core, but that will rarely be a problem.
by
Saem issue here
...