Answers.Body: <p>You can write a <a href="https://craftcms.com/docs/plugins/introduction" rel="nofollow">plugin</a> that listens to the <a href="https://craftcms.com/docs/plugins/events-reference#users-onActivateUser" rel="nofollow">users.onActivateUser event</a>, and manually redirects the browser to your desired page.</p>
  
  <p>Just add this code to your plugin’s primary class:</p>
  
  <pre class="lang-php prettyprint-override"><code>public function init()
  {
      craft()-&gt;on('users.activateUser', array($this, 'onActivateUser'));
  }
  
  public function onActivateUser(Event $event)
  {
      /* @var UserModel $user */
      $user = $event-&gt;params['user'];
  
      // Are they in the default group?
      // (Indicates this was probably public registration)
      if ($user-&gt;isInGroup('myDefaultGroup'))
      {
          // Redirect them to the activateAccountSuccessPath
          $activateAccountSuccessPath = craft()-&gt;config-&gt;getLocalized('activateAccountSuccessPath');
          $url = UrlHelper::getSiteUrl($activateAccountSuccessPath);
          craft()-&gt;request-&gt;redirect($url);
      }
  }
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-01-28T20:12:07.157Z
Answers.Text: Great stuff Brandon, this is working well. Just a couple of additional questions: **1.** is there anyway to get this working in conjunction with `autoLoginAfterAccountActivation` (I'm talking of a dashboard page which uses `{% requireLogin %}`). **2.** Is there any technical or security reason why this isn't built in as a default config setting?
Answers.UserDisplayName: Rob
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-01-28T20:21:54.473Z
Answers.Text: @Rob This should work with autoLoginAfterAccountActivation = true. This isn’t something we would make a config setting because it’s super edge case. The expected behavior is that a user with access to the Control Panel would be directed to the Control Panel when their account has been activated.
Answers.UserDisplayName: Brandon Kelly
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-01-28T20:39:43.723Z
Answers.Text: Fair enough. Unfortunately, it doesn't work with that setting and just redirects to `loginPath` — it's far better than our previous solution however, and (I've [updated my post with a full config setup](http://craftcms.stackexchange.com/questions/13207/postcploginredirect-wrong-redirect-when-used-with-autologinafteraccountactivatio) for posterity)
Answers.UserDisplayName: Rob
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-01-27T21:27:18.387Z
Answers.LastActivityDate: 2016-01-27T21:33:07.467Z
Answers.LastEditDate: 2016-01-27T21:33:07.467Z
Answers.UserDisplayName: Brandon Kelly
Body: <p>I have a site that allows public registration, and I want to be able to control where users are redirected to after activating their account. However the default user group has access to the Control Panel, so as explained in “<a href="https://craftcms.stackexchange.com/q/4106/9">activateAccountSuccessPath doesn&#39;t work as expected</a>”, users are taken to the Control Panel login page after activation, rather than the path defined by the <code>activateAccountSuccessPath</code> config setting.</p>
  
  <p>Is there any way to change that behavior, so even users with access to the Control Panel will get redirected to the <code>activateAccountSuccessPath</code> after account activation?</p>
  
Tags: <users><config><activation>
Title: How can I set the "activateAccountSuccessPath" for users with Control Panel access?
ThreadText: # How can I set the "activateAccountSuccessPath" for users with Control Panel access?
  
  (Asked by: username_0 on 2016-01-27)
  
  I have a site that allows public registration, and I want to be able to control where users are redirected to after activating their account. However the default user group has access to the Control Panel, so as explained in “[activateAccountSuccessPath doesn't work as expected](https://craftcms.stackexchange.com/q/4106/9)”, users are taken to the Control Panel login page after activation, rather than the path defined by the `activateAccountSuccessPath` config setting.
  
  Is there any way to change that behavior, so even users with access to the Control Panel will get redirected to the `activateAccountSuccessPath` after account activation?
  
  **Tags:** users, config, activation
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2016-01-27. Score: 2 | Accepted answer
  
  You can write a [plugin](https://craftcms.com/docs/plugins/introduction) that listens to the [users.onActivateUser event](https://craftcms.com/docs/plugins/events-reference#users-onActivateUser), and manually redirects the browser to your desired page.
  
  Just add this code to your plugin’s primary class:
  
  ```php
  public function init()
  {
      craft()->on('users.activateUser', array($this, 'onActivateUser'));
  }
  
  public function onActivateUser(Event $event)
  {
      /* @var UserModel $user */
      $user = $event->params['user'];
  
      // Are they in the default group?
      // (Indicates this was probably public registration)
      if ($user->isInGroup('myDefaultGroup'))
      {
          // Redirect them to the activateAccountSuccessPath
          $activateAccountSuccessPath = craft()->config->getLocalized('activateAccountSuccessPath');
          $url = UrlHelper::getSiteUrl($activateAccountSuccessPath);
          craft()->request->redirect($url);
      }
  }
  
  ```
  
  > **Comments:**
  > **username_1**: Great stuff username_0, this is working well. Just a couple of additional questions: **1.** is there anyway to get this working in conjunction with `autoLoginAfterAccountActivation` (I'm talking of a dashboard page which uses `{% requireLogin %}`). **2.** Is there any technical or security reason why this isn't built in as a default config setting?  
  > **username_0**: @username_1 This should work with autoLoginAfterAccountActivation = true. This isn’t something we would make a config setting because it’s super edge case. The expected behavior is that a user with access to the Control Panel would be directed to the Control Panel when their account has been activated.  
  > **username_1**: Fair enough. Unfortunately, it doesn't work with that setting and just redirects to `loginPath` — it's far better than our previous solution however, and (I've [updated my post with a full config setup](http://craftcms.stackexchange.com/questions/13207/postcploginredirect-wrong-redirect-when-used-with-autologinafteraccountactivatio) for posterity)  
  
  ---
  
  