In the process of rebuilding my website at with the beta version of Joomla 1.7, I kept running into an issue whenever I added any custom HTML code into the site. Whenever I created a module to add the custom code required to use StatCounter or other custom modifications, the code would be mangled or deleted completely every time the module was saved.

To overcome this you need to modify 2 things in Joomla.

First of all go to the Plug-In Manager, which is on the Extensions menu and click on the “Editor -TinyMCE” option. In the Basic options menu that is on the right hand side of the page, go to the “Prohibited Elements” section and remove all the items there and just replace it with the word “cms”. All this does is stop TinyMce from looking through you code and deleting any of the previously listed elements. Apparently you do need to leave something in this box and of course “cms” is not a legal HTML element so will never find it in the code, so should just leave your code alone.

The second thing you need to do is go to the article manager which is under the content menu. Once the article manager shows, select the options box on the far right of the screen. A pop up window will appear and you need to navigate to the text filters tab. Then move down to the Super Users tag and change the option from “Black List (Default)” to “No Filtering”; then click the save and close button. What this box does is allow you to add any custom code that you want, so be careful you don’t add any code that any malicious users can use on your site as an HTML exploit. The second item in particular is not an obvious modification to make, and although it does preserve the integrity of your site for all the other kinds of site users, it destroys any capabilities you have as the site administrator to add any needed custom HTML.

Personally, I think the creators of Joomla should make this much clearer and perhaps ask whether this should be turned on or off during the site install process. I hope this helps at least one person from spending hours wondering why Joomla is killing all your neatly crafted custom HTML modules! I’m pretty sure this will equally apply to 1.5 and 1.6 based sites as well as 1.7, but please let me know if you find anything to the contrary.    

EDIT: MARCH 2012 - Joomla 2.5 handles this all in a much more sensible manner now, but I'll leave this article here for reference.