anchor.diff:  	<cfloop collection="#ARGUMENTS.filter#" item="thisFilter">
   		<cfset cachedQueryName = cachedQueryName & thisFilter & ARGUMENTS.filter[thisFilter] />
   	</cfloop>
  -	<cfset cachedQueryName = Hash(cachedQueryName,'MD5') />
  +	<cfset cachedQueryName = 'db' & Hash(cachedQueryName,'MD5') />
   	<cfquery name="#cachedQueryName#" datasource="#variables.instance.datasource.getDSN()#" username="#variables.instance.datasource.getUsername()#" password="#variables.instance.datasource.getPassword()#" cachedwithin="#ARGUMENTS.filter.cacheTime#">
   		SELECT speakerKey, userId, firstName, lastName, email, phone, showPhone, twitter, showTwitter, specialties, locations, isACP, isAEL, isUGM, isOther
  -		FROM speakers
  -		WHERE 1 = 1
  +		FROM speakers s
  +		LEFT JOIN users u ON u.userId = s.userId
  +		WHERE ( u.isActive = <cfqueryparam value="1" cfsqltype="cf_sql_bit" />
  +		AND u.role = <cfqueryparam value="speaker" cfsqltype="cf_sql_varchar" /> )
     <cfif NOT structIsEmpty(ARGUMENTS.filter)>
       <!--- filter is applied --->
       <cfif structKeyExists(ARGUMENTS.filter, 'userId')>
  -		AND userId = <cfqueryparam value="#ARGUMENTS.filter.userId#" cfsqltype="cf_sql_integer" />
  +		AND s.userId = <cfqueryparam value="#ARGUMENTS.filter.userId#" cfsqltype="cf_sql_integer" />
       </cfif>
       <cfif structKeyExists(ARGUMENTS.filter, 'firstName')>
  -		AND firstName = <cfqueryparam value="#ARGUMENTS.filter.firstName#" cfsqltype="cf_sql_varchar" />
  +		AND s.firstName = <cfqueryparam value="#ARGUMENTS.filter.firstName#" cfsqltype="cf_sql_varchar" />
       </cfif>
       <cfif structKeyExists(ARGUMENTS.filter, 'lastName')>
  -		AND lastName = <cfqueryparam value="#ARGUMENTS.filter.lastName#" cfsqltype="cf_sql_varchar" />
  +		AND s.lastName = <cfqueryparam value="#ARGUMENTS.filter.lastName#" cfsqltype="cf_sql_varchar" />
       </cfif>
       <cfif structKeyExists(ARGUMENTS.filter, 'email')>
  -		AND email = <cfqueryparam value="#ARGUMENTS.filter.email#" cfsqltype="cf_sql_varchar" />
  +		AND s.email = <cfqueryparam value="#ARGUMENTS.filter.email#" cfsqltype="cf_sql_varchar" />
       </cfif>
       <cfif structKeyExists(ARGUMENTS.filter, 'phone')>
  -		AND phone = <cfqueryparam value="#ARGUMENTS.filter.phone#" cfsqltype="cf_sql_varchar" />
  +		AND s.phone = <cfqueryparam value="#ARGUMENTS.filter.phone#" cfsqltype="cf_sql_varchar" />
       </cfif>
       <cfif structKeyExists(ARGUMENTS.filter, 'twitter')>
  -		AND twitter = <cfqueryparam value="#ARGUMENTS.filter.twitter#" cfsqltype="cf_sql_varchar" />
  +		AND s.twitter = <cfqueryparam value="#ARGUMENTS.filter.twitter#" cfsqltype="cf_sql_varchar" />
       </cfif>
       <cfif structKeyExists(ARGUMENTS.filter, 'specialties')>
  -		AND specialties = <cfqueryparam value="#ARGUMENTS.filter.specialties#" cfsqltype="cf_sql_varchar" />
  +		AND s.specialties = <cfqueryparam value="#ARGUMENTS.filter.specialties#" cfsqltype="cf_sql_varchar" />
       </cfif>
       <cfif structKeyExists(ARGUMENTS.filter, 'locations')>
  -		AND locations = <cfqueryparam value="#ARGUMENTS.filter.locations#" cfsqltype="cf_sql_varchar" />
  +		AND s.locations = <cfqueryparam value="#ARGUMENTS.filter.locations#" cfsqltype="cf_sql_varchar" />
       </cfif>
       <cfif structKeyExists(ARGUMENTS.filter, 'isACP')>
  -		AND isACP = <cfqueryparam value="#ARGUMENTS.filter.isACP#" cfsqltype="cf_sql_bit" />
  +		AND s.isACP = <cfqueryparam value="#ARGUMENTS.filter.isACP#" cfsqltype="cf_sql_bit" />
       </cfif>
       <cfif structKeyExists(ARGUMENTS.filter, 'isAEL')>
  -		AND isAEL = <cfqueryparam value="#ARGUMENTS.filter.isAEL#" cfsqltype="cf_sql_bit" />
  +		AND s.isAEL = <cfqueryparam value="#ARGUMENTS.filter.isAEL#" cfsqltype="cf_sql_bit" />
       </cfif>
       <cfif structKeyExists(ARGUMENTS.filter, 'isUGM')>
  -		AND isUGM = <cfqueryparam value="#ARGUMENTS.filter.isUGM#" cfsqltype="cf_sql_bit" />
  +		AND s.isUGM = <cfqueryparam value="#ARGUMENTS.filter.isUGM#" cfsqltype="cf_sql_bit" />
       </cfif>
       <cfif structKeyExists(ARGUMENTS.filter, 'isOther')>
  -		AND isOther = <cfqueryparam value="#ARGUMENTS.filter.isOther#" cfsqltype="cf_sql_bit" />
  +		AND s.isOther = <cfqueryparam value="#ARGUMENTS.filter.isOther#" cfsqltype="cf_sql_bit" />
       </cfif>
       <cfif structKeyExists(ARGUMENTS.filter, 'order_by')>
   	ORDER BY #ARGUMENTS.filter.order_by#
  
positive.code: 		WHERE ( u.isActive = <cfqueryparam value="1" cfsqltype="cf_sql_bit" />
  		AND u.role = <cfqueryparam value="speaker" cfsqltype="cf_sql_varchar" /> )
  		AND (  
  		<cfloop from="1" to="#ListLen(ARGUMENTS.searchTerm,' ')#" index="iX">
  			s.firstName LIKE <cfqueryparam value="%#APPLICATION.dataEnc(ListGetAt(ARGUMENTS.searchTerm,iX,' '))#%" cfsqltype="cf_sql_varchar" />
  			<cfif NOT iX EQ ListLen(ARGUMENTS.searchTerm,' ')> OR </cfif>
  		</cfloop>
  		)
  		OR (
  		<cfloop from="1" to="#ListLen(ARGUMENTS.searchTerm,' ')#" index="iX">
  			s.lastName LIKE <cfqueryparam value="%#APPLICATION.dataEnc(ListGetAt(ARGUMENTS.searchTerm,iX,' '))#%" cfsqltype="cf_sql_varchar" />
  			<cfif NOT iX EQ ListLen(ARGUMENTS.searchTerm,' ')> OR </cfif>
  		</cfloop>
  		)
  		OR ( 
  		<cfloop from="1" to="#ListLen(ARGUMENTS.searchTerm,' ')#" index="iX">
  			s.twitter LIKE <cfqueryparam value="%#APPLICATION.dataEnc(ListGetAt(ARGUMENTS.searchTerm,iX,' '))#%" cfsqltype="cf_sql_varchar" />
  			<cfif NOT iX EQ ListLen(ARGUMENTS.searchTerm,' ')> OR </cfif>
  		</cfloop>
  		)
  		OR ( 
  		<cfloop from="1" to="#ListLen(ARGUMENTS.searchTerm,' ')#" index="iX">
  			s.specialties LIKE <cfqueryparam value="%#ListGetAt(ARGUMENTS.searchTerm,iX,' ')#%" cfsqltype="cf_sql_varchar" />
  			<cfif NOT iX EQ ListLen(ARGUMENTS.searchTerm,' ')> OR </cfif>
  		</cfloop>
  		)
  		OR ( 
  		<cfloop from="1" to="#ListLen(ARGUMENTS.searchTerm,' ')#" index="iX">
  			s.locations LIKE <cfqueryparam value="%#ListGetAt(ARGUMENTS.searchTerm,iX,' ')#%" cfsqltype="cf_sql_varchar" />
  			<cfif NOT iX EQ ListLen(ARGUMENTS.searchTerm,' ')> OR </cfif>
  
negative.code: 		ORDER BY #ARGUMENTS.orderBy#
  	</cfquery>
  	
  	<!--- return the query by name --->
  	<cfreturn variables[queryName] />
  </cffunction>	
  
  