Introduction

Smart members field is enhanced field type that gives user ability to relate members in same manner one can relate entries. You just need to create a field (same way you create field for relationships). Smart members field type is supported with normal field type, Grid and Fluid field types.

Smart members field has backend from which you can assign Channel entries to members or primary roles. So, our addon will works in both way means you can assign members to Channel entries as well you can assign Channel entries to members or primary roles also.

Front end code to populate data is same as in relationships that gives maximum control over the field type. Also use to populate data is same as Channel entries loop just need to write {exp:smart_members_field:entries} instead of {exp:channel:entries}.

Compatibility

EE Compatible Version: EE4, EE5 and EE6

Some of the features of Smart members field type is given below:

  1. You can manually choose what you want to list down in create/edit entry page field. (textbox where you can define what you want to populate in entry)
  2. Search among the members to relate them.
  3. Instantly toggle selected and unselected members in field.
  4. Support of GRID and FLUID field type.
  5. Easy (and almost like relationships field) front end codes to populate data.
  6. Allow custom field in front end to populate any normal or custom member field information of a member.
  7. Support filter by group ID or Primary role ID and member ID.
  8. Support order by and sort parameters to maintain flow.
  9. You can assign Channel entries to members or member roles and render it with very simple loop {exp:smart_members_field:entries} similar to {exp:channel:entries}

Installation

Follow below steps to install Smart Members Field version:

EE4, EE5 and EE6:

  1. Download and Extract ZIP file of the module. (We recommend to use latest version.)
  2. Copy “SmartMembersField > system > user > addons > smart_members_field” folder to “Your Site > system > user > addons” Folder.
  3. Copy “SmartMembersField > themes > user > smart_members_field” folder to “Your Site > themes > user” Folder.
  4. Login to backend panel with Super admin credentials.
  5. Go to “Developer > Add-Ons” and Install Smart members field module.

Note: If you purchased the addon from Devot:ee then you can get the license key from the licenses tab in your profile.

Custom Sidebar

We provide one “customSidebar” function in the MCP file. You can add more menus in the sidebar of the addon using this function.

/* To get dynamic menu in the addon */    
   function customSidebar(){
       $sidebar = ee('CP/Sidebar')->make();
       $this->navSettings  = $sidebar->addHeader('Test Link', '');
   }

Create/Edit Field

Follow below steps to create new Smart Members Field:

  1. Go to field manager and click on “New Field”
  2. Select Smart Members Field type in input type box. You will find settings of this field type in bottom.

There is few settings (Field Options) field type will ask you for:

  1. Member Primary Role
  2. Display format on entry page
  3. Maximum members
  4. Order
  5. Allow multiple Members?

Member Primary Role

You need to select the member primary roles from which members will show you on smart members field in create/edit entry. Unselected primary role’s members will be excluded and will not show on member selections.

Display format on entry page

Format you set up here will display on create/edit entry in smart members field.

Maximum members

Enter maximum members you want to show in entry selection. make this field blank will bring all the members without any limit.

Order

This is order by field where you can select how members will be listed in create/edit channel entry with sorting order.

Allow multiple Members?

Set enabled will allow author to select multiple members in Smart members field.
Set disabled will allow author to only select one members in field.

Channel Entry page

Create/Edit channel entry

This is how field will look like in channel entry pages.

Assign Channel Entries to Members or Primary roles.

Follow below steps to assign Channel Entries to Members or Primary roles:

  1. Go to addon’s homepage and click on “Create New”.
  2. Enter Name, then Select “Type of assignment”
  3. Select “Members” or “Member roles”
  4. Select channel entries.

Fieldtype

Smart members field template tags is just like to use relationships field. We have introduce some parameters in field tags that will allow user to filter the output and will give more control over the data populations.

Parameters

Below is the details of parameters with example:

prefix

This parameter will allow user to override output tag prefix. Default prefix is field itself.

Example:

prefix="smf"

group_id

This parameter will allow user to filter data by member groups. If result contains members that are in certain group and you don’t want to include those members or want to include only those group, You can do it with this parameter.You can pass the primary role ID for the EE6. 

Example:

group_id="5"
group_id="5|6"
group_id="not 1"
group_id="not 1|2|3"

member_id

This parameter will allow user to filter data by member IDs. If you don’t want to include some members in list or just want to show some members, You can do it with this parameter.You can pass the primary role ID for the EE6.

Example:

member_id="35"
member_id="35|40"
member_id="not 1"
member_id="not 1|41|53"

order_by

This parameter use to start sorting via any proper field. You can use both default member field or custom member field to group by the result.

Example:

order_by="member_id"
order_by="first_name"

sort

You can sort the output in ASC or DESC order.

Example:

sort="asc"
sort="desc"

custom_fields

By default you can only poplulate default member fields. If you want to include custom member fields too, You need to pass this parameter:

Example:

custom_fields="yes"

Normal field example

{exp:channel:entries}
{smf_normal_field}
    {if smf_normal_field:no_results}
        <p>We are in no_results stats</p>
    {/if}
    {if smf_normal_field:count == 1}
    <div>
        {/if}
        
        <p> Member ID :            {smf_normal_field:member_id} </p>
        <p> Username :             {smf_normal_field:username} </p>
        <p> Email :                {smf_normal_field:email} </p>
        <p> Screen Name :          {smf_normal_field:screen_name} </p>
        <p> Group ID : {smf_normal_field:group_id} </p> // For EE5
        <p> Primary Role ID : {smf_normal_field:role_id} </p> // For EE6
        <p> Avatar Filename :      {smf_normal_field:avatar_filename} </p>
        <p> Avatar Width :         {smf_normal_field:avatar_width} </p>
        <p> Avatar Height :        {smf_normal_field:avatar_height} </p>
        <p> Photo Filename :       {smf_normal_field:photo_filename} </p>
        <p> Photo Width :          {smf_normal_field:photo_width} </p>
        <p> Photo Height :         {smf_normal_field:photo_height} </p>
        <p> Sig Img Filename :     {smf_normal_field:sig_img_filename} </p>
        <p> Sig Img Width :        {smf_normal_field:sig_img_width} </p>
        <p> Sig Img Height :       {smf_normal_field:sig_img_height} </p>
        <p> Join Date :            {smf_normal_field:join_date format="%d/%m/%Y"} </p>
        <p> Last Visit :           {smf_normal_field:last_visit} </p>
        <p> Total Entries :        {smf_normal_field:total_entries} </p>
        <p> Total Comments :       {smf_normal_field:total_comments} </p>
        <p> Total Forum Topics :   {smf_normal_field:total_forum_topics} </p>
        <p> Total Forum Posts :    {smf_normal_field:total_forum_posts} </p>
        <p> Last Entry Date :      {smf_normal_field:last_entry_date} </p>
        <p> Last Comment Date :    {smf_normal_field:last_comment_date} </p>
        <p> Last Forum Post Date : {smf_normal_field:last_forum_post_date} </p>
        <p> Last Email Date :      {smf_normal_field:last_email_date} </p>
        <p> In Authorlist :        {smf_normal_field:in_authorlist} </p>
        <p> Custom Field :         {smf_normal_field:CUSTOM_FIELD} </p> /// if custom_fields="yes" passed in parameter

        {if smf_normal_field:count == smf_normal_field:total_results}
    </div>
    {/if}
{/smf_normal_field}
{/exp:channel:entries}

Example with GRID

{exp:channel:entries}
{grid}
    {grid:smf_normal_field}
        {if grid:smf_normal_field:no_results}
            <p>We are in no_results stats</p>
        {/if}
        {if grid:smf_normal_field:count == 1}
        <div>
            {/if}
            
            <p> Member ID :            {grid:smf_normal_field:member_id} </p>
            <p> Custom Field :         {grid:smf_normal_field:CUSTOM_FIELD} </p> /// if custom_fields="yes" passed in parameter

            {if grid:smf_normal_field:count == grid:smf_normal_field:total_results}
        </div>
        {/if}
    {/grid:smf_normal_field}
{/grid}
{/exp:channel:entries}

Example with Fluid field

{exp:channel:entries}
{fluid_field}
    {fluid_field:smf_normal_field}
        {content}
            {if content:no_results}
                <p>We are in no_results stats</p>
            {/if}
            {if content:count == 1}
            <div>
                {/if}
                
                <p> Member ID :            {content:member_id} </p>
                <p> Custom Field :         {content:CUSTOM_FIELD} </p> /// if custom_fields="yes" passed in parameter

                {if content:count == content:total_results}
            </div>
            {/if}
        {/content}
    {/fluid_field:smf_normal_field}
{/fluid_field}
{/exp:channel:entries}

Example with GRID field that is included in Fluid field

{exp:channel:entries}
{fluid_field} // Load Fluid field
    {fluid_field:grid}
        {content} // Load GRID field
            {content:smf_field_inside_grid} // Load Smart members Field
                {if content:smf_field_inside_grid:no_results}
                    <p>We are in no_results stats</p>
                {/if}
                {if content:smf_field_inside_grid:count == 1}
                <div>
                    {/if}
                    
                    <p> Member ID :            {content:smf_field_inside_grid:member_id} </p>
                    <p> Custom Field :         {content:smf_field_inside_grid:CUSTOM_FIELD} </p> /// if custom_fields="yes" passed in parameter
    
                    {if content:smf_field_inside_grid:count == content:smf_field_inside_grid:total_results}
                    </div>
                {/if}
            {/content:smf_field_inside_grid}
        {/content}
    {/fluid_field:grid}
{/fluid_field}
{/exp:channel:entries}

Example with GRID by prefix parameter

{exp:channel:entries}
{grid}
    {grid:smf_normal_field prefix="smf"}
        {if smf:no_results}
            <p>We are in no_results stats</p>
        {/if}
        {if smf:count == 1}
        <div>
            {/if}
            
            <p> Member ID :            {smf:member_id} </p>
            <p> Custom Field :         {smf:CUSTOM_FIELD} </p> /// if custom_fields="yes" passed in parameter

            {if smf:count == smf:total_results}
        </div>
        {/if}
    {/grid:smf_normal_field}
{/grid}
{/exp:channel:entries}

Front end Tags

Smart members field front-end tags is just like to use channel entries tag. We have introduce one new parameter in field tags that will allow to filter the output by logged_in member.

Parameters

Below is the details of parameters with example:

smf_filter

This parameter will filter the output by looged_in Member ID.

Example:

smf_filter="yes"

Note: You can use all parameters of Channel Entry tag with {exp:smart_members_field:entries} tag.


Normal field example

{exp:smart_members_field:entries smf_filter="yes"}
{if no_results}  <p>No results found.</p>  {/if}

{if total_results}
//insert all channel entries stuff here like fields, variables etc.
{if count == 1}
    <div>
        {/if}
        <p> Title : {title} </p>
        <p> URL Title : {url_title} </p>        
        ...
        {if count == total_results}
    </div>
    {/if}
{/exp:smart_members_field:entries}

Changelog

V2.0.0

  • New feature is added. (You can assign Channel Entries to specific Members from back-end and renders it by tag {exp:smart_members_field:entries})
  • This addon is also works with EE5.

V3.0.0

  • Updated the license verification process and setup so please update the license in your addon.

V4.0.0

  • Supported for EE6
  • New Feature: Provide facility of the multiple selection of the member or member role instead of
    single selection of member in “All Member” page of the addon.

V4.0.3

  • Bug Fixing