-
Book Overview & Buying
-
Table Of Contents
concrete5 Cookbook
By :
Users in concrete5 can have custom attributes that get defined through the interface. Imagine a website where you would like to know your users' ages. concrete5 does not provide an age field for users out of the box, but one can easily be added using attributes.
First, you will want to make sure that the attribute exists in the concrete5 site before trying to set it. Go to http://example.com/dashboard/users/attributes (replacing example.com with your own domain name, of course) and make sure that the attribute that you are creating exists. The page will look similar to the following screenshot:

In this recipe, we will work with an attribute with the handle of age, so feel free to create that attribute to follow along.
The steps for setting a user's attributes are as follows:
Load the currently logged-in user.
$user = new User();
Load the UserInfo object for that user.
$userInfo = UserInfo::getByUserID($user->getUserID());
Set the age attribute...
Change the font size
Change margin width
Change background colour