Forums | Mahara Community

Developers / Sorting order in group member search

Posts: 101

23 January 2014, 3:14

Hi,

when I change the sort order in the group members section and use the pagination on the bottom to view the next 10 members, the sort order gets reset. Same happens, when I adjust the results shown per page. The [Maximum items per page] setting on the other hand resets when I change the search order (as is the page number I'm on, but that makes sense to me). So the sort order doesn't quite help me find anything that isn't among the first 10 results.

I wonder if I am the first to encounter that problem but I didn't find a related bug report nor a forum post. If so, I would file a bug report and also try to fix it.

About the fix: I can hand over the [Maximum items per page] setting by handing it to membersearchresult.json.php in members.php. But how would I properly propagate the search order to the pagination? Only way I see is to abuse the query-parameter and send something the like of

$query .= '&sortoption='.$searchoption

in membersearchresults.json.php, before handing it to group_get_membersearch_data()

Or would I extend group_get_membersearch_data() in group.php to accept an additional parameter?

Tobias

Account deleted
Posts: 8
Re: Sorting order in group member search

23 January 2014, 11:35

Hi Tobias,

I haven't seen this as a bug report so feel free to report it.

I would say the best way to fix this is to add an extra parameter to group_get_membersearch_data() (I suspect that if you added "&sort=..." to \$query then http_build_query would just escape it again). With any luck, that's all you'll need to do.

~ Jono

Posts: 101
Re: Sorting order in group member search

24 January 2014, 2:52

Hi Jono,

thanks for the confirmation. I filed a bug report under https://bugs.launchpad.net/mahara/+bug/1271935

I was able to pass the sorting order via the query-parameter but the additional parameter is the better option. I initially thought, that group_get_membersearch_data was a more general function but it's only called twice, each time from the same view (membes.php and membersearchresults.json.php), so it won't affect other pages.

Tobias

3 results