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 2 years, 9 months ago.
- AuthorPosts
- February 15, 2021 at 3:16 am #31556
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 helpFebruary 15, 2021 at 9:35 am #31561Hi,
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 :)
February 15, 2021 at 10:02 am #31562I have added those fields but still no success for Turkish search
Attachments:
You must be logged in to view attached files.February 15, 2021 at 1:54 pm #31568Try 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 :)
February 15, 2021 at 8:34 pm #31577I 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.February 16, 2021 at 10:40 am #31582On the result page I am seeing the same text as it is on the search results: https://i.imgur.com/Rg4rS9g.png
Best,
It is probably not translated yet? I cannot tell for sure, as all I can see is the front-end and the results.
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
February 16, 2021 at 11:04 am #31584You 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.February 16, 2021 at 3:35 pm #31600Oh, 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 :)
February 16, 2021 at 4:18 pm #31603I tested it but it is not working. Still when I type Turkish word “Psikolog” no results appear.
February 17, 2021 at 2:28 pm #31623I 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:
Best,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; }
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
February 17, 2021 at 6:09 pm #31629Thaks 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.February 18, 2021 at 9:34 am #31646Okay, 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 :)
February 18, 2021 at 10:22 am #31651Ok 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.
February 18, 2021 at 10:48 am #31652I’m afraid her name is stored as “Elif SARI” in the database (in the original language): https://i.imgur.com/nCgF0hT.png
Best,
The other one with the “psikolog” is only added via the string translation.
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
February 18, 2021 at 11:19 am #31655Ok 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?
- AuthorPosts
You must be logged in to reply to this topic.