<p>I would create a new section called "Profiles" or something along those lines. This is where all of your...extended profile information will go. You can then add a <code>users</code> filed type on those entries that will link <em>back</em> to the user account.</p>

<p>Depending on how you are creating users (manually or through some other form) you will want to create a plugin that listens to the <code>users.onSaveUser</code> event. </p>

<p>So in your plugin that would look something like this:</p>

<p><strong>MyPlugin.php</strong></p>

<pre><code>public function init()
{
    craft()-&gt;on('users.onSaveUser', function (Event $event)
    {
        // Get the userId       
        // Check if the user already has a profile
        // Create a new entry in the 'profiles' section
        // Set the author id to the userid
        // Set other params
        ...

        $user = $event-&gt;params['user'];

        $entry = new EntryModel()
        $entry-&gt;section = 'profiles' // or whatever the handle is

        ...

        // Set the page title so its easily found/searched
        $entry-&gt;getContent()-&gt;title = $user-&gt;firstName.' '.$user-&gt;lastName;

        // userAccount is the field handle to the users field that will link back to the actual user account
        $entry-&gt;setContentFromPost(['userAccount' =&gt; array($user-&gt;id]);

        ...

        // save the entry
        craft()-&gt;entries-&gt;saveEntry($entry);

    }
}
</code></pre>

<p>Another thing to pay attention to I've found is to make sure you listen for the <code>suspend</code>, <code>unsuspend</code> and <code>delete</code> methods as you'll need to update the corresponding profile entry accordingly.</p>

<p>Hope this helps!</p>

CC BY-SA 3.0
2016-03-31T16:03:22.733Z
cool, thanks. So the plugin to hook in is just to avoid having to make the Profile channel entries manually?
Sebastian Thomas
CC BY-SA 3.0
2016-03-31T16:19:06.440Z
Yep! That way the plugin does the work of managing the entries. It's up to the user to then manage the actual content of their own profile.
Damon
CC BY-SA 3.0
2016-03-31T15:39:47.467Z
2016-03-31T15:39:47.467Z
Damon
<p>Not to diminish from Damon's excellent answer — I have certainly used this technique in the past when needed. However, just to provide another option, keep in mind that you don't need to create a separate section/channel for profile information (and thus a plugin to keep them in sync, etc). You can also simply link to a user profile template by creating a route, using <code>username</code> or <code>id</code> (or any other unique identifiable user field or field combination) to identify the user, and then pull data from the custom fields you added to 'users'.</p>

<p>You will first want to create a route in settings to your user profile template. Notice the use of the 'slug' token, which will be available to the template as simply <code>{{ slug }}</code>:</p>

<pre><code>If the URL looks like this:
about/profiles/&lt;slug&gt;   &lt;-- where '&lt;slug&gt;' is the slug token

Load this template:
about/user-profile.twig
</code></pre>

<p>In your 'about' page template (i.e. the user's index page):</p>

<pre><code>{% set users = craft.users.group('myGroup').limit(null) %}
&lt;ul&gt;
    {% for user in users %}
        &lt;li&gt;&lt;a href="{{ siteUrl }}about/profiles/{{ user.username|lower }}&gt;{{ user.firstName }} {{ user.lastName }}&lt;/a&gt;&lt;/li&gt;
    {% endfor %}
&lt;/ul&gt;
</code></pre>

<p>Then, in your 'about/user-profile' template:</p>

<pre><code>{% set user = craft.users.username(slug).first %}
{% if user %}
    &lt;h1&gt;{{ user.firstName }} {{ user.LastName }}&lt;h1&gt;
    &lt;p&gt;{{ user.biography }}&lt;p&gt;
    etc...
{% else %}
    {% redirect '404' %}
{% endif %}
</code></pre>

CC BY-SA 3.0
2016-04-01T08:17:06.647Z
Cool, that's kind of what Brad suggested here: http://craftcms.stackexchange.com/questions/1308/user-profile-public-page/1310#1310
Thanks!
Sebastian Thomas
CC BY-SA 3.0
2016-03-31T17:35:25.907Z
2016-03-31T17:42:12.480Z
2016-03-31T17:42:12.480Z
Douglas McDonald
<p>I think Douglas has kind of answered this <a href="https://craftcms.stackexchange.com/questions/6841/craft-for-author-agency-website/" title="here">here</a>, but just to ask as a separate question:</p>

<p>Given I have made use of Craft's User section to hold data about a company's team members, how do I now make an entry page for each member, which can link through from the list page? ('About us' single containing a loop over Users).</p>

<p>I originally had a channel for the team members, but switched to using Users because they will be authoring blog posts, and I figured the relation would be cleaner.  </p>

<p>Thanks. </p>

CC BY-SA 3.0
2016-03-31T17:23:54.500Z
Possible duplicate/answer http://craftcms.stackexchange.com/a/1310/3890
Sebastian Thomas
<users><entry><author>
Best way to create an entry (bio) view for a User
# Best way to create an entry (bio) view for a User

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

I think Douglas has kind of answered this [here](https://craftcms.stackexchange.com/questions/6841/craft-for-author-agency-website/ "here"), but just to ask as a separate question:

Given I have made use of Craft's User section to hold data about a company's team members, how do I now make an entry page for each member, which can link through from the list page? ('About us' single containing a loop over Users).

I originally had a channel for the team members, but switched to using Users because they will be authoring blog posts, and I figured the relation would be cleaner.

Thanks.

**Tags:** users, entry, author

> **Comments:**
> **username_0**: Possible duplicate/answer http://craftcms.stackexchange.com/a/1310/3890  

---

## 2 answers

### Answer by username_2 on 2016-03-31. Score: 4 | Accepted answer

Not to diminish from username_1's excellent answer — I have certainly used this technique in the past when needed. However, just to provide another option, keep in mind that you don't need to create a separate section/channel for profile information (and thus a plugin to keep them in sync, etc). You can also simply link to a user profile template by creating a route, using username or id (or any other unique identifiable user field or field combination) to identify the user, and then pull data from the custom fields you added to 'users'.
You will first want to create a route in settings to your user profile template. Notice the use of the 'slug' token, which will be available to the template as simply {{ slug }}:
If the URL looks like this:
about/profiles/   <-- where '' is the slug token

Load this template:
about/user-profile.twig

In your 'about' page template (i.e. the user's index page):
{% set users = craft.users.group('myGroup').limit(null) %}

    {% for user in users %}
        <a href="{{ siteUrl }}about/profiles/{{ user.username|lower }}>{{ user.firstName }} {{ user.lastName }}
    {% endfor %}


Then, in your 'about/user-profile' template:
{% set user = craft.users.username(slug).first %}
{% if user %}
    {{ user.firstName }} {{ user.LastName }}
    {{ user.biography }}
    etc...
{% else %}
    {% redirect '404' %}
{% endif %}

> **Comments:**
> **username_0**: Cool, that's kind of what Brad suggested here: http://craftcms.stackexchange.com/questions/1308/user-profile-public-page/1310#1310 Thanks!  

---

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

I would create a new section called "Profiles" or something along those lines. This is where all of your...extended profile information will go. You can then add a users filed type on those entries that will link back to the user account.
Depending on how you are creating users (manually or through some other form) you will want to create a plugin that listens to the users.onSaveUser event. 
So in your plugin that would look something like this:
MyPlugin.php
public function init()
{
    craft()->on('users.onSaveUser', function (Event $event)
    {
        // Get the userId       
        // Check if the user already has a profile
        // Create a new entry in the 'profiles' section
        // Set the author id to the userid
        // Set other params
        ...

        $user = $event->params['user'];

        $entry = new EntryModel()
        $entry->section = 'profiles' // or whatever the handle is

        ...

        // Set the page title so its easily found/searched
        $entry->getContent()->title = $user->firstName.' '.$user->lastName;

        // userAccount is the field handle to the users field that will link back to the actual user account
        $entry->setContentFromPost(['userAccount' => array($user->id]);

        ...

        // save the entry
        craft()->entries->saveEntry($entry);

    }
}

Another thing to pay attention to I've found is to make sure you listen for the suspend, unsuspend and delete methods as you'll need to update the corresponding profile entry accordingly.
Hope this helps!

> **Comments:**
> **username_0**: cool, thanks. So the plugin to hook in is just to avoid having to make the Profile channel entries manually?  
> **username_1**: Yep! That way the plugin does the work of managing the entries. It's up to the user to then manage the actual content of their own profile.  

---

