Can the search results on the member search page be sorted by an ExtendedAttributes or ProfileFields field?
Can the search results on the member search page be sorted by an ExtendedAttributes or ProfileFields field?
Hi,
Here's the C# code:
public class MyUsers
{
public string GetContentIds()
{
SqlDataAccess sd = new SqlDataAccess();
using (SqlCommand cmd = sd.GetCommand("ibby_Get_Sorted_User_Content_Ids"))
{
cmd.CommandType = CommandType.StoredProcedure;
DataTable dt = sd.Execute(cmd);
StringBuilder sb = new StringBuilder();
for (int i = 0; i < dt.Rows.Count; i++)
{
sb.Append(dt.Rows[i]["ContentId"].ToString());
if (i != dt.Rows.Count - 1)
sb.Append(",");
}
return sb.ToString();
}
}
public PagedList<Telligent.Evolution.Extensibility.Api.Entities.Version1.User> GetUsers()
{
UsersListOptions options = new UsersListOptions();
options.ContentIds = GetContentIds();
options.SortBy = "ContentIdsOrder";
return Apis.Get<Users>().List(options);
}
}
And search.vm
#set($filters = $core_v2_page.GetFormValue('filters'))
## perform search
#set($count = 0)
#set ($searchListOptions = "%{ Query = $searchQuery, Sort = 'titlesort', PageIndex = $pageIndex, PageSize = $pageSize }")
$searchListOptions.Add("Filters", "type::user${filters}")
##set ($searchResults = $core_v2_searchResult.List($searchListOptions))
#set ($searchResults = $!$ibby_v1_UserData.GetUsers())
## Render Search Results
#set ($hasMore = false)
#set ($currentPagedQuantity = ($searchResults.PageIndex + 1) * $searchResults.PageSize)
#if ($searchResults.TotalCount > $currentPagedQuantity)
#set ($hasMore = true)
#end
#foreach ($user in $searchResults)
#beforeall
<div class="content-list thumbnail ui-masonry margin-top" id="$core_v2_encoding.HtmlAttributeEncode($core_v2_widget.UniqueId('thumbnails'))" data-columnclass="thumbnail-column">
#each
##set ($user = false)
##foreach ($resultUser in $result.Users)
## #set ($user = $resultUser)
###endThese are 2 completely different methods for getting users so filters are not going to work. You use the users API, the members page is based on search. These methods are not interchangeable.