-
Book Overview & Buying
-
Table Of Contents
concrete5 Cookbook
By :
In addition to setting attributes, we can also retrieve them. In this recipe, we will retrieve the attribute for the user's age, which we set in the previous recipe.
As in the previous recipe, you will need to make sure that any attributes you are retrieving actually exist in concrete5. In this case, we will be referencing an attribute with the handle of age. If your concrete5 system does not have a user attribute available called age, please adapt this recipe to fit your needs.
The steps for retrieving a user's attributes are as follows:
Load the currently logged-in user.
$user = new User();
Get the user info object for the user.
$userInfo = UserInfo::getByID($user->getUserID());
Get the value of the user's age attribute.
$age = $userInfo->getAttribute('age');concrete5 provides a simple API to retrieve attributes from users. In the database, attribute keys and values are spread over several tables and are difficult...
Change the font size
Change margin width
Change background colour