One of the most important lessons to learn online is "don't feed the trolls." This idea is similar to the age-old concept of how to deal with a bully—the user is looking for attention, and any reaction you give them gives them exactly what they want.
"Troll" is an internet slang term referring to an individual who posts what are often controversial or inflammatory remarks—these remarks can also be as simple as irrelevant or off-topic messages—on an online community with the intention of provoking other users into a heated response to disrupt the community. Be cautious, though; "trolling" is subjective. What one user considers a troll comment may be seen by others as a legitimate contribution, even if it is somewhat controversial. Assume good faith until proven otherwise.
Another form of a troll is a "vandal," someone who deliberately vandalizes or defaces a wiki and/or pages on that wiki. This can be non-vulgar or non-explicit gibberish, or as bad as explicit content and vulgarity. "Spammers" can also be similar to vandals, leaving advertisements for other websites on unrelated articles, talk pages, and forums.
How do I deal with these users?
If you know that a user is acting in bad faith and is trolling, vandalizing, or spamming, do not "feed" them with emotional responses, over-reactions, and other heated replies. Never engage a vandal or a troll in conversation, and never demand that they "stop vandalizing or face the consequences." Vandals know that they are breaking the rules, so all this does is acknowledge them and give them the attention they are looking for. Excited and dramatic reactions encourage them to continue or escalate their bad behavior, to see just how upset you will get. Sound childish? It is. Remember not to reply in kind.
So what do you do, then? Obviously on wikis, administrators and helpful users have to react a little bit, but these reactions must be as calm and as limited as possible. All you need to do is fix the mess. There are three simple things to do: revert, block, and ignore. Revert the bad edits they made to restore the page back to the way it was before they vandalized it, and block the problem user so they cannot continue their bad edits.
Next comes what can be the hardest part: ignore them. You've blocked them and reverted their edits. You don't need to do anything else other than going back to doing what we're all here to do—making wikis fantastic resources for everyone who loves their subjects!
What if I need help?
More often than not, using the "revert, block, ignore" method and getting back to business as usual on the wiki works. Every so often, though, vandals pose enough of a problem that local administrators need additional support, so they can contact Wikia staff to get help with blocking or repairs.
Do you have any more advice?
There have been a number of methods for dealing with problem users like this, some methods that were good and some that were not. Here are a few methods that are not the appropriate way to handle these situations:
Creating pages, templates, or categories that "mark" vandals and trolls. This is a good faith attempt at letting people know who past vandals have been, but it only gives trolls the recognition they are looking for.
The creation of "anti-vandal" groups and campaigns. For many vandals and trolls, they consider what they do to be a game. By creating groups and campaigns like this, you end up playing the game—and the trolls decide to have more fun by continuing their bad edits.
Leaving angry or derogatory words in block messages and/or talk pages. This can encourage troublemakers to return and retaliate in order to "get the last word in."
If the user vandalized a page for the first time, it's a good idea to revert it and give a warning or reminder before blocking. If the user continues to vandalize, it's a good choice to contact any active administrators so they can block the user or block them yourself if you are an administrator. Also, if the user is vandalizing more than one wiki, its a good idea to tell Wikia staff or VSTF to globally block the user.