Skip to content
This repository was archived by the owner on Nov 3, 2023. It is now read-only.

Commit 76b898a

Browse files
committed
Show a message if logging in is required to comment (see #7031)
1 parent 579c290 commit 76b898a

File tree

5 files changed

+24
-34
lines changed

5 files changed

+24
-34
lines changed

system/docs/CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ Contao Open Source CMS changelog
44
Version 3.4.0-beta1 (2014-10-XX)
55
--------------------------------
66

7+
### Improved
8+
Show a message if logging in is required to comment (see #7031).
9+
710
### New
811
Added the "sendNewsletter" hook (see #7222).
912

system/modules/comments/classes/Comments.php

+2
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,8 @@ protected function renderCommentForm(\FrontendTemplate $objTemplate, \stdClass $
192192
if ($objConfig->requireLogin && !BE_USER_LOGGED_IN && !FE_USER_LOGGED_IN)
193193
{
194194
$objTemplate->requireLogin = true;
195+
$objTemplate->login = $GLOBALS['TL_LANG']['MSC']['com_login'];
196+
195197
return;
196198
}
197199

system/modules/comments/languages/en/default.xlf

+3
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020
<trans-unit id="MSC.com_submit">
2121
<source>Submit comment</source>
2222
</trans-unit>
23+
<trans-unit id="MSC.com_login">
24+
<source>You need to be logged in to add comments.</source>
25+
</trans-unit>
2326
<trans-unit id="MSC.com_by">
2427
<source>Comment by</source>
2528
</trans-unit>
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,42 @@
1-
<?php if (!$this->requireLogin): ?>
2-
3-
<!-- indexer::stop -->
4-
<div class="form">
51

2+
<!-- indexer::stop -->
3+
<div class="form">
4+
<?php if ($this->requireLogin): ?>
5+
<p class="info"><?php echo $this->login; ?></p>
6+
<?php else: ?>
67
<?php if ($this->confirm): ?>
78
<p class="confirm"><?php echo $this->confirm; ?></p>
89
<?php elseif ($this->allowComments): ?>
910
<form<?php if ($this->action): ?> action="<?php echo $this->action; ?>"<?php endif; ?> id="<?php echo $this->formId; ?>" method="post">
1011
<div class="formbody">
1112
<input type="hidden" name="FORM_SUBMIT" value="<?php echo $this->formId; ?>">
1213
<input type="hidden" name="REQUEST_TOKEN" value="{{request_token}}">
13-
1414
<div class="widget">
1515
<?php echo $this->fields['name']->generateWithError(); ?> <?php echo $this->fields['name']->generateLabel(); ?>
1616
</div>
17-
1817
<div class="widget">
1918
<?php echo $this->fields['email']->generateWithError(); ?> <?php echo $this->fields['email']->generateLabel(); ?>
2019
</div>
21-
2220
<div class="widget">
2321
<?php echo $this->fields['website']->generateWithError(); ?> <?php echo $this->fields['website']->generateLabel(); ?>
2422
</div>
25-
2623
<?php if (isset($this->fields['captcha'])): ?>
2724
<div class="widget">
2825
<?php echo $this->fields['captcha']->generateWithError(); ?> <label for="ctrl_captcha"><?php echo $this->fields['captcha']->generateQuestion(); ?><span class="mandatory">*</span></label>
2926
</div>
3027
<?php endif; ?>
31-
3228
<div class="widget">
3329
<?php echo $this->fields['comment']->generateWithError(); ?> <label for="ctrl_<?php echo $this->fields['comment']->id; ?>" class="invisible"><?php echo $this->fields['comment']->label; ?></label>
3430
</div>
35-
3631
<div class="widget">
3732
<?php echo $this->fields['notify']->generateWithError(); ?>
3833
</div>
39-
4034
<div class="submit_container">
4135
<input type="submit" class="submit" value="<?php echo $this->submit; ?>">
4236
</div>
43-
4437
</div>
4538
</form>
4639
<?php endif; ?>
47-
48-
</div>
49-
<!-- indexer::continue -->
50-
51-
<?php endif; ?>
40+
<?php endif; ?>
41+
</div>
42+
<!-- indexer::continue -->
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,42 @@
1-
<?php if (!$this->requireLogin): ?>
2-
3-
<!-- indexer::stop -->
4-
<div class="form">
51

2+
<!-- indexer::stop -->
3+
<div class="form">
4+
<?php if ($this->requireLogin): ?>
5+
<p class="info"><?php echo $this->login; ?></p>
6+
<?php else: ?>
67
<?php if ($this->confirm): ?>
78
<p class="confirm"><?php echo $this->confirm; ?></p>
89
<?php elseif ($this->allowComments): ?>
910
<form action="<?php echo $this->action; ?>" id="<?php echo $this->formId; ?>" method="post">
1011
<div class="formbody">
1112
<input type="hidden" name="FORM_SUBMIT" value="<?php echo $this->formId; ?>" />
1213
<input type="hidden" name="REQUEST_TOKEN" value="{{request_token}}" />
13-
1414
<div class="widget">
1515
<?php echo $this->fields['name']->generateWithError(); ?> <?php echo $this->fields['name']->generateLabel(); ?>
1616
</div>
17-
1817
<div class="widget">
1918
<?php echo $this->fields['email']->generateWithError(); ?> <?php echo $this->fields['email']->generateLabel(); ?>
2019
</div>
21-
2220
<div class="widget">
2321
<?php echo $this->fields['website']->generateWithError(); ?> <?php echo $this->fields['website']->generateLabel(); ?>
2422
</div>
25-
2623
<?php if (isset($this->fields['captcha'])): ?>
2724
<div class="widget">
2825
<?php echo $this->fields['captcha']->generateWithError(); ?> <label for="ctrl_captcha"><?php echo $this->fields['captcha']->generateQuestion(); ?><span class="mandatory">*</span></label>
2926
</div>
3027
<?php endif; ?>
31-
3228
<div class="widget">
3329
<?php echo $this->fields['comment']->generateWithError(); ?> <label for="ctrl_<?php echo $this->fields['comment']->id; ?>" class="invisible"><?php echo $this->fields['comment']->label; ?></label>
3430
</div>
35-
3631
<div class="widget">
3732
<?php echo $this->fields['notify']->generateWithError(); ?>
3833
</div>
39-
4034
<div class="submit_container">
4135
<input type="submit" class="submit" value="<?php echo $this->submit; ?>" />
4236
</div>
43-
4437
</div>
4538
</form>
4639
<?php endif; ?>
47-
48-
</div>
49-
<!-- indexer::continue -->
50-
51-
<?php endif; ?>
40+
<?php endif; ?>
41+
</div>
42+
<!-- indexer::continue -->

0 commit comments

Comments
 (0)