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?
There is not enough information here to answer this because we don't know what you did or how anything was implemented. If the expectation is that you added your own extension to replace a call on that page and it would just work, then that won't be the case.
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)
###end