Clean up groups_template global in bp_docs_doc_associated_group_markup()

On single doc pages, the pollution of the $groups_template global by this
function was causing the page to be rendered nearly infinitely on large sites,
because of the bp_has_groups() loop on groups/single/home.php template. By
keeping a backup of the global and replacing it when we're done, we ensure that
this looping does not happen

Yowza