canot find users in translated language

Home Forums Product Support Forums Ajax Search Pro for WordPress Support canot find users in translated language

This topic contains 21 replies, has 2 voices, and was last updated by Ernest Marcinko Ernest Marcinko 3 years ago.

Viewing 15 posts - 1 through 15 (of 22 total)
  • Author
    Posts
  • #31556
    memcan71
    memcan71
    Participant

    hello

    I use wpml for translation. I have different member types. For example I have Psychologists and when I search for it, I find the user. But when I write psychologist in Turkish “Psikolog” I cant find the user. You can check from here
    https://uzmanhekimler.com/members/dr-elif-sari/
    ı would appreciate if you could help

    #31561
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi,

    I assume the member type (like “psychologist”) is not stored as the part of the users name. I see it is printed before the user name on that page. I assume it might be a custom field – in that case it should be searchable, but that field has to be selected under the General Options -> User search panel: https://i.imgur.com/EyJfuLn.png

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #31562
    memcan71
    memcan71
    Participant

    I have added those fields but still no success for Turkish search

    Attachments:
    You must be logged in to view attached files.
    #31568
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Try searching for different fields there, those probably does not contain that information. Looking for something like “member” or “type” or anything similar.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #31577
    memcan71
    memcan71
    Participant

    I have added almost all fields but still not working. I figure out that some Turkish translations for users are not found by the plugin. For example ı have attached a ss showing that in Turkish page, english details of the users are coming. how can I fix this?

    Attachments:
    You must be logged in to view attached files.
    #31582
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    On the result page I am seeing the same text as it is on the search results: https://i.imgur.com/Rg4rS9g.png
    It is probably not translated yet? I cannot tell for sure, as all I can see is the front-end and the results.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #31584
    memcan71
    memcan71
    Participant

    You are looking to the wrong page. The info under that picture of the user is not given in search results. What appears in search results comes from the bio of the user that I have shown in the attached ss. I have already translated it as shown in the second ss but the turkish results are not shown. I hope that is clear enough

    Attachments:
    You must be logged in to view attached files.
    #31600
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Oh, I understand, so somehow the wrong translation is pulled there. Okay, I think I can suggest a custom code to maybe force the correct translation during the post process.

    Try adding this custom code to the functions.php in your theme/child theme directory. Before editing, please make sure to have a full site back-up just in case!

    add_filter( 'asp_results', 'asp_get_author_data', 10, 1 );
    function asp_get_author_data( $results ) {
    	
    	// Parse through each result item
    	foreach ($results as $k=>&$r) {
    		if ( $r->content_type == 'user' ) {
    			$r->title = apply_filters( "the_author_display_name", get_the_author_meta('display_name', $r->id), $r->id );
    			$r->content = apply_filters( "the_author_description", get_the_author_meta('description', $r->id), $r->id );
    		}
    	}
    
    	return $results;
    }

    Please be careful, I could not test this.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #31603
    memcan71
    memcan71
    Participant

    I tested it but it is not working. Still when I type Turkish word “Psikolog” no results appear.

    #31623
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    I really don’t know why it does not translate, WPML should do it automatically, this is how it should actually work by their documentation. Maybe try this last version:

    add_filter( 'asp_results', 'asp_get_author_data', 10, 1 );
    function asp_get_author_data( $results ) {
    	
    	// Parse through each result item
    	foreach ($results as $k=>&$r) {
    		if ( $r->content_type == 'user' ) {
    			$r->title = icl_t('Authors', 'display_name_'.$r->id, get_the_author_meta('display_name', $r->id)); 
    			$r->content = icl_t('Authors', 'description_'.$r->id, get_the_author_meta('description', $r->id));
    		}
    	}
    
    	return $results;
    }
    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #31629
    memcan71
    memcan71
    Participant

    Thaks for your help. Now search brings the Turkish results but still not as expected.

    is SS11 I attached, when I write only “ps” it finds but when I add “i” it says no results as shown in ss22.

    In ss33 I have added keywords into the bio of the doctor as you see “kadın” but when I search it, it says no result as in ss44

    I appreciate your help.

    Attachments:
    You must be logged in to view attached files.
    #31646
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Okay, so it at least translates now. That explains a lot. I understand this better now. So the user profile translations are not stored as metadata, but as string translations. Those are not possible to access for searching ufnortunately. WPML stores the string translations within a separate database, which is not searchable by the plugin. I’m afraid I can’t suggest a custom code for that either, it would have to be implemented completely from top-down.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #31651
    memcan71
    memcan71
    Participant

    Ok I understand that this does not find the strings below the name. what about the word in the user’s name? The user name is Psikolog Elif Sarı. It finds when I type only ps but when I add the letter i it says no results.

    #31652
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    I’m afraid her name is stored as “Elif SARI” in the database (in the original language): https://i.imgur.com/nCgF0hT.png
    The other one with the “psikolog” is only added via the string translation.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #31655
    memcan71
    memcan71
    Participant

    Ok I have change her name but still the same. If we cannot find a solution for this, can we do this?

    I have attached each member to a membet type. For example two doctors to the gynecologs and so on. I have assigned Elif sari tp the member type Psychologists. In the english site, when I enter these terms, I mean the member types, the doctors associated to the category appear. But I dont have it in Turkish. How can I make sure that when a visitor types the category name, doctors in that category should appear in Turkish?

Viewing 15 posts - 1 through 15 (of 22 total)

You must be logged in to reply to this topic.