class ExpressionEngine\Model\member\memberField
m_field_name
m_field_label
m_field_type
m_field_id
Key
m_field_description
m_field_list_items
m_field_ta_rows
m_field_maxl
m_field_width
m_field_search
m_field_required
m_field_public
m_field_reg
m_field_cp_reg
m_field_fmt
m_field_show_fmt
m_field_exclude_from_anon boolString
m_field_order
m_field_text_direction
m_field_settings json
m_legacy_field_data boolString
No Relationships.
Parameter |
Type |
Description |
Returns |
array |
Returns the member field’s settings. |
Parameter |
Type |
Description |
Returns |
array |
Returns an array of field values for the member. |
Parameter |
Type |
Description |
Returns |
object |
A link back to the Structure object that defines this Content’s structure. |
Parameter |
Type |
Description |
Returns |
string |
Returns the content type member . |
Parameter |
Type |
Description |
Returns |
string |
Returns the name of the table, member_data . |
Parameter |
Type |
Description |
Returns |
string |
Returns the prefix for member fields, m_ . |
Saving with this model will trigger the following events:
$all_member_fields = ee('Model')
->get('MemberField')
->fields('m_field_label','m_field_id')
->all()
->getDictionary('m_field_id', 'm_field_label');
$new_field = ee('Model')->make('MemberField');
$new_field->m_field_type = 'text';
$new_field->m_field_label = 'My Member Field';
$new_field->m_field_name = 'my_member_field';
$new_field->m_field_description = 'A custom member field example';
$new_field->m_field_settings = array();
$new_field->m_field_show_fmt = 'n';
$result = $new_field->validate();
if ($result->isValid())
{
$new_field->save();
}
$field_id = $new_field->m_field_id;
Please note, this is the way to access custom member fields. To access built-in member fields, see below.
$member_id = 3;
$field_column_name = 'm_field_id_1';
$member = ee('Model')->get('Member', $member_id)->first();
echo $member->$field_column_name;
Please note, this is the way to access custom member fields. To access built-in member fields, see below.
$member_id = 3;
$field = ee('Model')->get('MemberField')->filter('m_field_name', 'first_name')->first();
$field_column_name = 'm_field_id_'.$field->m_field_id;
$member = ee('Model')->get('Member', $member_id)->first();
echo $member->$field_column_name;
$member_id = 3;
$member = ee('Model')->get('Member', $member_id)->first();
echo $member->screen_name;