Skip to content

Instantly share code, notes, and snippets.

@stevewithington
Last active January 3, 2016 21:49
Show Gist options
  • Save stevewithington/8524689 to your computer and use it in GitHub Desktop.
Save stevewithington/8524689 to your computer and use it in GitHub Desktop.
Mura CMS : Example of how to create a user feed bean and loop over the user iterator to output data and extended attributes.
<cfscript>
// USER feed bean
userFeed = $.getBean('userFeed');
// if user(s) belong to a different site, specify desired siteid
// userFeed.setSiteID('someSiteID');
// if you know the groupid, you can filter that
// userFeed.setGroupID('someGroupID', false);
// filter only users of a specific subType
// userFeed.addParam(
// relationship='AND'
// , field='tusers.subtype'
// , condition='EQUALS'
// , criteria='Physician'
// , dataType='varchar'
// );
// the iterator!
userIterator = userFeed.getIterator();
</cfscript>
<cfoutput>
<cfif userIterator.hasNext()>
<ul>
<cfloop condition="userIterator.hasNext()">
<cfset user = userIterator.next() />
<li>
#HTMLEditFormat(user.getValue('lname'))#, #HTMLEditFormat(user.getValue('fname'))#<br />
#HTMLEditFormat(user.getValue('someExtendedAttributeNameGoesHere'))#
<!--- <cfdump var="#user.getAllValues()#" /> --->
</li>
</cfloop>
</ul>
<cfelse>
<div class="alert alert-info alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
<strong>Yo!</strong> No users match the filter criteria.
</div>
</cfif>
</cfoutput>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment