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

Commit

Permalink
Show a message if logging in is required to comment (see #7031)
Browse files Browse the repository at this point in the history
  • Loading branch information
leofeyer committed Sep 23, 2014
1 parent 579c290 commit 76b898a
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 34 deletions.
3 changes: 3 additions & 0 deletions system/docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ Contao Open Source CMS changelog
Version 3.4.0-beta1 (2014-10-XX)
--------------------------------

### Improved
Show a message if logging in is required to comment (see #7031).

### New
Added the "sendNewsletter" hook (see #7222).

Expand Down
2 changes: 2 additions & 0 deletions system/modules/comments/classes/Comments.php
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,8 @@ protected function renderCommentForm(\FrontendTemplate $objTemplate, \stdClass $
if ($objConfig->requireLogin && !BE_USER_LOGGED_IN && !FE_USER_LOGGED_IN)
{
$objTemplate->requireLogin = true;
$objTemplate->login = $GLOBALS['TL_LANG']['MSC']['com_login'];

return;
}

Expand Down
3 changes: 3 additions & 0 deletions system/modules/comments/languages/en/default.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
<trans-unit id="MSC.com_submit">
<source>Submit comment</source>
</trans-unit>
<trans-unit id="MSC.com_login">
<source>You need to be logged in to add comments.</source>
</trans-unit>
<trans-unit id="MSC.com_by">
<source>Comment by</source>
</trans-unit>
Expand Down
25 changes: 8 additions & 17 deletions system/modules/comments/templates/modules/mod_comment_form.html5
Original file line number Diff line number Diff line change
@@ -1,51 +1,42 @@
<?php if (!$this->requireLogin): ?>

<!-- indexer::stop -->
<div class="form">

<!-- indexer::stop -->
<div class="form">
<?php if ($this->requireLogin): ?>
<p class="info"><?php echo $this->login; ?></p>
<?php else: ?>
<?php if ($this->confirm): ?>
<p class="confirm"><?php echo $this->confirm; ?></p>
<?php elseif ($this->allowComments): ?>
<form<?php if ($this->action): ?> action="<?php echo $this->action; ?>"<?php endif; ?> id="<?php echo $this->formId; ?>" method="post">
<div class="formbody">
<input type="hidden" name="FORM_SUBMIT" value="<?php echo $this->formId; ?>">
<input type="hidden" name="REQUEST_TOKEN" value="{{request_token}}">

<div class="widget">
<?php echo $this->fields['name']->generateWithError(); ?> <?php echo $this->fields['name']->generateLabel(); ?>
</div>

<div class="widget">
<?php echo $this->fields['email']->generateWithError(); ?> <?php echo $this->fields['email']->generateLabel(); ?>
</div>

<div class="widget">
<?php echo $this->fields['website']->generateWithError(); ?> <?php echo $this->fields['website']->generateLabel(); ?>
</div>

<?php if (isset($this->fields['captcha'])): ?>
<div class="widget">
<?php echo $this->fields['captcha']->generateWithError(); ?> <label for="ctrl_captcha"><?php echo $this->fields['captcha']->generateQuestion(); ?><span class="mandatory">*</span></label>
</div>
<?php endif; ?>

<div class="widget">
<?php echo $this->fields['comment']->generateWithError(); ?> <label for="ctrl_<?php echo $this->fields['comment']->id; ?>" class="invisible"><?php echo $this->fields['comment']->label; ?></label>
</div>

<div class="widget">
<?php echo $this->fields['notify']->generateWithError(); ?>
</div>

<div class="submit_container">
<input type="submit" class="submit" value="<?php echo $this->submit; ?>">
</div>

</div>
</form>
<?php endif; ?>

</div>
<!-- indexer::continue -->

<?php endif; ?>
<?php endif; ?>
</div>
<!-- indexer::continue -->
25 changes: 8 additions & 17 deletions system/modules/comments/templates/modules/mod_comment_form.xhtml
Original file line number Diff line number Diff line change
@@ -1,51 +1,42 @@
<?php if (!$this->requireLogin): ?>

<!-- indexer::stop -->
<div class="form">

<!-- indexer::stop -->
<div class="form">
<?php if ($this->requireLogin): ?>
<p class="info"><?php echo $this->login; ?></p>
<?php else: ?>
<?php if ($this->confirm): ?>
<p class="confirm"><?php echo $this->confirm; ?></p>
<?php elseif ($this->allowComments): ?>
<form action="<?php echo $this->action; ?>" id="<?php echo $this->formId; ?>" method="post">
<div class="formbody">
<input type="hidden" name="FORM_SUBMIT" value="<?php echo $this->formId; ?>" />
<input type="hidden" name="REQUEST_TOKEN" value="{{request_token}}" />

<div class="widget">
<?php echo $this->fields['name']->generateWithError(); ?> <?php echo $this->fields['name']->generateLabel(); ?>
</div>

<div class="widget">
<?php echo $this->fields['email']->generateWithError(); ?> <?php echo $this->fields['email']->generateLabel(); ?>
</div>

<div class="widget">
<?php echo $this->fields['website']->generateWithError(); ?> <?php echo $this->fields['website']->generateLabel(); ?>
</div>

<?php if (isset($this->fields['captcha'])): ?>
<div class="widget">
<?php echo $this->fields['captcha']->generateWithError(); ?> <label for="ctrl_captcha"><?php echo $this->fields['captcha']->generateQuestion(); ?><span class="mandatory">*</span></label>
</div>
<?php endif; ?>

<div class="widget">
<?php echo $this->fields['comment']->generateWithError(); ?> <label for="ctrl_<?php echo $this->fields['comment']->id; ?>" class="invisible"><?php echo $this->fields['comment']->label; ?></label>
</div>

<div class="widget">
<?php echo $this->fields['notify']->generateWithError(); ?>
</div>

<div class="submit_container">
<input type="submit" class="submit" value="<?php echo $this->submit; ?>" />
</div>

</div>
</form>
<?php endif; ?>

</div>
<!-- indexer::continue -->

<?php endif; ?>
<?php endif; ?>
</div>
<!-- indexer::continue -->

0 comments on commit 76b898a

Please sign in to comment.