-
Author
-
February 28, 2014 at 11:30 #11613Snake24Participant
Hi,
My friend write for me custom function for this theme. I need to not calculate the affinity between user but only the multiple field in commons.
Before update the theme the function write is:
if ( ! function_exists(‘compatibility_score’) ) :
/**
* Calculate compatibility between members based on their profiles
* @param int $userid1
* @param int $userid2
* @return int
*/
function compatibility_score($userid1=false, $userid2=false)
{ error_reporting(E_ERROR | E_PARSE);
if($userid1 != $userid2){
$out=array();
$temp=array();
global $kleo_config;
if ($userid1 && $userid2)
{
$score = $kleo_config[‘matching_fields’][‘starting_score’];//Sex match
if ((isset($kleo_config[‘matching_fields’][‘sex_match’]) && $kleo_config[‘matching_fields’][‘sex_match’] == ‘1’)
|| !isset($kleo_config[‘matching_fields’][‘sex_match’]) )
{
$field1_u1 = xprofile_get_field_data($kleo_config[‘matching_fields’][‘sex’], $userid1);
$field1_u2 = xprofile_get_field_data($kleo_config[‘matching_fields’][‘looking_for’], $userid2);
if ( $field1_u1 == $field1_u2 )
$score += $kleo_config[‘matching_fields’][‘sex_percentage’];
else
return $score;
}
//single fields match
if (is_array($kleo_config[‘matching_fields’][‘single_value’]))
{
foreach ($kleo_config[‘matching_fields’][‘single_value’] as $key => $value)
{if ( xprofile_get_field_data($key, $userid1)
&& xprofile_get_field_data($key, $userid2)
&& xprofile_get_field_data($key, $userid1) == xprofile_get_field_data($key, $userid2)
)
$score += $value;}
}//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);foreach($field1 as $key1 => $value1){
foreach($field2 as $key2 => $value2){
if ( $value1 == $value2 )
{
$score +=1;
array_push($temp, $value1);
}}
}
}
}
$out[punteggio]=$score;
$out[esami]=$temp;
return $out;
}
} else return 0;
}
endif;But now with new version not works. Please can we help me to edit this function to work or write another one?
March 4, 2014 at 14:50 #11847AbeKeymasterHi, It should work as in the previous version. Make sure the code exists and it hadn’t been replaced by the new theme files
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution---
@ SeventhQueen we do our best to have super happy customers. Thanks for being our customer. -
AuthorPosts
The forum ‘Sweetdate – WordPress’ is closed to new topics and replies.