[b]Q:[/b] How do I remove or delete the forum container entries from the 'Forums:' dropdown on the 'New Topic' form? If a user chooses a forum container rather than an actual forum and then tries to create a post an error message like 'The item [Container Name] is only a container for forums. Please select one of the forums below it.' is displayed - this is really annoying the client!
[b]A:[/b] One way to get around this problem is to install the Banish Forum Containers module that we developed specially to get us out of this particular hole. It removes the forum containers from the dropdown list and instead displays the forum names pre-pended with the container name in a format like this:
[Forum Container Name] - [Forum Name]
Shane and I spent quite a bit of time searching for a solution to this problem, while our client was quite rightly jumping up and down and shaking his fists! The problem can arise when developing a website that has multiple forums partitioned into different forum containers. Websites running [url=http://drupal.org/project/og]Organic Groups[/url] with [url=http://drupal.org/project/og_forum]OG Forum[/url] often fall into this category.
When users create a new topic they are presented with a drop-down from which they choose a forum to post into. The drop-down shows the forums grouped by forum container, and it is possible (and quite easy) to choose a forum container, rather than a forum, by accident. If you do this and try to save the new topic you just get an annoying error message like: [i]'The item [Container Name] is only a container for forums. Please select one of the forums below it.'[/i]
It is not always obvious which are forums and which are containers and so this problem can be encountered quite a bit.
In the screenshot above, the forums begin with '-', it is easy to get them mixed up with the containers that don't!
We spent ages looking for a module or some other fix for the problem, but couldn't find anything, that's not to say that there isn't one - but we couldn't just didn't find it, please lt us know if there is another solution!
We ran out of time and decided to try to fix it ourselves. What we figured we'd do was write some code to remove the containers from the dropdown and modify the forum names so that they start with the container name. In this way the error can't occur and you can still tell which container each forum belongs to.
In the screenshot above, the containers have been removed and the forum names have been changed...
We decided to write a module to implement
hook_form_alter() which would modify the select options for the 'Forums:' dropdown. The module's details are a bit on the dry side for explaining here, but the module can be downloaded from Drupal.org.
To install it just copy it to your [i]sites/all/modules/[/i] directory and enable it in the modules page, there are no settings.
If you want to change the format of the altered forum names, and are feeling brave, then you can edit [i]banishforumcontainers_forum_name.tpl.php[/i] which is to be found in the [i]banishforumcontainer[/i] directory. Just copy it into your theme folder, edit as required and flush your cache.
We haven't released it to the drupal community as a proper module yet as we don't know if it is the best solution and we don't have time to properly support it etc. (what with being so busy designing & developing cracking websites for our clients in Cork!). If you guys find it useful, please let us know and we will consider releasing it properly to the community.
The module has worked out great for us, but please use it at your own risk...
If you do find it useful, or you encounter problems please let us know!