Never mind on the second part about the URLs to hierarchical groups. I just modified the Forum Extras plug-in to handle that. It wasn’t that bad. I probably didn’t do it as nicely as a veteran PHP coder would, but it works.
I’d still like some help with the first part, though. There are so many functions involved in these loops that it gets a little confusing.