Introduce `bp_sort_by_key()`.

A companion for `bp_alpha_sort_by_key()`, this function allows arrays of
objects or associative arrays to be sorted according to one of their keys/
properties - a kinda-sorta version of `wp_list_pluck()` for sorting. Supports
numeric as well as alphabetical sorts.

`bp_alpha_sort_by_key()` is converted to a wrapper of the new function.

Fixes #6047. See #5669.

git-svn-id: https://buddypress.svn.wordpress.org/trunk@9191 cdf35c40-ae34-48e0-9cc9-0c9da1808c22