diff options
author | Kate Butler <kate@innocraft.com> | 2019-08-14 02:48:36 +0300 |
---|---|---|
committer | Thomas Steur <tsteur@users.noreply.github.com> | 2019-08-14 02:48:36 +0300 |
commit | 5f96a27e860de0da9cc86db8736e08a9573fbec8 (patch) | |
tree | 488de6bbcbc5dbe2ec735e3a27d968dc08a95e1b /plugins/UsersManager/API.php | |
parent | 85932196aa30e93cc0c28d4445b081b7f710c8ae (diff) |
Add newsletter signup button to user settings page (#14466)
* Add newsletter signup button to user settings page
* UI tests for newsletter signup on user settings page
* Move UI tests for user settings out of UIIntegrationTest
* Fix screenshots for UI tests
* Move newsletter signup logic out of API
* PR changes
* Require token to sign users up to newsletter
* Add privacy notice and checkbox to newsletter signup
* Update UI tests
* Fix UI test
* do things the angular way
* Update userSettings.twig
* PR changes
* Update reference screenshots
* Fix UI test to work with new piwik form elements; remove duplicate test
* Capture notification container in screenshot
* fix ui tests
Diffstat (limited to 'plugins/UsersManager/API.php')
-rw-r--r-- | plugins/UsersManager/API.php | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/plugins/UsersManager/API.php b/plugins/UsersManager/API.php index b25a1d6f79..fac5b6178d 100644 --- a/plugins/UsersManager/API.php +++ b/plugins/UsersManager/API.php @@ -969,6 +969,7 @@ class API extends \Piwik\Plugin\API } $this->model->deleteUserOnly($userLogin); + $this->model->deleteUserOptions($userLogin); $this->model->deleteUserAccess($userLogin); Cache::deleteTrackerCache(); @@ -1362,6 +1363,18 @@ class API extends \Piwik\Plugin\API return $user['token_auth']; } + public function newsletterSignup() + { + Piwik::checkUserIsNotAnonymous(); + + $userLogin = Piwik::getCurrentUserLogin(); + $email = Piwik::getCurrentUserEmail(); + + $success = NewsletterSignup::signupForNewsletter($userLogin, $email, true); + $result = $success ? array('success' => true) : array('error' => true); + return $result; + } + private function isUserHasAdminAccessTo($idSite) { try { |