moved logic out of detail.php, using new core functions
fixed link back from discussion page if coming from root page
version 2014-05-19