- Installing Discuss
- Setting up the necessary Resources
- Setting up Friendly URLs & Discuss specific rewrite rules
- Configure Discuss to match your environment.
- Setting up Login, Register & Update Profile pages with Discuss
- See Also
Installing Discuss is pretty simple using the MODX Package Manager. Just download the discuss package and run the installer as you would for any other package. While you're in the package manager, you will also need to download and install the following Extras which are required for Discuss to work properly:
During the installation, you are given the option to install demo data, if this is the first time you are installing Discuss, make sure to enable this so you have some working data to see once you've installed everything!
Once you installed Discuss using the Package Manager, there are a few steps and configuration you need to go through in order to set up a working forum solution. These are:
- Create the necessary Resources
- Set up Friendly Urls and Discuss-specific rewrite rules
- Configure Discuss to match your environment.
We will go through all of these steps below.
Discuss uses only one resource to show many different views, so you will need to create this one when you first set up your forum.
Simple create a new resource with the following attributes:
- Pagetitle: Forums
- Template: empty
- Alias: forums
- Content: [[!Discuss]]
- Container (on the Settings tab): Yes
You can change the alias to suit something else if you want, but keep in mind that you will need to adjust the custom rewrite rules as shown in the next step to match your alias.
While Discuss includes login and sign up functionality (using the Login package), you will most likely want to use specific or already existent login and registration pages for your forum. This is accomplished using the so called SSO mode (we'll discuss this later), and it requires you to set up separate resources for login, registration and update profile resources. Please create those now.
You can build these as you normally would (see the Login documentation for more information on them) and there are no requirements on how they look or are build. There is one important thing to include in your login, register and update profile pages, which is pre and posthooks specific to Discuss:
So be sure to add those to your snippet calls.
Further down on this page there are more instructions on setting up your Login and Update Profile resources.
Discuss only works with friendly URLs right now, so to start, make sure to enable friendly urls in MODX. Go to system > system settings and limit the view to the "Friendly URLs" area. Enable use_friendly_urls and customize other settings as you see fit. Usually it's a good idea to enable automatic_alias and use_alias_path as well, but neither really affect Discuss.
After Friendly URLs are set up, you will need to add some specific rewrite rules for Discuss to make it working. Below you will find code snippets you can copy/paste for use in .htaccess files on apache, as well as a config blurb for nginx.
Make sure to add this BEFORE the regular MODX rewrite rules in your .htaccess but AFTER the RewriteBase. If you have used a different alias than "forums" in your Discuss resource, or the forums are in the root of the site, make sure to replace all occurences of "forums" below accordingly.
Remember, change "forums" if your alias is different.
Suggested set of rules (called before your main rewrite for MODX):
Here's another more extensive set of rules that also rewrites SMF rules to the proper Discuss ones.
Now that friendly urls are working, we're ready to configure Discuss. As most of this configuration is done in System settings, open that through System > System settings and choose the "discuss" namespace to see Discuss specific configuration.
- discuss.forums_resource_id - Point this to the ID of the Resource your Discuss forum resides in.
- discuss.login_resource_id - Point this to the ID of the Resource your Login call resides in.
- discuss.register_resource_id - Point this to the ID of the Resource your Register call resides in.
- discuss.update_profile_resource_id - Point this to the ID of the Resource your UpdateProfile call resides in.
- Set discuss.sso_mode to yes. This will make Discuss let your own login, register and update_profile pages instead of the ones built in.
Some other nice configuration options to change or to keep in mind:
- When you are going to build a custom theme, enable the discuss.debug_templates setting to automatically add HTML comments on what chunks are being used to build the output.
- The discuss.theme setting is used to load the proper templates and assets. For now, default should do, but change this when you want to use a different theme. Just give it the name of the theme dir in the "themes" directory of Discuss.
- Set discuss.forum_title to the name of your forum.
- By default (if the theme uses it, that is) Discuss uses a simple text search engine, but you can enable Solr search by setting discuss.search_class to disSolrSearch and filling out the relevant solr setting.
While this bit of installation is technically not a part of Discuss, here's some instructions on setting up your login, register and update profile pages when using SSO mode.
Make sure in your Login call that you specify the following as pre and post hooks:
This will allow Discuss to add extra functionality to your Login methods.
Make sure you add the members to the "Forum Members" User Group, so that they will have forum access. This can be done via:
In your Register call.
A few things need to happen with UpdateProfile.
One, make sure you add the following post-hook to your UpdateProfile call:
Then, after the UpdateProfile call, place this snippet call:
Finally, there are some extra form fields you can add to allow users to modify their Discuss profile:
The prior fields will allow your users to toggle those values in their profile.