This topic has 91 replies, 17 voices, and was last updated 10 years by ofcentral.

  • Author
  • #8757
     jaybini
    Participant

    I want to fix the matching system since i changed the sex fields to “gender” instead of “I am a” and “looking for” so that if gender is man when search for a woman it gets him 49% matching for example, now it gives the same match whether its a man or woman, i dont want a man searching for a man and woman for a woman

    #8792
     Abe
    Keymaster

    Hi, if you no longer have the I am a, Looking for and you have just one Gender field, disable sex matching with:
    $kleo_config[‘matching_fields’][‘sex_match’] = 0;
    and add the Gender as a single value field, like:
    $kleo_config[‘matching_fields’][‘single_value’] = array (
    ‘Gender’ => 50,
    ‘Country’ => 5,
    ‘City’ => 5
    );

    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.

    #8885
     daniellemarie
    Participant

    Hi,

    I’ve read all of the above comments but can’t quite get the matching system working correctly on my site.

    My site is for people looking to meet others of the same sex. I have the following fields:

    “I am/We are” (Gay Man, Bisexual Man, Lesbian Woman, Bisexual Woman, etc)
    “Interested in Meeting” (Gay Men, Bisexual Men, Lesbian Women, Bisexual Women, etc)

    I also want to match the following Single Value fields:

    “Status”
    “Country”
    “City”
    “Drinking Habits”
    “Dietary Preferences”
    “Smoking Habits”

    As well as the following Multiple Value fields:

    “For”
    “Interests”

    Can you provide me with the code to add to my child theme’s functions.php file?

    Thank you!

    #8888
     jaybini
    Participant
    This reply has been set as private.
    #8945
     Abe
    Keymaster

    Hi, this should be the full code:

    COPY CODE
    
    //change matching system
    add_action('after_setup_theme','kleo_my_match');
    
    function kleo_my_match() {
    	global $kleo_config;
    	
    	$kleo_config['matching_fields']['starting_score'] = 1;
    	
    	//If we want to match by members sex. values: 0|1
    	$kleo_config['matching_fields']['sex_match'] = 1;
    	
    	//required for initial match. If the sex preference matches it will continue to the specified fields below
    	$kleo_config['matching_fields']['sex'] = 'I am/We are';
    	$kleo_config['matching_fields']['looking_for'] = 'Interested in Meeting';
    	
    	//sex percentage
    	$kleo_config['matching_fields']['sex_percentage'] = 49;
    	
    	//single value fields like select, textbox,radio
    	$kleo_config['matching_fields']['single_value'] = array (
    		'Status' => 10,
    		'Country' => 5,
    		'City' => 5,
    		'Drinking Habits' => 5,
    		'Dietary Preferences' => 5,
    		'Smoking Habits' => 5
    	);
    	
    	//multiple values fields like multiple select or checkbox
    	$kleo_config['matching_fields']['multiple_values'] = array (
    		'For' => 5,
    		'Interests' => 5,
    	);
    }
    
    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.

    #8946
     Abe
    Keymaster

    Hi, You are missing first line from the code:
    add_action(‘after_setup_theme’,’kleo_my_match’);

    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.

    #8973
     daniellemarie
    Participant

    Hi Abe,

    I’ve tried this code however the matches appear at 1% on all profiles. How can I fix this?

    Thanks

    #8981
     jaybini
    Participant

    I did it and still not working
    This is my code now i made small numbers to c if its working its still gives me 80 match and so whatever

    add_action('after_setup_theme','kleo_my_match');
    function kleo_my_match() {
    global $kleo_config;
    $kleo_config['matching_fields']['starting_score'] = 1;
    /*required for initial match. If the sex preference matches it will continue to the specified fields below
    $kleo_config['matching_fields']['sex'] = 'I am a';
    $kleo_config['matching_fields']['looking_for'] = 'Looking for a'; */
    //sex percentage
    $kleo_config['matching_fields']['sex_percentage'] = 0;
    //single value fields like select, textbox,radio
    $kleo_config['matching_fields']['single_value'] = array (
    'Gender' => 2,
    'Marital status' => 3,
    'Country' => 5,
    'City' => 5,
    'Occupation' => 8,
    'Annual Income' => 9,
    'Education' => 8,
    'Political Views' =>2,
    'Religion' => 1,
    'Body Type' => 2,
    'Ethnicity' => 6
    );
    //multiple values fields like multiple select or checkbox
    $kleo_config['matching_fields']['multiple_values'] = array (
    'Interests' => 2,
    'Languages Spoken' => 3
    );
    }

    #9022
     Abe
    Keymaster

    Hi, If the field names are correct in the code and users have added them to the profile the code should work.

    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.

    #9025
     Abe
    Keymaster

    Hi, Sorry, the gender won’t match since it should be different option and not the same value as other fields so you should exclude it and change $kleo_config[‘matching_fields’][‘sex_match’] = 1;

    COPY CODE
    
    add_action('after_setup_theme','kleo_my_match');
    function kleo_my_match() {
      global $kleo_config;
      $kleo_config['matching_fields']['starting_score'] = 1;
      /*required for initial match. If the sex preference matches it will continue to the specified fields below*/
      $kleo_config['matching_fields']['sex'] = 'I am a';
      $kleo_config['matching_fields']['looking_for'] = 'Looking for a'; 
      //sex percentage
      $kleo_config['matching_fields']['sex_match'] = 1;
      //single value fields like select, textbox,radio
      $kleo_config['matching_fields']['single_value'] = array ( 
        'Marital status' => 3, 
        'Country' => 5, 
        'City' => 5,
        'Occupation' => 8,
        'Annual Income' => 9,
        'Education' => 8,
        'Political Views' =>2,
        'Religion' => 1,
        'Body Type' => 2,
        'Ethnicity' => 6
      ); 
      //multiple values fields like multiple select or checkbox 
      $kleo_config['matching_fields']['multiple_values'] = array ( 
        'Interests' => 2, 
        'Languages Spoken' => 3
      );
    }
    

    Also redefine the function for the matching calculation

    COPY CODE
    
    function compatibility_score($userid1=false, $userid2=false)
        {
            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']['sex'], $userid2);
    
     
                    if ( $field1_u1 != $field1_u2 ) {
                        $score += $kleo_config['matching_fields']['sex_percentage'];
                    }
                    //if no sex match, return the score
                    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);
                        if ( $field1 && $field2 && $field1 == $field2 )
                        {
                            $intersect = array_intersect((array)$field1,(array)$field2);
                            if ( count($intersect) >= 1 ) {
                                $score += $value;
                            }
                        }
                    }
                }
     
                return $score;
            }
        }
    
    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.

    #9028
     daniellemarie
    Participant

    Hi Abe,

    Was that last comment of yours for me or jaybini?

    Thanks

    #9120
     Abe
    Keymaster

    Hi, This was the reply for you: https://archived.seventhqueen.com/forums/topic/match-numbers#reply-9022

    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.

    #9142
     jaybini
    Participant

    the function compatibility_score is giving me score of 1 for all members even if they are have different gender

    #9143
     daniellemarie
    Participant

    Same here, still not working for me. I am using this code you gave me and still getting 1% match.

    Is this the correct code for matching same sex?

    #9144
     daniellemarie
    Participant

    Actually, it’s really about matching same sex for me. It’s just about getting the “sex” and “looking for” fields to match. So that if a female is looking for a female, the match is a success if they are viewing a profile of a female also looking for a female.

    Hope this makes sense. Any more help you could give me would be appreciated. Thanks!

    #9145
     daniellemarie
    Participant

    Actually, it’s not about matching same sex for me. It’s just about getting the “sex” and “looking for” fields to match. So that if a female is looking for a female, the match is a success if they are viewing a profile of a female also looking for a female.

    Hope this makes sense. Any more help you could give me would be appreciated. Thanks!

    #9192
     Abe
    Keymaster

    Hi @daniellemarie
    If you only want to match I am a with Looking for fields this is the code:

    COPY CODE
    
    add_action('after_setup_theme','kleo_my_match');
    function kleo_my_match() {
      global $kleo_config;
      $kleo_config['matching_fields']['starting_score'] = 1;
    $kleo_config['matching_fields']['sex_match'] = 1;
      /*required for initial match. If the sex preference matches it will continue to the specified fields below*/
      $kleo_config['matching_fields']['sex'] = 'I am a';
      $kleo_config['matching_fields']['looking_for'] = 'Looking for'; 
      //sex percentage
      $kleo_config['matching_fields']['sex_percentage'] = 99;
      //single value fields like select, textbox,radio
      $kleo_config['matching_fields']['single_value'] = array (); 
      //multiple values fields like multiple select or checkbox 
      $kleo_config['matching_fields']['multiple_values'] = array ();
    }
    
    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.

    #9194
     Abe
    Keymaster

    give me some FTP access to take a look at your code if it still not working

    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.

    #9201
     daniellemarie
    Participant
    This reply has been set as private.
    #9234
     jaybini
    Participant
    This reply has been set as private.
    #9266
     Abe
    Keymaster

    You need to follow the example and you need basic PHP knowledge

    COPY CODE
    
    add_action('after_setup_theme','kleo_my_match');
    function kleo_my_match() {
      global $kleo_config;
      $kleo_config['matching_fields']['starting_score'] = 1;
    $kleo_config['matching_fields']['sex_match'] = 1;
      /*required for initial match. If the sex preference matches it will continue to the specified fields below*/
      $kleo_config['matching_fields']['sex'] = 'I am a';
      $kleo_config['matching_fields']['looking_for'] = 'Looking for'; 
      //sex percentage
      $kleo_config['matching_fields']['sex_percentage'] = 99;
      //single value fields like select, textbox,radio
      $kleo_config['matching_fields']['single_value'] = array ("Status", "City", "Drinking Habits","Dietary Preferences","Smoking Habits","For" ); 
      //multiple values fields like multiple select or checkbox 
      $kleo_config['matching_fields']['multiple_values'] = array ("Interests");
    }
    

    FTP access isn’t correct. Please add it yourself

    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.

    #9268
     Abe
    Keymaster

    You have missed my function above: https://archived.seventhqueen.com/forums/topic/match-numbers#reply-9025
    I added it and all works 😉

    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.

    #9271
     daniellemarie
    Participant

    Working now, thanks so much for your help!

    #9732
     jaybini
    Participant

    Thank u so much abe for ur help =D

    #11724
     Boblebad
    Participant

    Hi

    I’m new to this and have read through the whole thread, but can’t figure out how this is working in detail.

    How is age matched, can i have a range like 35-45 ?
    How is text boxes matched, is the system matching the written text or ?
    And what about the sexual preferences (straight, gay, bisexual) ?

    I also need to have match sections like this for more detailed match.

    One for the physical (height, weight a.s.o.)
    One for eating preferences (vegetarian, vegan, organic a.s.o.)
    One for spiritual practice (meditation, working with energy a.s.o.)

    And maybe some more sections.

    The main profile matc meter could be an overall meter calculated upon the sections totals, but i would like a more detailed match page where the sections are shown.

    How is that possible ?

    EDIT: Is it possible to have some kind of match/progress meter of some kind for how much the members have written about them selves, e.g. 200, 400, 600 charcters ?

    All the best
    Carsten

    #11977
     Abe
    Keymaster

    Hi,
    Age range can’t be matched, only field values can be matched so you can match the exact same age if you like
    Text boxes are matched by the whole value as well as other single value fields.
    Add your fields from Users – Profile fields and then include them in the code above
    Right now the matching calculates the sum based on your fields. You will have to hire a developer to extend the functionality.

    See this http://wordpress.org/plugins/buddypress-profile-progression/

    Cheers
    Abe

    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.

    #12000
     Boblebad
    Participant

    Hi Abe

    Thanks for your reply 🙂

    Just to understand this right, so the matching of a text box, is matching each word in it against the other members, so that each word that is not the same in them, will result in a lower match, and the ones that are the same will result in a higher match ?

    And are you saying, if i make some check boxes, they will automatically be matched as well ?

    Is there in the match some kind of graduation involved, like Very important, Important, Little important and Not important, has someone done that ?

    And last, so i have to fit the code to match on the separate sections ?

    And also the character count in progression, as to how much a member has written about him-/herself, cause the plugin you linked to, is just an overall progressen of the profile ?

    Btw, has anyone tried to set a min input on the text boxes e.g. 200 characters ?

    All the best
    Carsten

    #12135
     Boblebad
    Participant

    Just an addition.

    Is the fields on the profile treated as posts ?

    If so, then i might have a solution for the progression of each field 🙂

    All the best
    Carsten

    #12284
     Abe
    Keymaster

    In the textbox the content has to be exactly to increase the matching otherwise it won’t
    Checboxes will be matched if you add them in that code, yes
    You add the fields you want to the example code

    Try a plugin to set limitations for the profile fields or character count

    Fields are fields,, they are not related to posts

    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.

    #12559
     JohnDoe
    Participant

    Just wondering, but how would I add a third gender ( transgender ) in there?

    Ps; Decided to re-launch my site 🙂 been gone for a while, hopefully ill have a nice stay again 😉

    O and , are there any major changes since 2.2?

    #12741
     Abe
    Keymaster

    Hi, You should update. See the changelog: https://archived.seventhqueen.com/forums/topic/sweetdate-updates-change-log

    Edit profile fields from Users – Profile fields

    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.

    #12743
     Abe
    Keymaster

    Ps: glad you are back. Good luck with your site 😉

    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.

    #32008
     Andrey
    Participant
    This reply has been set as private.
    #32174
     Abe
    Keymaster

    Hi, you should take a look at my reply here that shows you how to change the fields that impact the matching: https://archived.seventhqueen.com/forums/topic/match-numbers/#post-2254

    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.

    #32185
     Andrey
    Participant
    This reply has been set as private.
    #32410
     Abe
    Keymaster

    @Andrey48rus it only matches what they have chosen in their profile in “I am a” and “Looking for” fields.
    If you want to change the functionality you can modify the function named compatibility_score in wp-content/themes/sweetdate/custom_buddypress/bp-functions.php

    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.

    #32414
     Andrey
    Participant

    Yes I understand, help me with this theme, it is more urgent for me!

    #32415
     Abe
    Keymaster

    Will look sure

    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.

    #32505
     logo1969
    Participant

    My sweetdate-child/functions.php does not work can someone help me!

    #32511
     kasselnightt
    Participant
    This reply has been set as private.
Viewing 40 posts - 41 through 80 (of 92 total)

The forum ‘Sweetdate – WordPress’ is closed to new topics and replies.

Log in with your credentials

Forgot your details?