How to get user fields alias values in Social engine

For getting user fields alias values (values that user fill while signup on profile fields step) we have some functions using that we can get user fields alias values. For example if you wants to get the user first name or other fields info than we can use that function.

First get the user Item using following code:

$user= Engine_Api::_()->getItem('user', $user_id);

After getting user Item you need to call another function that is used for getting user fields values alias values:

$fieldsByAlias = Engine_Api::_()->fields()->getFieldsObjectsByAlias($user);

Now we have $fieldsByAlias array and we need to check what's comes in an array after that fetch values from that array like the following example:

Get User First name:

$firstname = $fieldsByAlias['first_name'];

Get User Last name:

$lastname = $fieldsByAlias['last_name'];

Get User Gender:

$gender = $fieldsByAlias['gender'];

User Profile Page

Post a comment