VZ Members is my second fieldtype for Brandon Kelly’s FieldFrame extension. I needed a way to select any number of site members to associate with an entry. In my case I am doing this to allow entry creators to set permissions on an entry-by-entry basis. You could also use it to link to the profiles of people mentioned in an article, or inside a Matrix field to create a list of events, each with a date, title, and the personnel who will be in attendance. If you find other creative ways to use VZ Members, please share them in the comments.

The fieldtype displays either a dropdown list or a group of checkboxes containing the members in one or more member groups. The allowed member groups can be set on a per-field basis. For each field you can also choose whether the user can select only one member (from a drop-down list) or any number of members (checkboxes).
Download VZ Members
Prerequisites
You must have FieldFrame (version 1.4+) installed to use VZ Members on EE 1.6+.
Template Tags
Single Tags
{members_field}
Will output a pipe-delimited list of member ids. You can also use the separator parameter to separate them with something other than a pipe. For instance {members_field separator=', '} would output something like: 1, 4, 5, 8.
{members_field:names}
Will output a list of member screen names with a comma and space between each. You can also use the separator parameter to separate them with anything else. For instance {members_field:names separator=' and '} would output something like: Bob Smith and Jane Doe and Jimmy Jones.
{members_field:is_allowed members="1|4" groups="3" current_member="yes"}
Checks if the members selected in this entry are among the members or groups specified in the tag parameters. You can specify member ids and/or group ids and either one can be a pipe-delimited list. You can also use the current_member=“yes” parameter to check if the logged in member is among the selected members.
With EE 1.6, it can also be used as a tag pair, in which case the content between the tags will only be displayed if the selected members are among those specified in the tag. EE 2 does not, unfortunately, support that syntax so you must use the tag inside a conditional to get the same effect. For example, if you want to show a notice for every weblog entry where a super-admin was selected, use this code in EE 1.6: {members_field:is_allowed groups="1"}Super!{/members_field:is_allowed}. In EE 2, the equivalent would be: {if “{members_field:is_allowed groups="1"}”}Super!{/if}.
{members_field:is_not_allowed members="1|4" groups="3" current_member="yes"}
This is the exact opposite of :is_allowed. See above for options.
Tag Pair
{members_field}{id} - {screen_name}{/members_field}
If you need more control over the output, use the tag pair.
Optional Parameters:
orderby=“id|username|screen_name|group_id” - The column to use in ordering the output. Default is id.
sort=“asc|desc” - Which order to sort in. Default is asc.
backspace=“2” - Remove the last x characters from the final iteration.
Variables:
id - The id of the current member.
username - The login name of the current member.
screen_name - The screen name of the current member.
group_id - The id of the group to which the current member belongs.
count - The number of the current iteration.
total_results - The total number of members selected.
switch=“odd|even” - Switch between multiple values each time through the loop.
Installation
Download and unzip the extension. Upload the files, following the folder structure in the download. You simply need to enable the VZ Members fieldtype in FieldFrame’s extension settings to be ready to go.
Version History
- Version 1.0.3 Compatibility with Safecracker.
- Version 1.0.2 Add
{field_name:is_not_allowed}tag andcurrent_memberparameter. - Version 1.0.1 Fix for unselectable buttons in Internet Explorer.
- Version 1.0.0 EE2 compatible! Also completely redesigned with lots of code cleanup and refactoring.
- Version 0.97 Fixed a couple bugs in the HTML output.
- Version 0.96 Added
:is_allowedtag. - Version 0.95 Initial public release. May be buggy! Use at your own risk! If you do find any bugs, please report them on the GitHub Issues page.
Comments:
Guy on February 22, 2011 at 8:09pm#1
Is there a reason the output tags wouldn’t work within a reverse related entry block?
EliVZ on February 23, 2011 at 8:26am#2
I can’t think of a reason off the top of my head. Outputting the list of members in a template is by far the most straightforward part of the extension. Can you email me that part of your template code (see the “contact” link at the top of the page) and tell me what version of EE you are using?
Nathan Pitman on May 12, 2011 at 2:34pm#3
Hi there, this is a great field type, is it at all compatible with Safecracker? :)
EliVZ on May 12, 2011 at 9:17pm#4
It is now! Thanks for giving me the push to test it out with Safecracker and make the few small changes necessary to make it work. Let me know if you have any trouble.
DDP on July 1, 2011 at 2:22am#5
Eli, your fieldtype is great. But, any chance you could update it to hook into Solspace’s User module, so it allows me to display their override screen name (they allow Member Custom Fields to be used to build custom screen names, like new default screen name built using: “user_first_name | user_last-name”).
Better yet, get Solspace to incorporate this fieldtype into User! Just an idea. Thanks.
EliVZ on July 1, 2011 at 3:45pm#6
DPP- That’s a good idea. I haven’t used User in a project in quite a while, so I’m not sure how difficult it is to tie into their custom tags, but I will definitely add it to my to-do list to look into. In the mean time, I think this will work (although I haven’t actually tested it):
{exp:user:users member_id=”{vz_members_field}” parse=“inward”}</pre>{screen_name}
{/exp:user:users}
Matt on July 1, 2011 at 4:23pm#7
Thanks for the code, Eli. But, no go—it outputs {screen_name} twice.
I think, for now, I will “fake” it, by utilizing real names as the screen name. I’m still in build-out and testing for the next few months, until a fix / alt method becomes available, so at least I can see output that’s what I intend. Thanks!
EliVZ on July 1, 2011 at 8:07pm#8
Do you have two members selected in that field? It sounds like it is almost working, just User isn’t parsing the tag for some reason. Did you fix the quotes? EE converted them to curly quotes in my comment, which would screw things up….
You might try other User tags in case it’s just screen_name that isn’t working, or contact Solspace to see if they have any ideas.
DDP on July 3, 2011 at 3:45pm#9
Eli,
I"m working with Solspace on a solution, via an EE Query. It’s almost there.
<div class=“module clearfix”><h4>Mentions in this article…</h4>
{if ‘{my_vz_member_field}’ != “”}
{my_vz_member_field}
[url=”{path=‘member/profile/“class=”” ]{exp:query sql=“SELECT m_field_id_1, m_field_id_2 FROM exp_member_data WHERE member_id = {id}”}{m_field_id_1} {m_field_id_2}{/exp:query}
[/url]
{/my_vz_member_field}
{if:else}Surprisingly, no one.{/if}
</div>
Problem is, I’m getting a proper profile ID link, but what’s displaying is my name (admin, the logged in user). I suspect that {id} parsed inside the query is not the VZ Members {id}, rather the global EE {id}...???
Thanks for all of your assistance thus far.
EliVZ on July 3, 2011 at 6:08pm#10
Hmm… There’s something weird going on with the Query module. I couldn’t get it to work, even with the ID hard-coded. I don’t have a User license (well, I do, but it’s for User 2), so I can’t really test your code. I did get the following to work using EE’s native Custom Profile Data tag.
{my_vz_member_field}{exp:member:custom_profile_data member_id=”{id}”}
{member_custom_field}
{/exp:member:custom_profile_data}
{/my_vz_member_field}
I don’t see why it shouldn’t work with the {exp:user:users} tag instead, but let me know. Otherwise, if you want to email me (see my contact page) the login credentials for your CP, I would be happy to see what I can do.
Bryan Lewis on August 30, 2011 at 9:10pm#11
Trying to use this with Safecracker. It seems to work when in a matrix field, but when used by itself it always says that “There are no member groups selected” even though they are.
Using it within Matrix adds an extra layer of loops to getting at the member data as none of this module’s custom fields seem to be available in the matrix loop. I’d really like to free this field to work on it’s own. Seems like just the ticket.
Any ideas if/what I’m doing wrong? Thanks!
Bryan Lewis on August 30, 2011 at 9:14pm#12
Figured it out!
The download link on GitHub is for the 1.0 version.
The only way to get 1.0.3 was to view your source files and update mine.
All working now!
EliVZ on August 31, 2011 at 3:30am#13
Bryan-
Glad you got it working. If you click “Download .zip” rather than selecting the 1.0 tagged version in GitHub, you should get the current version. If you didn’t… I don’t know why. I should probably remove that tag so as not to confuse people though.
Matthew Johnson on April 2, 2012 at 10:06pm#14
in EE2 is there a way to basically do this
{members_field:is_allowed members=”{member_field}”} ?
So in other words check to see if the current logged in user is one of the users that has been associated with the entry.
I’m trying to show the entry based on if the currently logged in member is in the {member_list} associated with a certain entry.
EliVZ on April 3, 2012 at 4:48pm#15
Matthew,
It’s actually even easier than that. You just need to use the
current_memberparameter to check if the logged in member is one of those selected in the fieldtype. So this should do what you want:{members_field:is_allowed current_member=“yes”}Matt Johnson on April 3, 2012 at 8:44pm#16
Question, what would it take to make the Field type a matrix view with sortable columns?
Send me an email if you want to converse about it there.
Bryan Crabtree on April 25, 2012 at 12:39am#17
I’m trying to figure out if this can be used with the channel entry search variable. Something like:
{exp:channel:entries channel=”{my_channel}” search:members_field=”={logged_in_member_id}”}
So basically the channel entries loop only shows the entries that have been assigned to current logged in member.
Thanks!
EliVZ on April 25, 2012 at 3:52pm#18
Bryan, I don’t see any reason that wouldn’t work. I haven’t actually tried it, but the member data is stored as a plain member ID (or pipe-delimited list of member IDs), so the search parameter should find it just fine.
Kevin on June 12, 2012 at 10:28pm#19
Hi EliVZ
I’m having a right headache. I’m just trying to display the trial coach name from a member list:
{exp:channel:entries channel=“teams” status=“open”}
{exp:playa:parents channel=“trial_dates”}
{trial_info}
{trial_date format=”%d %M %Y”}
{trial_time format=”%H:%i”}
{trial_coach}{screen_name}{/trial_coach}
{/trial_info}
{/exp:playa:parents}
{/exp:channel:entries}
This line
{trial_coach}{screen_name}{/trial_coach}is causing PHP errors. However when I use{trial_coach}on by itself, i get the member ID. I can’t seem to convert it to the member name/screen name.I hope you can help ;)
Alli on June 26, 2012 at 1:23pm#20
Hi
I’m a bit confused! I have a matrix field called ‘member_gallery’ for a private photo gallery. The vz members field is called ‘allow’. How do I check if the logged in member is one of those chosen in the allow field so they can view the images in the gallery?
Thanks
EliVZ on June 26, 2012 at 4:57pm#21
Alli,
So the Members field is outside of Matrix, and should affect the entire gallery? If so, you would need something like this:
{if “{allowed:is_allowed current_member=“yes”}”}</pre>{member_gallery}
...
{/member_gallery}
{/if}
Alli on June 27, 2012 at 10:23am#22
Hi Eli
Thanks I was making it too complicated and trying to give permision on a photo to photo basis within the matrix!
One other thing, is there a way to change the check boxes to a multiple select dropdown - I have a huge number of members and the dropdown would be a much better option
EliVZ on June 27, 2012 at 6:13pm#23
That should be pretty easy to add. I’ll try to get an update out later this week.
Ferdehoqst on August 22, 2012 at 9:40pm#24
Комплексное продвижение сайта
Каталоги,профили,форумы,трастовые сайта
ICQ 611331083
Spawnet on September 10, 2012 at 5:22am#25
Нашёл что искал.
спасибо автору.С уважением,spawnet.
Mike on September 10, 2012 at 5:46pm#26
I added your plugin inside a matrix tag and wanted to use the search:field_name = “{member_id}/W” to get the current member’s entries. It doesnt seem to be working. Is there a work around? Thanks.
EliVZ on September 11, 2012 at 3:41am#27
Mike,
Have you seen this post? https://getsatisfaction.com/pixelandtonic/topics/searching_matrix_field_value_as_a_channel_entries_search_parameter
Take a look at Brandon’s first reply there… you need to make sure the Matrix column is set to searchable. Also, I believe you are looking for “\W” rather than “/W” - and you might also try it without that flag at all if you are still not getting any results. Let me know how you fare.
Eric Westbrook on November 1, 2012 at 7:53pm#28
Is there a way to order entries by a vzmember field by member:name instead of member:id? I want to be able to sort a list of clients alphabetically by their assigned members. i tried orderby=member:names with no luck and surprisingly can’t seem to find others looking to be able to do this.
EliVZ on November 6, 2012 at 12:38am#29
Eric- Unfortunately, that’s not possible due to the way the channel:entries sorting mechanism works. There is no way for fieldtypes to provide their own sorting code, it just works with whatever is stored in the database (in this case, the member_id). The other option is to use the SQL module to create your own query with a JOIN to the members table. That may be more complex than you’re looking for, though.
Laisvunas on November 6, 2012 at 8:05am#30
I found a bug in the version 1.0.6 and posted the fix here: http://devot-ee.com/add-ons/support/vz-members/viewthread/7702