<p>Response via Slack from Brandon Kelly:</p>

<blockquote>
  <p>Accessing custom field values from PHP is the same as in Twig - once you have the UserModel it's just <code>$user-&gt;myCustomFieldHandle</code>
  or <code>$user-&gt;myEntriesField-&gt;first()</code>, etc.</p>
</blockquote>

<p>Managed to get via following: <code>$user-&gt;company-&gt;first()-&gt;title</code></p>

CC BY-SA 3.0
2016-05-18T12:49:41.347Z
2016-05-18T12:49:41.347Z
Cole Henley
<p>I have a User entries field called 'company'.
I'm writing a bespoke plugin to manage users in the front-end and was wondering how I can access the content of this field in my plugin via the user model?</p>

<p>Any thoughts as struggling a wee bit here!  </p>

CC BY-SA 3.0
2016-05-18T12:34:10.700Z
This question will no doubt put you on the right track:
http://craftcms.stackexchange.com/questions/4486/what-is-getcontent-the-contentmodel-and-how-do-i-use-it-to-get-and-set-cust
Luke Pearce
CC BY-SA 3.0
2016-05-18T12:44:33.960Z
Thanks @LukePearce - saw that post and have tried to access via `$user` rather than `$entry` but with no success. Not sure if this is because am referencing an Entry field but proving difficult to see how to access contents.
Cole Henley
<plugin-development><users><entries-field><usermodel>
Accessing custom fields from User Model
# Accessing custom fields from User Model

(Asked by: username_0 on 2016-05-18)

I have a User entries field called 'company'.
I'm writing a bespoke plugin to manage users in the front-end and was wondering how I can access the content of this field in my plugin via the user model?

Any thoughts as struggling a wee bit here!

**Tags:** plugin-development, users, entries-field, usermodel
> **Comments:**
> **username_1**: This question will no doubt put you on the right track: http://craftcms.stackexchange.com/questions/4486/what-is-getcontent-the-contentmodel-and-how-do-i-use-it-to-get-and-set-cust  
> **username_0**: Thanks @LukePearce - saw that post and have tried to access via `$user` rather than `$entry` but with no success. Not sure if this is because am referencing an Entry field but proving difficult to see how to access contents.  

---

## 1 answers

### Answer by username_0 on 2016-05-18. Score: 3

Response via Slack from Brandon Kelly:

> Accessing custom field values from PHP is the same as in Twig - once you have the UserModel it's just `$user->myCustomFieldHandle`
> or `$user->myEntriesField->first()`, etc.

Managed to get via following: `$user->company->first()->title`


---

