Merge branch 'creative-commoners-pulls/2/ss4-docs-update'

This commit is contained in:
Franco Springveldt 2017-09-21 10:38:13 +12:00
commit 740d252536
24 changed files with 57 additions and 51 deletions

BIN
docs/en/_images/blog-post-management.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 125 KiB

View File

@ -11,6 +11,6 @@ If you'd rather display your posts within the SiteTree, you can do so using Silv
In mysite/_config/settings.yml In mysite/_config/settings.yml
```yaml ```yaml
BlogPost: SilverStripe\Blog\Model\BlogPost:
show_in_sitetree: true show_in_sitetree: true
``` ```

View File

@ -2,38 +2,38 @@
By default the blog module user and author selection form fields include all users in your website as By default the blog module user and author selection form fields include all users in your website as
candidates for writers, editors and contributors. Additionally, when adding a blog post, again all users are selectable. candidates for writers, editors and contributors. Additionally, when adding a blog post, again all users are selectable.
This can cause issue with websites that store a large number of users in the database. This can cause issues with websites that store a large number of users in the database.
In this case you may need to restrict the number of user accounts that are elegable to be selected. In this case you may need to restrict the number of user accounts that are eligible for selection.
The module has some useful configuration options for this that can be added to your projects config.yml This module has some useful configuration options for this that can be added to your projects config.yml
## Restricting blog managers to a permission setting ## Restricting blog managers to a permission setting
Default is to list all users and when one is selected, they are added to a `blog-users` group with `CMS_ACCESS_CMSMain` permissions. Default is to list all users and when one is selected, they are added to a `blog-users` group with `CMS_ACCESS_CMSMain` permissions.
To only include those already having these permissions you can set in your `config.yml`: To only include those already having these permissions you can set in your `config.yml`:
```yaml ```yaml
Blog: SilverStripe\Blog\Model\Blog:
grant_user_access: false grant_user_access: false
``` ```
Note: depending on the incusion order of your config.yml you may need to clear the condifg setting Note: depending on the inclusion order of your config.yml you may need to clear the config setting
before updating it. In this case use the folling in yout `mysite/_config.php`: before updating it. In this case use the following in your `mysite/_config.php`:
```php ```php
Config::inst()->remove('Blog', 'grant_user_access'); SilverStripe\Core\Config\Config::modify()->remove(SilverStripe\Blog\Model\Blog::class, 'grant_user_access');
``` ```
If you create your own permission and want to ensure the pool of possible selectable users includes If you create your own permissions and want to ensure the pool of possible selectable users includes
those with this permission you can set the checked permission in `config.yml` with: those with this permission you can set the checked permission in `config.yml` with:
```yaml ```yaml
Blog: SilverStripe\Blog\Model\Blog:
grant_user_permission: SOME_PERMISSION_here grant_user_permission: SOME_PERMISSION_HERE
``` ```
## Restricting blog post authors selection to a known group ## Restricting blog post authors selection to a known group
In a blog post when selecting an author it will default to you (the logged in person creating the post), In a blog post when selecting an author it will default to you (the logged in person creating the post),
however you may be posting on behalf of another person. In this case the slection form field will offer however you may be posting on behalf of another person. In this case the selection form field will offer
all users as potential blog authors. Again for large websites with many thousands of users this can cause all users as potential blog authors. Again for large websites with many thousands of users this can cause
the site to be slow or non-responsive. We can turn on a filter so that authors need to be in a defined the site to be slow or non-responsive. We can turn on a filter so that authors need to be in a defined
user group to be able to be selected as an author. user group to be able to be selected as an author.
@ -41,21 +41,24 @@ user group to be able to be selected as an author.
Enable this in your `config.yml` by adding a group code: Enable this in your `config.yml` by adding a group code:
```yaml ```yaml
BlogPost: SilverStripe\Blog\Model\BlogPost:
restrict_authors_to_group: 'group_code' restrict_authors_to_group: 'group_code'
``` ```
## Extension points in Blog and BlogPost users and how to use ## Extension points in Blog and BlogPost users and how to use
Both Blog and BlogPost have methods which return the list of candidate users or authors. If the previously Both Blog and BlogPost have methods which return the list of candidate users or authors. If the previously
mentioned mothods of reducing this list are not suitable or you wish to roll your own, you can utilise a mentioned methods of reducing this list are not suitable or you wish to roll your own, you can utilise a
DataExtension to get the controll you require. DataExtension to get the control you require.
For example in BlogPost: For example in BlogPost:
```php ```php
protected function getCandidateAuthors() { protected function getCandidateAuthors()
if($this->config()->get('restrict_authors_to_group')) { {
return Group::get()->filter('Code', $this->config()->get('restrict_authors_to_group'))->first()->Members(); if ($restrictedGroup = $this->config()->get('restrict_authors_to_group')) {
if ($group = Group::get()->filter('Code', $restrictedGroup)->first()) {
return $group->Members();
}
} else { } else {
$list = Member::get(); $list = Member::get();
$this->extend('updateCandidateAuthors', $list); $this->extend('updateCandidateAuthors', $list);
@ -65,7 +68,8 @@ protected function getCandidateAuthors() {
``` ```
Note the line `$this->extend('updateCandidateAuthors', $list);` which allows you to call a Note the line `$this->extend('updateCandidateAuthors', $list);` which allows you to call a
`updateCandidateAuthors` method in a DataExtension to the Blog Post class if you have not set a `restrict_authors_to_group` config, further filter the passed `updateCandidateAuthors` method in a DataExtension to the Blog Post class if you have not set a
`restrict_authors_to_group` config, further filters the passed
in Member list before it gets sent back to the form field. in Member list before it gets sent back to the form field.
See the documentation on [DataExtension](https://docs.silverstripe.org/en/developer_guides/extending/extensions/) for further implementation notes. See the documentation on [DataExtension](https://docs.silverstripe.org/en/developer_guides/extending/extensions/) for further implementation notes.

View File

@ -2,14 +2,16 @@
## Configuring whether notifications will send to authors of blogs if comments are spam ## Configuring whether notifications will send to authors of blogs if comments are spam
Default behaviour using the `silverstripe/comment-notifications` module is to send notification to authors of comments occuring regardless if they are spam or not. Default behaviour using the `silverstripe/comment-notifications` module is to send notifications of comments to
authors regardless of whether they are spam or not.
In some cases you may wish to not send a notification email to an author if the comment is spam, this is a configurable option. In some cases you may wish to not send a notification email to an author if the comment is spam,
this is a configurable option.
Add the following into your yaml config: Add the following into your yaml config:
``` ```
BlogPostNotifications: SilverStripe\Blog\Model\BlogPostNotifications:
notification_on_spam: false notification_on_spam: false
``` ```

View File

@ -1,4 +1,5 @@
# Configuring pagination # Configuring pagination
To customise the look and feel of the pagination component, simply override the template located at `/blog/templates/Includes/Pagination.ss` To customise the look and feel of the pagination component, simply override the template located
at `/blog/templates/SilverStripe/Blog/Includes/Pagination.ss`
If you have comments enabled, comment pagination is configurable via the [SilverStripe Comments Module configuration](https://github.com/silverstripe/silverstripe-comments/blob/master/docs/en/Configuration.md). If you have comments enabled, comment pagination is configurable via the [SilverStripe Comments Module configuration](https://github.com/silverstripe/silverstripe-comments/blob/master/docs/en/Configuration.md).

View File

@ -1,16 +1,18 @@
# Configuring Widgets # Configuring Widgets
The blog module comes bundled with some useful widgets. To take advantage of them, you'll need to install the [SilverStripe widgets module](https://github.com/silverstripe/silverstripe-widgets). Widgets are totally optional - so your blog will work just fine without having widgets installed. The blog module comes bundled with some useful widgets. To take advantage of them, you'll need to install the
[SilverStripe widgets module](https://github.com/silverstripe/silverstripe-widgets). Widgets are totally optional -
so your blog will work just fine without having widgets installed.
You can enable the widgets by adding the following YML config: You can enable the widgets by adding the following YML config:
```yaml ```yaml
Blog: SilverStripe\Blog\Model\Blog:
extensions: extensions:
- WidgetPageExtension - SilverStripe\Widgets\Extensions\WidgetPageExtension
BlogPost: SilverStripe\Blog\Model\BlogPost:
extensions: extensions:
- WidgetPageExtension - SilverStripe\Widgets\Extensions\WidgetPageExtension
``` ```
Once you have widgets installed you'll see the "Widgets" tab in the content section of your blog. Once you have widgets installed you'll see the "Widgets" tab in the content section of your blog.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 98 KiB

After

Width:  |  Height:  |  Size: 326 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 64 KiB

After

Width:  |  Height:  |  Size: 208 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 83 KiB

After

Width:  |  Height:  |  Size: 326 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 125 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 161 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.1 KiB

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 89 KiB

After

Width:  |  Height:  |  Size: 278 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 88 KiB

After

Width:  |  Height:  |  Size: 261 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 114 KiB

View File

@ -1,11 +1,8 @@
title: Adding a blog post
summary: How to add a new blog post.
# Adding a blog post # Adding a blog post
## Creating a new blog ## Creating a new blog
On the top of the Contents pane, you will find a button marked "Create." Click it, and a drop-down menu will show up. Select "Blog", then hit the "Go" button. On the top of the Contents pane, you will find a button marked "Add new." Click it, and a drop-down menu will show up. Select "Blog" from the STEP 2, then hit the "Create" button.
You will notice that a new blog page has been created, with the name of "New Blog". Rename this to "Blog" (or whatever you wish to call this page) and then you can later reorder where this is in your website tree. You will notice that a new blog page has been created, with the name of "New Blog". Rename this to "Blog" (or whatever you wish to call this page) and then you can later reorder where this is in your website tree.
@ -21,10 +18,10 @@ To create a blog post, click on your Blog page in the Page Tree in the site-tree
Fill out your blog post content as you would any page in the CMS. Fill out your blog post content as you would any page in the CMS.
You can also include a banner images and a custom summary description (if this is omitted the first 15 words of your post content will be used when displaying your posts's abstract). You can also include a banner images and a custom summary description (if this is omitted the first 30 words of your post content will be used when displaying your posts's abstract).
![Banner image and summary](_images/blogging-banner-summary.png) ![Banner image and summary](_images/blogging-banner-summary.png)
There is a new right hand panel where you can set a publish date, categories, tags and authors. From the tab labelled 'Post Options' you can set a publish date, categories, tags and authors.
![Setting blog options](_images/blogging-options.png) ![Setting blog options](_images/blogging-options.png)

View File

@ -23,5 +23,5 @@
</a> </a>
</p> </p>
<% include EntryMeta %> <% include SilverStripe\\Blog\\EntryMeta %>
</div> </div>

View File

@ -26,7 +26,7 @@
<% if $PaginatedList.Exists %> <% if $PaginatedList.Exists %>
<% loop $PaginatedList %> <% loop $PaginatedList %>
<% include PostSummary %> <% include SilverStripe\\Blog\\PostSummary %>
<% end_loop %> <% end_loop %>
<% else %> <% else %>
<p><%t SilverStripe\\Blog\\Model\\Blog.NoPosts 'There are no posts' %></p> <p><%t SilverStripe\\Blog\\Model\\Blog.NoPosts 'There are no posts' %></p>
@ -37,8 +37,8 @@
$CommentsForm $CommentsForm
<% with $PaginatedList %> <% with $PaginatedList %>
<% include Pagination %> <% include SilverStripe\\Blog\\Pagination %>
<% end_with %> <% end_with %>
</div> </div>
<% include BlogSideBar %> <% include SilverStripe\\Blog\\BlogSideBar %>

View File

@ -10,11 +10,11 @@
<div class="content">$Content</div> <div class="content">$Content</div>
<% include EntryMeta %> <% include SilverStripe\\Blog\\EntryMeta %>
</article> </article>
$Form $Form
$CommentsForm $CommentsForm
</div> </div>
<% include BlogSideBar %> <% include SilverStripe\\Blog\\BlogSideBar %>

View File

@ -2,12 +2,12 @@
<div class="blog-entry content-container <% if $SideBarView %>unit size3of4<% end_if %>"> <div class="blog-entry content-container <% if $SideBarView %>unit size3of4<% end_if %>">
<% include MemberDetails %> <% include SilverStripe\\Blog\\MemberDetails %>
<% if $PaginatedList.Exists %> <% if $PaginatedList.Exists %>
<h2>Posts by $CurrentProfile.FirstName $CurrentProfile.Surname for $Title:</h2> <h2>Posts by $CurrentProfile.FirstName $CurrentProfile.Surname for $Title:</h2>
<% loop $PaginatedList %> <% loop $PaginatedList %>
<% include PostSummary %> <% include SilverStripe\\Blog\\PostSummary %>
<% end_loop %> <% end_loop %>
<% end_if %> <% end_if %>
@ -15,9 +15,9 @@
$CommentsForm $CommentsForm
<% with $PaginatedList %> <% with $PaginatedList %>
<% include Pagination %> <% include SilverStripe\\Blog\\Pagination %>
<% end_with %> <% end_with %>
</div> </div>
<% include BlogSideBar %> <% include SilverStripe\\Blog\\BlogSideBar %>