ExpressionEngine 7.5 has been Released! Learn More!
Relate members to your channel entries.
The GB Member Select is like an EE Relationships field but instead of listing the channel entries, it lists the members by the selected member roles (or groups for EE5 folks). Now support Grid field.
Upload the folders to the respective system/user/addons/
and themes/user/
directories and click install on the Add-Ons page.
If your database engine supports ANY_VALUE, please go to system/user/addons/gb_member_select/Service/
and replace MemberSelectService.php
with MemberSelectService.php.ANY_VALUE
.
If you have many custom member fields, please make sure adjust the sort_buffer_size
value in the settings page.
Select the member roles/groups that you want the field to show members from.
The default label representing the member. It is also used for the selector options.
Specify the fields that you want to use when searching the members.
The usual stuff. You can still search for the members not presented in the list using the filter and search box.
I think it works 😉
Still working on this…
{screen_name}
{username}
{email}
{member_id}
{member_custom_field}
{roles} {role:role_id} {role:name} {/roles}
(EE6){member_groups} {group:group_id} {group:group_title} {/member_groups}
(EE5){my_custom_field}
{if no_results}No related members.{/if}
{screen_name}
{username}
{email}
{member_id}
{!-- You can call any member fields by the short_name --}
{member_custom_field}
{!-- EE6 --}
{roles}
{role:role_id}
{role:name}
{/roles}
{!-- EE5 --}
{member_groups}
{group:group_id}
{group:group_title}
{/member_groups}
{/my_custom_field}
{my_custom_field var_prefix="my_prefix"}
{my_prefix:screen_name}
{my_prefix:username}
{my_prefix:email}
{my_prefix:member_id}
{my_prefix:member_custom_field}
{!-- EE6 --}
{my_prefix:roles}
{role:role_id}
{role:name}
{/my_prefix:roles}
{!-- EE5 --}
{my_prefix:member_groups}
{group:group_id}
{group:group_title}
{/my_prefix:member_groups}
{/my_custom_field}
{grid_with_gbms}
{grid_with_gbms:my_custom_field var_prefix="my_prefix"}
{my_prefix:screen_name}
{my_prefix:username}
{my_prefix:email}
{my_prefix:member_id}
{my_prefix:member_custom_field}
{!-- EE6 --}
{my_prefix:roles}
{role:role_id}
{role:name}
{/my_prefix:roles}
{!-- EE5 --}
{my_prefix:member_groups}
{group:group_id}
{group:group_title}
{/my_prefix:member_groups}
{/grid_with_gbms:my_custom_field}
{/grid_with_gbms}
{my_custom_field backspace="1"}{member_id},{/my_custom_field}
Note: The {if no_results}
condition doesn’t work well in {exp:channel:form}
tags, I’ll address it in future releases.
Sure! Here’s how you print a <select>
HTML tag:
{exp:channel:entries entry_id="{entry_id}" status="not closed"}
{exp:gb_member_select:selector
field_name="my_custom_field"
name="selector"
attr:id="my_selector"
attr:class="form-control select-reporter"
option_label="screen_name"
option_value="email"
selected="{my_custom_field backspace="1"}{member_id},{/my_custom_field}"
show_empty="yes"
empty_label="Select a member"}
{/exp:channel:entries}
{exp:gb_member_select:selector
field_name="my_custom_field"
name="selector"
attr:id="my_selector"
attr:class="form-control select-reporter"
option_label="screen_name"
option_value="email"
selected="{exp:channel:entries entry_id='{entry_id}' status='not closed'}{my_custom_field backspace='1'}{member_id}{/my_custom_field}{/exp:channel:entries}"
show_empty="yes"
empty_label="Select a member"
parse="inward"}
The field short_name.
The name=""
of your <select>
. Default to the field short_name.
Member ids separated by ,
to be pre-selected.
What member field to be displayed as the option. Default to the field settings Default Label.
What member field to be used as the option value. Default to member_id
.
Allowed member fields
screen_name
username
email
member_id
member_custom_field
Set to yes
if you want the first option to be blank.
If show_empty="yes"
, the text you want to display as the blank option. Default to --
.
You can add HTML attributes like id attr:id="selector"
, class attr:class="form-select"
and data attributeus like attr:data-entry_id="{entry_id}"
.
GB Member Select lets you lookup the entries you’ve related the members to with any gb_member_select fieldtype by using the {exp:gb_member_select:entries}{/exp:gb_member_select:entries}
tag pair.
Almost exactly like {exp:channel:entries}{/exp:channel:entries}
with 2 more filters:
The member_id of the member that you want to reverse lookup the entries with. If not specified, the current logged in member will be used to do the reverse lookup.
The short name of the gb_member_select field that you want to return the related entries from. If not specified, every gb_member_select field will be used to find the entries related to the member.
Since the gb_member_select entries loop shares exact same variable names with the channel entries loop, please put the gb_member_select entries loop inside an embed if used together. For example, if you have a gb_member_select field called article_by
and you’d like to display the related work from this member:
{exp:channel:entries channel="featured_articles" status="not closed"}
<h2>{title}</h2>
<p>{summary}</p>
<section class="related">
{embed="_includes/_articles_by" member_id="{article_by}{member_id}{/article_by}"}
</section>
{/exp:channel:entries}
{exp:gb_member_select:entries status="not closed" member_id="{embed:member_id}" field_name="article_by"}
<h3>{title}</h3>
{/exp:gb_member_select:entries}
To improve performance, GB Member Select caches the field members for each defined GB Member Select field using the EE cache class. If you have a huge list of members (100,000+) that you want to include in a selector, you might need to adjust your PHP memory_limit and max_execution_time to appropriate settings.
There’re also 2 cache status pages in GB Member Select’s add-on settings that you can generate the cache for the fields and entries. If you turn on flush cache settings in the GB Member Select settings page, these cached results will automatically be cleared upon
or set to out of sync
for the affected fields and channels.
Selected members in entries are also cached, and will automatically get flushed and recreated upon modifications.
sort_buffer_size
configuser_select
and vmg_chosen_member
to gb_member_select
{exp:gb_member_select:entries}
to reverse lookup the entriesEmail Gilbert at gilbert.lin.web@gmail.com
Version | 2.0.4 |
Last Update | 5 months ago |
Compatibility | EE 7, 6, 5 |
License | Commercial |
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.