sp_the_forum();
                $out .= sp_ProfilePermissionsForum($spThisForum, $userid);
                # do subforums
                if (!empty($spThisForumSubs)) {
                    foreach ($spThisForumSubs as $sub) {
                        $out .= sp_ProfilePermissionsForum($sub, $userid);
                    }
                }
            }
        } else {
            sp_NoForumMessage('tagClass=spMessage', sp_text('No Forums Found in this Group'));
        }
        $out .= '</div>';
    }
} else {
    sp_NoGroupMessage('tagClass=spMessage', sp_text('Access denied'), sp_text('No Groups Defined'));
}
$out = apply_filters('sph_ProfileUserPermissionsFormBottom', $out, $userid);
$out = apply_filters('sph_ProfileFormBottom', $out, $userid, $thisSlug);
$out .= '</div>';
$out = apply_filters('sph_ProfilePermissionsForm', $out);
echo $out;
# routine for outputting forum or subforum row
function sp_ProfilePermissionsForum($thisForum, $userid)
{
    global $thisAlt;
    # Start the 'forum' section
    $out = "<div class='spGroupForumSection {$thisAlt}'>";
    # Column 1 of the forum row
    $out .= '<div class="spColumnSection spProfilePermissionIcon">';
    $icon = !empty($thisForum->forum_icon) ? sp_paint_custom_icon('spRowIcon', SFCUSTOMURL . $thisForum->forum_icon) : sp_paint_icon('spRowIcon', SPTHEMEICONSURL, 'sp_ForumIcon.png');
                sp_ColumnStart('tagClass=spColumnSection spRight&width=32%&height=55px');
                sp_ForumIndexLastPost('tagClass=spInRowPostLink&nicedate=1&date=0&time=0&stackdate=0', __sp('Last Post'), __sp('No Topics'));
                sp_ColumnEnd();
                # Column 3 of the forum row
                # ----------------------------------------------------------------------
                sp_ColumnStart('tagClass=spColumnSection spRight&width=14%&height=55px');
                sp_ForumIndexTopicCount('tagClass=spInRowCount', __sp('Topics'), __sp('Topic'));
                sp_ForumIndexPostCount('tagClass=spInRowCount', __sp('Posts'), __sp('Post'));
                sp_ForumIndexStatusIcons('tagClass=spStatusIcon spCenter', __sp('This forum is locked'), __sp('This forum has unread posts in %COUNT% topic(s)'), __sp('Add new topic in this forum'), __sp('No permission to start topics'));
                sp_ColumnEnd();
                sp_InsertBreak();
                sp_ForumIndexSubForums('unreadIcon=sp_SubForumUnreadIcon.png', __sp('Sub-Forums'), __sp('Browse topics in %NAME%'));
                sp_SectionEnd('', 'forum');
            }
        } else {
            sp_NoForumsInGroupMessage('tagClass=spMessage', __sp('There are no forums in this group'));
        }
        sp_SectionEnd('', 'forumlist');
        sp_SectionEnd('', 'group');
    }
} else {
    sp_NoGroupMessage('tagClass=spMessage', __sp('The requested group does not exist or you do not have permission to view it'), __sp('No groups have been created yet'));
}
sp_SectionEnd('', 'groupView');
sp_RecentPostList('show=10', __sp('Unread and recently updated topics'));
sp_SectionEnd('', 'body');
# Load the forum footer template - normally last thing
# ----------------------------------------------------------------------
sp_SectionStart('tagClass=spFootContainer', 'foot');
sp_load_template('spFoot.php');
sp_SectionEnd('', 'foot');