Fix bug in the way doc permalinks are built inside of groups

Using is_singular() is not a sufficient check because any groups pages is
technically part of the Groups WP page.
1.5.5