Get Atributes Based on User ID
Permalink 4 users found helpfulFor example, imagine a block that lists all the users and the email address associated to each user.
I thought the __call function might be the key, but I'm not sure how to use it. It was mentioned here:http://www.concrete5.org/index.php?cID=2984...
HALP!

So, say your user's ID is 4.
<?php Loader::model('userinfo'); $ui = UserInfo::getByID(4); print $ui->getUserEmail(); ?>
Now, the __call function actually works with the custom user attributes. So, say you define a custom user attribute named "bio_information". To get that information about a user, you can just run this method:
<?php Loader::model('userinfo'); $ui = UserInfo::getByID(4); print $ui->getUserBioInformation(); ?>
It'll go into the database and retrieve the user attribute, even though it's one you created.
I don't have the code in front of me, but I remember a second parameter ($a I think). What does it do?
I like the simplicity of this, but I want to create a custom profile page that allows me to display the current and my custom user attributes in specified areas, not just list them underneath each other.
$u = new User();
$ui = UserInfo::getByID($u->getUserID());
List of functions to GET information:
getFileAddLevel()
getFileAdminLevel()
getFileReadLevel()
getFileSearchLevel()
getFileWriteLevel()
getGroupMemberType()
getLastLogin()
getLastOnline()
getNumLogins()
getPreviousLogin()
getUserDateAdded()
getUserEmail()
getUserEndDate()
getUserID()
getUserName()
getUserObject()
getUserPassword()
getUserStartDate()
hasAvatar()
isActive()
isFullRecord()
isValidated()
More functions at:http://concrete5.org/api/