Sort by members compatibility score
-
Hello,
I am using Sweetdate theme 3.0 with Buddypress 2.9.1 to create a matchmaking site. This theme has an option to count compatibility score, which counts a percentage match between two profiles. I would like to sort members by this score, but I have no idea how to do that (this is the members site members). I found the code regarding compatibility score, but I am having trouble pasting it, so this is only a fragment to get you an idea how it works.
//multiple fields match
if ( is_array( $kleo_config[‘matching_fields’][‘multiple_values’] ) ) {
foreach ( $kleo_config[‘matching_fields’][‘multiple_values’] as $key => $value ) {
$field1 = xprofile_get_field_data( $key, $userid1 );
$field2 = xprofile_get_field_data( $key, $userid2 );
if ( $field1 && $field2 ) {
$intersect = array_intersect( (array) $field1, (array) $field2 );
if ( count( $intersect ) >= 1 ) {
$score += $value * count( $intersect );
}
}
}
}
if ( $score > 100 ) {
$score = 100;
}return $score;
}
}
endif;`Do you have any idea how this sort by option could be created? Thank you very much for your answers in advance!
Frantisek Voldrich
- You must be logged in to reply to this topic.