Craft 3 How to get custom user field values I have following custom fields for users.

favouriteEntries - 'entry' type field with multiple entries per user
notificationPreference - Lightswitch field


My plugin should email notifications to users who follow that entry when there is an update to a particular entry (Entry::EVENT_AFTER_SAVE).

use craft\elements\User;

$users = User::find()-&gt;all();


With the above code, I can get all user data including notificationPreference but favouriteEntries. favouriteEntries field returns null even if it has entries for all users. 

What's the correct way to get all user data including favouriteEntries field?
You should be able to access the custom fields on element\user object. 

Craft::$app-&gt;getUser()-&gt;getIdentity()-&gt;getFieldValue('customfieldname');