I'm using SafeCracker Registration so that I can use the power of Channels for Member fields. My members are being assigned between 2 Member Groups. Questions:

  1. How do I loop through a list of Members filtered by Member Group?
  2. How do I access the member's Channel data within the loop?

Also, I made the design decision to only use the bare minimum Member fields (which are email & password) and let everything else be in the Channel. So, if I the Member's location, I don't use the Member field's location field. Instead, I define a new Channel field, say, member_location. Is this a good approach?

  • Are you asking regarding the front end or via the backend? Also, what add-on are you using that connects the two— Zoo Visitors, Profile:Edit, Solspace's User? Dec 23, 2012 at 13:25
  • Frontend. I'm using SafeCracker Registration. Dec 23, 2012 at 14:25

2 Answers 2


How do I loop through a list of Members filtered by Member Group?

You could just use the group_id parameter. http://ellislab.com/expressionengine/user-guide/modules/channel/channel_entries.html#group-id

{exp:channel:entries channel="members" dynamic="no" group_id="6"}



And the easiest way to display a member location is with my Google Maps for ExpressionEngine add-on, which works with Saferacker. The easiest way is to use the fieldtype (FT). You don't have to use the FT, rather you could use a standard lat/lng coordinate.

{exp:gmap:init id="map" style="width:100%;height:400px"}

{exp:channel:entries channel="members" dynamic="no" group_id="6"}

    {your_gmap_field id="map"}


Or alternative, use the exp:gmap:marker tag. This would also create an infowindow too with the {title} tag as the content.

    {exp:gmap:init id="map" style="width:100%;height:400px"}    {exp:channel:entries channel="members" dynamic="no" group_id="6"}

    {exp:gmap:marker id="map" latitude="{your_lat_field}" longitude="{your_lng_field}"}



Obviously you don't have to use my Google Maps add-on, but it's definitely the easiest way to do what you want.

You may also want to check Entries, a new add-on designed get complex entry data. I will definitely add a method to pull out entries via member group, that's a good idea. This is still in beta, but I will be finishing it up in the next week or two.


Is this a good approach?

I think so, it's how I handle all my other client sites. It something isn't available that you think should be, just let me know and I will see about adding the feature.

  • If I needed to display the email addresses, I would have a nested loop, right? Email is in the Member data. So, loop over the Members, then inside the loop, I would need to loop over the Channel to get the entry authored by the current Member. Seems inefficient. No? Dec 23, 2012 at 20:14
  • I see what is happening. The {email}variable is getting parsed earlier than the channel entries tag, so it will always output the data associated with the logged in member vs. the email assigned to that record. This should be an easy update, and I agree nested entries is not the way to go. Give me a few days after the holiday and I will have another update for you to make this easier. Dec 23, 2012 at 23:15

I'm going to make a good faith effort, but be forewarned that I've actually never used, SafeCracker Registration.

Modules like Zoo Visitors, etc., give you replacement channel tags, bit from what I can see for SafeCracker Registration, the tags are focused on the registration and editing process, leaving the regular ExpressionEngine tags for handling pulling and looping through data.

So accessing member data would be the same as accessing a channel entry. The SafeCracker Migration Utility, (accessible via SafeCracker Registration Settings, I'd assume), seems to be the area where you'd map information. So if you regularly need to access the member_id number, that should probably be mapped to a custom field. Otherwise, I'd assume that accessing member data would look like:

{exp:channel:entries channel="members" limit="10" orderby="member_lastname" sort="asc" dynamic="off"}
    <div class="member-list">
        <h3><a href="http://mysite.org/member/profile/{url_title}">{title}</a></h3>
        <p><em>Location:</em> {member_location}</p>
        <hr />

Very similar to regular channel handling. Now handling member groups would be interesting, because I can't tell if you can map member groups to categories or not. If you can't you'd probably want to do this on the template itself, as a hidden field, if all members were going into one major category. If members were getting assigned to different categories/member groups, then you may need multiple registration forms or to assign groups and categories after the fact.

Or if you didn't need the other profile data for the listing, you could use the regular membership data tags or a custom query to pull a membership listing by group.

I'm not quite certain what you're attempting to accomplish with the members by member groups. SafeCracker Registration, from what I can tell works best for if you have a simple membership/registration process but want the flexibility of use channels. If you need to assign members to multiple membership groups or do other complex things, then based on the write up on Objective HTML site, SafeCracker Registration may not be for you.

But I can't tell if you needs are fairly simple or very complex.

  • No, the migration utility just takes the member profiles and converts them to entries. It doesn't map any fields, there is just no use for custom member fields when using channels to store the profiles. Also the {author_id} variable will get the {member_id}. {member_id} is usually associated with the member that is logged in, whereas {author_id} is the owner of an entry (in this case a profile). Dec 23, 2012 at 19:41
  • You can't map members to multiple groups, but I have used categories to achieve the same effect. My Entries add-on (soon to be released) was designed to make that very easy. I am doing some rather complex front-end stuff using Entries. objectivehtml.dev/entries/documentation Dec 23, 2012 at 19:46
  • Thanks Justin. I thought the categories would work, I just wasn't certain on if he needed group based permissions for say posting or something. Sorry about getting what the migration utility does wrong. Dec 23, 2012 at 20:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.