Potential good fix for “session_start()” issues in TDO Mini Forms

A lot of people have had problems with “session_start()” using TDO Mini Forms. TDO Mini Forms up to version 0.9.1, uses the WordPress action hook “get_header” to try and call “session_start()” before anything else is output to the browser. This is a haphazard approach as many themes don’t use “get_header” or they leaving spaces before calling get_header etc. etc. The solution was to try and put session_start() at the top of some of the theme’s pages.

I’ve done some experimentation and I’ve changed from using the action hook “get_header” to “template_redirect” which should get called before any theme pages are called. This would allow you to change and modify your theme without worrying about session_start for TDO Mini Forms. However, I’m not entirely confident it’ll work in all cases, so I’m looking for anyone willing to test it?

You can download the updated version from WordPress.org’s svn. This version also has an option to hide error messages from the user, in case your getting incorrectly reported errors, which seems to happen occasionally to some users. It’d be great if people tried this version of the plugin with their unmodified themes and report back here. If everything is good, I’ll make an 0.9.2 release with these fixes. Thanks everyone.

BTW, if your getting “TDOMF: Bad data submitted…” when you submit a post but you have no other errors, this may be because you have register_globals enabled. Having register_globals enabled is actually a security risk and WordPress takes some preemptive solution to prevent that… by reseting all the values in $_SESSION to NULL. This will prevent TDO Mini Forms from working. With the updated version, there is a check performed and if you go to the main TDOMF menu, you will see an ERROR if it is an issue for your installation.

Related Posts: