Skip to content

Commit 591cf72

Browse files
authored
Merge pull request #870 from nep/patch-14
Improvements to Comment docs -- Editable, re-ordering conditionals, wording
2 parents 3efa12f + 16735a8 commit 591cf72

File tree

2 files changed

+30
-26
lines changed

2 files changed

+30
-26
lines changed

docs/comment/entries.md

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Here is a basic example showing how you might use the comment tag:
2222
<p>By {name} on {comment_date format="%Y %m %d"}</p>
2323
{/exp:comment:entries}
2424

25-
NOTE: **Important:** The Comment Entries tag should **not** be nested inside of a standard {exp:channel:entries} tag.
25+
NOTE: **Important:** The Comment Entries tag should **not** be nested inside of a standard {exp:channel:entries} tag. If you do, the outer tag will parse and resolve many of these variables and conditionals before the Comment Entries tag has the chance to do so.
2626

2727
## Parameters
2828

@@ -158,12 +158,6 @@ This variable will always display the absolute total number of results that are
158158

159159
The _opposite_ of `{absolute_count}`, in that it displays the entry count position counting backwards from the absolute total. Works across pagination, so the fifth entry in a list of fifteen entries would display "10".
160160

161-
### `{allow_comments}`
162-
163-
{if allow_comments}
164-
165-
TRUE / FALSE, Whether or not the entry being displayed allows comments. Typically used as a conditional.
166-
167161
### `{author}`
168162

169163
The comment author's screen name, if a member; otherwise, this variable will display the name submitted with the comment.
@@ -196,10 +190,6 @@ The URL to the avatar image associated with the entry's author. Typically used a
196190

197191
{if avatar} <img src="{avatar_url}" width="{avatar_image_width}" height="{avatar_image_height}" alt="{author}'s avatar" /> {/if}
198192

199-
### `{if can_moderate_comment}`
200-
201-
TRUE / FALSE, Whether a member has permission to edit a given comment AND/OR close that comment. Used in conjunction with [comment editing](comment/form.md#allowing-members-to-edit-comments-on-the-front-end).
202-
203193
### `{channel_id}`
204194

205195
The ID number of the channel that the comment belongs to.
@@ -289,12 +279,6 @@ If five entries are being displayed per page, then for the fourth entry on the p
289279

290280
The date on which the comment was edited. See [Date Variable Formatting](templates/date-variable-formatting.md) for more information.
291281

292-
### `{editable}`
293-
294-
{if editable}Show Edit{/if}
295-
296-
This variable will be used in a conditional to allow [comment editing](comment/form.md#allowing-members-to-edit-comments-on-the-front-end). It indicates whether a member has [permission to edit a given comment](control-panel/member-manager.md#createedit-all-member-roles).
297-
298282
### `{email}`
299283

300284
The comment author's email address, if specified.
@@ -453,7 +437,15 @@ These are totally dynamic in that any profile field you create for your members
453437

454438
[TOC=3]
455439

456-
The following special conditionals are available:
440+
The following special conditionals are available.
441+
442+
NOTE: **Important:** Avoid using Template Caching on any Template containing these conditional that are user-specific. If you do not avoid caching, then data will not be dynamic for each user. Instead, whoever happens to load the page when it gets cached will have their conditionals applied to every subsequent visitor until the cache expires.
443+
444+
### `{if allow_comments}`
445+
446+
{if allow_comments} content {/if}
447+
448+
TRUE / FALSE, Whether or not the entry being displayed allows comments. Typically used as a conditional.
457449

458450
### `{if avatar}`
459451

@@ -463,20 +455,32 @@ This special conditional lets you conditionally display content if the current e
463455

464456
{if avatar} <img src="{avatar_url}" width="{avatar_image_width}" height="{avatar_image_height}" alt="{author}'s avatar" /> {/if}
465457

458+
### `{if can_moderate_comment}`
459+
460+
TRUE / FALSE, Whether a member has permission to edit a given comment AND/OR close that comment. Used in conjunction with [comment editing](comment/form.md#allowing-members-to-edit-comments-on-the-front-end).
461+
466462
### `{if comments_expired}`
467463

464+
{if comments_expired} content {/if}
465+
468466
If commenting has expired (and expiration is not set to be [overridden by moderation](comment/control-panel.md)), the contents of this conditional will be displayed.
469467

470468
NOTE: **Note:** `{if no_results}` has precedence over this conditional. If there are no comments, this conditional is not evaluated.
471469

472470
### `{if comments_disabled}`
473471

474-
{if comments_disabled}
472+
{if comments_disabled} content {/if}
475473

476474
If commenting has been disabled, the contents of this conditional will be displayed.
477475

478476
NOTE: **Note:** `{if no_results}` has precedence over this conditional. If there are no comments, this conditional is not evaluated.
479477

478+
### `{if editable}`
479+
480+
{if editable} Show Edit Form {/if}
481+
482+
TRUE / FALSE, This variable will be used in a conditional to allow [comment editing](comment/form.md#allowing-members-to-edit-comments-on-the-front-end). It indicates whether a member has [permission to edit a given comment](control-panel/member-manager.md#createedit-all-member-roles).
483+
480484
### `{if is_ignored}`
481485

482486
{if is_ignored} content {/if}
@@ -509,7 +513,7 @@ Or you can use Javascript to allow the user to read the comment if they wish:
509513
<div id="{comment_id}" {if is_ignored}style="display: none;"{/if}>{comment}</div>
510514
{/exp:comment:entries}
511515

512-
NOTE: **Important:** Avoid using Template Caching on any Template containing this conditional. If you do not avoid caching, then data will not be dynamic for each user. Instead, whoever happens to load the page when it is cached will have their ignore list applied to everyone until the cache expires.
516+
NOTE: **Important:** Avoid using Template Caching on any Template containing this conditional. If you cache this, whoever happens to load the page when it is first cached will have their ignore list applied to everyone until the cache is cleared.
513517

514518
### `{if no_results}`
515519

docs/comment/form.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ This is a **required** parameter if you are using comment previews indicating wh
7474

7575
You can hard code the comment for tag to display a comment form for a specific channel entry by its URL title.
7676

77-
NOTE: **Note:** This parameter takes precedence over any entry specified dynamically in the URL, so when using this parameter you will want to make sure it is clear to the user which entry the displayed comment form belong to.
77+
NOTE: **Note:** This parameter takes precedence over any entry specified dynamically in the URL, so when using this parameter you will want to make sure it is clear to the user which entry the displayed comment form belongs to.
7878

7979
#### `channel=`
8080

@@ -174,7 +174,7 @@ The following conditionals are available:
174174

175175
## Allowing Members to Edit Comments on the Front End
176176

177-
The available tags and variables allow you to write your own client side code for implementing comment editing. The following is a simplified example using jQuery.
177+
The available tags and variables allow you to write your own client-side code for implementing comment editing. The following is a simplified example using jQuery.
178178

179179
### Example Code
180180

@@ -227,13 +227,13 @@ A request for an edit will return a response array. In the case of an error, an
227227

228228
### Editing Permissions
229229

230-
The {if editable} conditional in the Comment Entries tag outputs content when the viewing member has permission to edit the comment indicated while the {if can_moderate_comment} outputs content if they have permission to close the comment.
230+
By using the [{if editable}](/comment/entries.html#if-editable) conditional in the Comment Entries tag, you can output a link, instructions or a form if the viewing member has permission to edit the comment, and by using the {if can_moderate_comment} you can display whatever is appropriate if the viewing member has permission to moderate (close) the comment.
231231

232-
For regular members, in order to edit comments they must be a logged in member, the author of the comment, and the editing time limit must not have expired.
232+
For default regular members, in order to edit a comment, they must be logged in, the author of the comment, and the editing time limit must not have expired. If a member has a role with permission to edit the comments of any entry, that member will have edit permissions regardless of the editing time limit.
233233

234-
Comment moderators may close the comment. Superadmins will always have {editable} and {can_moderate_comment} permissions on any comment.
234+
Comment moderators may close the comment. The edit time limit does not apply to moderators.
235235

236-
Lastly, if a member is in a group with permission to edit comments in any entry, they will have edit permissions. The edit time limit does not apply to moderators.
236+
Superadmins will always have {editable} and {can_moderate_comment} permissions on any comment.
237237

238238
### Customizing Client-Side Code
239239

0 commit comments

Comments
 (0)