<p>Completely untested, but something like this should do it.  Create a simple <a href="https://craftcms.com/docs/plugins/introduction" rel="nofollow">plugin</a> and add this to the main plugin class:</p>

<pre><code>public function init()
{
    craft()-&gt;on('users.onBeforeActivateUser', function(Event $event)
    {
        $user = $event-&gt;params['user'];

        craft()-&gt;config-&gt;set('activateAccountSuccessPath', 'members/'.$user-&gt;username);
    });
}
</code></pre>

CC BY-SA 3.0
2016-03-24T16:29:12.777Z
2016-03-24T16:29:12.777Z
Brad Bell
<p>How to set a dynamic path for <code>activateAccountSuccessPath</code> that contains the username (or any other field from the user profile)? </p>

<config><routing>
Set a dynamic `activateAccountSuccessPath`
# Set a dynamic `activateAccountSuccessPath`

(Asked by: username_0 on 2016-03-24)

How to set a dynamic path for `activateAccountSuccessPath` that contains the username (or any other field from the user profile)?

**Tags:** config, routing


---

## 1 answers

### Answer by username_1 on 2016-03-24. Score: 2

Completely untested, but something like this should do it.  Create a simple plugin and add this to the main plugin class:
public function init()
{
    craft()->on('users.onBeforeActivateUser', function(Event $event)
    {
        $user = $event->params['user'];

        craft()->config->set('activateAccountSuccessPath', 'members/'.$user->username);
    });
}


---

