Skip to content

Commit 06a033a

Browse files
committed
Check user page for optimized early return
1 parent 6592428 commit 06a033a

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

event/main_listener.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,9 @@ protected function is_non_content_page()
284284
*/
285285
public function append_agreement()
286286
{
287-
if (!$this->template->retrieve_var('S_AGREEMENT') || ($this->template->retrieve_var('AGREEMENT_TITLE') !== $this->language->lang('PRIVACY')))
287+
if ((strpos($this->user->page['page_name'], 'ucp') !== 0)
288+
|| !$this->template->retrieve_var('S_AGREEMENT')
289+
|| ($this->template->retrieve_var('AGREEMENT_TITLE') !== $this->language->lang('PRIVACY')))
288290
{
289291
return;
290292
}

tests/event/amend_agreement_test.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ public function append_agreement_data()
3737
public function test_append_agreement($s_agreement, $agreement_title, $expected_append_calls)
3838
{
3939
$this->config['sitename'] = 'Test Forum';
40+
$this->user->page['page_name'] = 'ucp.php';
4041

4142
$this->template->expects(self::atMost(2))
4243
->method('retrieve_var')

0 commit comments

Comments
 (0)