How do I programmatically set a Users company field? I'm currently able to add a user with the following code (from the Docs):

$user = new UserModel();
$user-&gt;username  = 'tommy';
$user-&gt;firstName = 'Tom';
$user-&gt;lastName  = 'Foolery';
$user-&gt;email     = 'tom@thefoolery.com';

$success = craft()-&gt;users-&gt;saveUser($user);

if (!$success)
{
    Craft::log('Couldn’t save the user "'.$user-&gt;username.'"', LogLevel::Error);
}


How can I also set the Profile Company name??

I've tried the following with no luck:

$user-&gt;company = 'ACME';

$user-&gt;setContent([ 'fields' =&gt; ['company' =&gt; 'ACME'] ]);
Close! You should be using setContentFromPost() for this.  See here and here for more info.

You code would look like:

$user = new UserModel();
$user-&gt;username  = 'tommy';
$user-&gt;firstName = 'Tom';
$user-&gt;lastName  = 'Foolery';
$user-&gt;email     = 'tom@thefoolery.com';
$user-&gt;setContentFromPost(array('company' =&gt; 'ACME'));

$success = craft()-&gt;users-&gt;saveUser($user);

if (!$success)
{
    Craft::log('Couldn’t save the user "'.$user-&gt;username.'"', LogLevel::Error);
}