diff --git a/mod/forum/lang/en/forum.php b/mod/forum/lang/en/forum.php
index 388758cb59b56..9a748731331e2 100644
--- a/mod/forum/lang/en/forum.php
+++ b/mod/forum/lang/en/forum.php
@@ -466,7 +466,8 @@
$string['nodiscussions'] = 'There are no discussion topics yet in this forum';
$string['nodiscussionsstartedby'] = '{$a} has not started any discussions';
$string['nodiscussionsstartedbyyou'] = 'You haven\'t started any discussions yet';
-$string['noguestpost'] = 'Sorry, guests are not allowed to post.';
+$string['noguestpost'] = 'Only logged in users can post to this forum.';
+$string['noguestpost:title'] = 'Log in to continue';
$string['noguestsubscribe'] = 'Sorry, guests are not allowed to subscribe.';
$string['noguesttracking'] = 'Sorry, guests are not allowed to set tracking options.';
$string['nomorepostscontaining'] = 'No more posts containing \'{$a}\' were found';
diff --git a/mod/forum/post.php b/mod/forum/post.php
index a3f2925cc0a70..ddadf1120011b 100644
--- a/mod/forum/post.php
+++ b/mod/forum/post.php
@@ -105,7 +105,10 @@
$referer = get_local_referer(false);
echo $OUTPUT->header();
- echo $OUTPUT->confirm(get_string('noguestpost', 'forum').'
'.get_string('liketologin'), get_login_url(), $referer);
+ echo $OUTPUT->confirm(get_string('noguestpost', 'forum'), get_login_url(), $referer, [
+ 'confirmtitle' => get_string('noguestpost:title', 'forum'),
+ 'continuestr' => get_string('login')
+ ]);
echo $OUTPUT->footer();
exit;
}
diff --git a/mod/forum/tests/behat/guest_users.feature b/mod/forum/tests/behat/guest_users.feature
index 14402630c63e4..17bf241a772de 100644
--- a/mod/forum/tests/behat/guest_users.feature
+++ b/mod/forum/tests/behat/guest_users.feature
@@ -83,14 +83,14 @@ Feature: Guest and not logged users could see the option to add new post or repl
And I am on the "Forum" "forum activity" page
Then I should see "Add discussion topic"
And I click on "Add discussion topic" "link"
- And I should see "Sorry, guests are not allowed to post"
+ And I should see "Only logged in users can post to this forum"
And I click on "Cancel" "button"
And I should see "Forum discussion 1"
And I click on "Forum discussion 1" "link"
And I should see "Reply"
And I click on "Reply" "link"
- And I should see "Sorry, guests are not allowed to post"
- And I click on "Continue" "button"
+ And I should see "Only logged in users can post to this forum"
+ And I click on "Log in" "button"
And I should see "Log in"
Examples:
@@ -112,11 +112,11 @@ Feature: Guest and not logged users could see the option to add new post or repl
And I should see "Forum (single discussion)"
Then I should see "Reply"
And I click on "Reply" "link"
- And I should see "Sorry, guests are not allowed to post"
+ And I should see "Only logged in users can post to this forum"
And I click on "Cancel" "button"
And I should see "Reply"
And I click on "Reply" "link"
- And I click on "Continue" "button"
+ And I click on "Log in" "button"
And I should see "Log in"
Scenario: As an enrolled guest I see the option to reply in a blog type forum
@@ -134,10 +134,10 @@ Feature: Guest and not logged users could see the option to add new post or repl
And I am on the "Forum" "forum activity" page
Then I should see "Add discussion topic"
And I click on "Add discussion topic" "link"
- And I should see "Sorry, guests are not allowed to post"
+ And I should see "Only logged in users can post to this forum"
And I click on "Cancel" "button"
And I should see "Forum discussion 1"
And I click on "Add discussion topic" "link"
- And I should see "Sorry, guests are not allowed to post"
- And I click on "Continue" "button"
+ And I should see "Only logged in users can post to this forum"
+ And I click on "Log in" "button"
And I should see "Log in"