-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add backend checks for accept rules checkbox
- Loading branch information
1 parent
7899878
commit a520a49
Showing
8 changed files
with
52 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
/** | ||
* This file is a part of free add-on "Forum Rules Accept". | ||
* Developed by HLModerators. | ||
* | ||
* License - MIT. | ||
*/ | ||
|
||
namespace HLModerators\ForumRulesAccept\XF\Pub\Controller; | ||
|
||
|
||
use XF\Mvc\ParameterBag; | ||
|
||
class Forum extends XFCP_Forum | ||
{ | ||
protected function setupThreadCreate(\XF\Entity\Forum $forum) | ||
{ | ||
/** @var string $rulesUrl */ | ||
$rulesUrl = $forum->hlmod_rules_url; | ||
if (!empty($rulesUrl) && $rulesUrl !== $this->filter('hlmod_rules_url_accept', 'str,no-trim')) | ||
{ | ||
throw $this->errorException(\XF::phrase('hlmod_forum_rules_accept.you_must_accept_rules'), 400); | ||
} | ||
|
||
return parent::setupThreadCreate($forum); | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
...nsions/XF-Pub-Controller-Forum_HLModerators-ForumRulesAccept-XF-Pub-Controller-Forum.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"from_class": "XF\\Pub\\Controller\\Forum", | ||
"to_class": "HLModerators\\ForumRulesAccept\\XF\\Pub\\Controller\\Forum", | ||
"execute_order": 25, | ||
"active": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
{ | ||
"XF-Admin-Controller-Forum_HLModerators-ForumRulesAccept-XF-Admin-Controller-Forum.json": { | ||
"hash": "004a41870794b2d257393ab2d0fcce61" | ||
}, | ||
"XF-Pub-Controller-Forum_HLModerators-ForumRulesAccept-XF-Pub-Controller-Forum.json": { | ||
"hash": "05b5337ac132d7abb87afd8b5d912d2c" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
_output/phrases/hlmod_forum_rules_accept.you_must_accept_rules.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
You must accept the rules for creating a thread |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters