Tagged: BuddyPress Member Types
Hi Colin Lau,
Thank you for asking.The plugin does not provide it out of the box and the order is controlled by BuddyPress.
It i still possible to reorder the list. You can use the following functions.
/** * Comparator function. * * @param Object $mtype_1 member type 1. * @param Object $mtype_2 member type 2. * * @return int */ function buddydev_member_type_comparator( $mtype_1, $mtype_2 ) { // compare by member type unique name(key). return strcmp( $mtype_1->name, $mtype_2->name ); // compare by labels instead. to use it, comment the previous line using // and uncomment the line below. // return strcmp( $mtype_1->labels['singular_name'], $mtype_2->labels['singular_name'] ); } /** * Filter Member Types and sort. * * @param array $member_types member type names or objects array. * * @return mixed */ function buddydev_reorder_member_types( $member_types ) { if ( empty( $member_types ) ) { return $member_types; } // sort it. uasort( $member_types, 'buddydev_member_type_comparator' ); return $member_types; } add_filter( 'bp_get_member_types', 'buddydev_reorder_member_types' );
In the above example, I am ordering alphabetically by key.
In order to order by label, you can uncomment and comment the line as mentioned in the comparator function.
Hope this helps.
Regards
Brajesh
Viewing 4 posts - 1 through 4 (of 4 total)
The topic ‘ [Resolved] Member Types Pro Director Tab Sorting’ is closed to new replies.
This topic is: resolved