File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -130,3 +130,26 @@ if ($result->isValid())
130130// The field ID is now available.
131131$field_id = $new_field->m_field_id;
132132```
133+
134+ ### Accessing a member field from a member model instance by member field ID
135+
136+ ``` php
137+ $member_id = 3; // Example member ID
138+ $field_column_name = 'm_field_id_1'; // Based on the field ID being 1
139+
140+ $member = ee('Model')->get('Member', $member_id)->first();
141+ echo $member->$field_column_name;
142+ ```
143+
144+ ### Accessing a member field from a member model instance by member field short name
145+
146+ ``` php
147+ $member_id = 3; // Example member ID
148+
149+ // Based on the member field short name being `first_name`
150+ $field = ee('Model')->get('MemberField')->filter('m_field_name', 'first_name')->first();
151+ $field_column_name = 'm_field_id_'.$field->m_field_id;
152+
153+ $member = ee('Model')->get('Member', $member_id)->first();
154+ echo $member->$field_column_name;
155+ ```
You can’t perform that action at this time.
0 commit comments