2010-12-11 06:01:19 +01:00
|
|
|
# Installation
|
|
|
|
|
2012-12-17 20:53:16 +01:00
|
|
|
## Composer
|
2010-12-11 06:01:19 +01:00
|
|
|
|
2012-12-17 20:53:16 +01:00
|
|
|
Edit your project-wide composer.json file as follows; in the "require" block add:
|
|
|
|
|
|
|
|
"silverstripe/comments": "*"
|
|
|
|
|
|
|
|
Then in the root of your project run:
|
|
|
|
|
|
|
|
#> composer update silverstripe/comments
|
|
|
|
|
|
|
|
## Web
|
|
|
|
|
|
|
|
To begin the installation first download the module online. You can find the version
|
|
|
|
you require for your SilverStripe installation on the [silverstripe.org](http://www.silverstripe.org) website.
|
|
|
|
|
|
|
|
After you have finished downloading the file, extract the downloaded file to your site's root
|
2010-12-11 06:01:19 +01:00
|
|
|
folder and ensure the name of the module is `comments`.
|
|
|
|
|
2012-12-17 20:53:16 +01:00
|
|
|
## All
|
|
|
|
|
2010-12-11 06:01:19 +01:00
|
|
|
Run a database rebuild by visiting *http://yoursite.com/dev/build*. This will add the required database
|
|
|
|
columns and tables for the module to function.
|
|
|
|
|
2012-12-17 20:53:16 +01:00
|
|
|
If you previously had SilverStripe version 2.4 installed then you'll also need to run the migration script
|
|
|
|
provided. More information on this is provided in the next section.
|
2010-12-11 06:01:19 +01:00
|
|
|
|
2012-12-17 20:53:16 +01:00
|
|
|
## Enabling Commenting
|
2010-12-13 00:48:20 +01:00
|
|
|
|
|
|
|
Out of the box the module adds commenting support to all pages on your site. This functionality can be
|
|
|
|
turned on and off on a per page basis in the CMS under the `Behaviour` tab for a given page. Once the `Allow Comments`
|
2012-12-17 20:53:16 +01:00
|
|
|
checkbox is ticked, republish and view the webpage.
|
2010-12-13 00:48:20 +01:00
|
|
|
|
|
|
|
Ensure that your template file (usually themes/yourtheme/templates/Layout/Page.ss) has the `$CommentsForm` variable
|
|
|
|
where you want comments to appear.
|
|
|
|
|
2012-12-17 20:53:16 +01:00
|
|
|
To enable commenting on other objects (such as your own subclasses of `DataObject`) add the following
|
2010-12-13 00:48:20 +01:00
|
|
|
to your `mysite/_config.php` file.
|
|
|
|
|
2012-07-22 03:29:33 +02:00
|
|
|
// Adds commenting to the class SiteTree (all Pages)
|
|
|
|
Commenting::add('SiteTree');
|
2012-12-17 20:53:16 +01:00
|
|
|
|
2010-12-13 00:48:20 +01:00
|
|
|
You can also pass configuration options to the add function to customize commenting on that object. Again
|
|
|
|
in your `mysite/_config.php` file replace the previous line with the following
|
|
|
|
|
2012-07-22 03:29:33 +02:00
|
|
|
// Adds commenting to the class SiteTree (all Pages) but require the user to login and comments
|
2010-12-13 00:48:20 +01:00
|
|
|
// are moderated
|
|
|
|
Commenting::add('Foo', array(
|
|
|
|
'require_moderation' => true,
|
|
|
|
'require_login' => true
|
|
|
|
));
|
2012-12-17 20:53:16 +01:00
|
|
|
|
2010-12-13 00:48:20 +01:00
|
|
|
For more configuration options see [Configuration](Configuration.md).
|
|
|
|
|
|
|
|
## Upgrading
|
|
|
|
|
2012-12-17 20:53:16 +01:00
|
|
|
### Migrating from version 2.* SilverStripe installations
|
2010-12-11 06:01:19 +01:00
|
|
|
|
2012-12-17 20:53:16 +01:00
|
|
|
This module replaces the built-in commenting system available in versions up to SilverStripe 2.4. To migrate from
|
|
|
|
that you'll need to run `dev/build` after installing the module.
|
2010-12-13 00:48:20 +01:00
|
|
|
|
2012-12-17 20:53:16 +01:00
|
|
|
You can do this via sake (`sake dev/build`) or via a web browser by visiting `http://yoursite.com/dev/build`
|