diff --git a/docs/_images/field_members.png b/docs/_images/field_members.png new file mode 100644 index 000000000..ef0933aba Binary files /dev/null and b/docs/_images/field_members.png differ diff --git a/docs/add-ons/pro-variables/type.md b/docs/add-ons/pro-variables/type.md index 1d1eea1ed..5b90c3af4 100644 --- a/docs/add-ons/pro-variables/type.md +++ b/docs/add-ons/pro-variables/type.md @@ -60,7 +60,7 @@ Allows applying modifiers, which, among other, are used to apply [on-the-fly ima ## Grid -Uses the native [Grid field](/fieldtypes/grid.md). All native types are available, _except for Relationships_. To output the variable, use the `{exp:pro_variables:pair}` or `{exp:pro_variables:single}` tag where appropriate. You can use any of Grid’s [parameters](/fieldtypes/grid.md#parameters) and [variables](/fieldtypes/grid.ms#variables) using these tags. Additionally, one more parameter is available: +Uses the native [Grid field](/fieldtypes/grid.md). All native types are available, _except for Relationships and Members_. To output the variable, use the `{exp:pro_variables:pair}` or `{exp:pro_variables:single}` tag where appropriate. You can use any of Grid’s [parameters](/fieldtypes/grid.md#parameters) and [variables](/fieldtypes/grid.ms#variables) using these tags. Additionally, one more parameter is available: ### Parameters diff --git a/docs/development/extension-hooks/extension-hooks-overview.md b/docs/development/extension-hooks/extension-hooks-overview.md index 7bac8c885..6327f7217 100644 --- a/docs/development/extension-hooks/extension-hooks-overview.md +++ b/docs/development/extension-hooks/extension-hooks-overview.md @@ -29,6 +29,7 @@ Core hooks are categorized into 5 categories: - [Output Library](development/extension-hooks/global/output.md) - [Pagination Library](development/extension-hooks/global/pagination.md) - [Relationships Fieldtype](development/extension-hooks/global/relationships.md) + - [Members Fieldtype](development/extension-hooks/global/member-ft.md) - [Session Library](development/extension-hooks/global/session.md) - [Template Library](development/extension-hooks/global/template.md) - [Text Helper](development/extension-hooks/global/text-helper.md) diff --git a/docs/development/extension-hooks/global/member-ft.md b/docs/development/extension-hooks/global/member-ft.md new file mode 100644 index 000000000..85422f098 --- /dev/null +++ b/docs/development/extension-hooks/global/member-ft.md @@ -0,0 +1,60 @@ +--- +lang: php +--- + + + +# Members Fieldtype Extension Hooks + +[TOC=3] + +### `member_relationships_display_field($entry_id, $field_id, $sql)` + +| Parameter | Type | Description | +| ---------- | -------- | ------------------------------------------------------- | +| \$entry_id | `Int` | Entry ID of entry being edited. | +| \$field_id | `Int` | Field ID of field currently being loaded. | +| \$sql | `String` | Compiled SQL about to be run to gather related members. | +| Returns | `Array` | Result Array of query result. | + +Allows developers to modify the existing query that retrieves related members for the publish field or to perform their own queries to return related members. + +How it's called: + + if (ee()->extensions->active_hook('member_relationships_display_field') === TRUE) + { + $related = ee()->extensions->call( + 'member_relationships_display_field', + $entry_id, + $this->field_id, + ee()->db->_compile_select() + ); + } + else + { + $related = ee()->db->get()->result_array(); + } + +NOTE: **Note:** To use this hook, you can either add to the existing Active Record call, or call `ee()->db->_reset_select()` to cancel the Active Record call and start your own, or modify the passed compiled SQL. + +### `member_relationships_post_save($ships, $entry_id, $field_id)` + +| Parameter | Type | Description | +| ---------- | ------- | ---------------------------------------------- | +| \$ships | `Array` | Array of member IDs to be related to the entry. | +| \$entry_id | `Int` | Entry ID of entry being saved. | +| \$field_id | `Int` | Field ID of field currently being saved. | +| Returns | `Array` | Array of relationships. | + +Allows developers to modify or add to the relationships array before saving. + +How it's called: + + $ships = ee()->extensions->call('member_relationships_post_save', $ships, $entry_id, $field_id); diff --git a/docs/fieldtypes/member.md b/docs/fieldtypes/member.md new file mode 100644 index 000000000..25c00f25b --- /dev/null +++ b/docs/fieldtypes/member.md @@ -0,0 +1,171 @@ + + +# Members Fieldtype + +The Members Fieldtype allows selecting one or multiple members and associating those with a channel entry + +[TOC] + +The Members fieldtype helps you connect Members to Channel Entries. This lets you create powerful relationships between Members and content in your Channel entries. For example, you could create a Channel called "Articles" and a Channel Field called "Authors" that uses the Members fieldtype. You could then associate one or more Members with each Article entry. This would allow you to display the author's name, bio, photo, etc. on the Article page. + +![members field](_images/field_members.png) + +## Field Settings + +#### Roles to include + +Only allow selecting member with chosen primary roles. Note that secondary roles are not being taken into account when working with Members field. + +#### Maximum number of available members + +Sets the number of members displayed in the field's dropdown. Leave blank to allow all members. All members are still available to the search, this is simply a display setting. + +#### Order By + +Default ordering of members in the field's dropdown. + +#### Allow Multiple Relationships? + +When set to yes, authors will be allowed to create multiple relationships in a single field. + +#### Minimum selection +The minimum number of members that can be added to the field. + +#### Maximum selection +The maximum number of members that can be added to the field. + +#### Display Member IDs? +When enabled, member IDs will be displayed together with member screen name inside the field. + +#### Defer field initialization? +When enabled, this field won’t initialize until the Edit Members button is clicked on. This can result in faster control panel page load times. + +## Template Tag Pair + +The field is most useful when used as tag pair in the template. All variables are prefixed with the field's short name, followed by semicolon, to avoid naming conflicts. + + {members_field} +