This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This thread is resolved. Here is a description of the problem and solution.

Problem: WP JobSearch provides a search bar that could contain jobs locations, if locations are translated the search bar dropdown shows locations in all languages Solution: WP JobSearch should be patched as explained here https://wpml.org/forums/topic/wp-jobsearch-search-bar-shows-locations-from-all-languages/#post-4581609

This topic contains 12 replies, has 2 voices.

Last updated by rohanK 4 weeks ago.

Assigned support staff: Jamal.

Author Posts
September 16, 2019 at 10:31 am #4578877

rohanK

Hello Janam,

I wanted you to made the change on internationalrecruitmentagency.com actually. It is not your code that has an effect on the job search filter, it is because it is not the same configuration on approachpeoplerecruitment.com.
Note that I cannot access hidden link

I don't see the job search plug in so I cannot add locations so I will let you do it. To add the same job location settings:
1. Go to Job Search Option in the left menu
2. Go to Location Settings
3. Enable Locations
4. Choose "Manual" locations type
Choose "On" for Location fields
5. Choose "Two field" for enable filter
6 First field labl called: Country, make this field required
7. Second field label: City, make this field required
8: Do not allow Full Adress (select "no")

To create the main locations (country):
1. go to "Jobs" on the left menu and click on "Location"
2. Add a location
3. Edit location
4. Add a translation

To add a job search bar, you can copy past the code below:
[jobsearch_advance_search result_page="jobs-international" keyword_field="show" cat_field="show" loc_field="show" loc_field1="show" loc_field2="hide" loc_locate_1="" serch_btn_txt="SEARCH JOBS" serch_txt_color="#ffffff" undefined="Clear" serch_bg_color="#dd1616" undefined="Clear" serch_hov_color="#ff0000"] [/jobsearch_advance_search]

Then you should be able to reproduce the error and see all the translation of the main locations in the job search bar.

Let me know about the two issues, and please implement the solution for the Location search filters in Sidebar on internationalrecruitment.com.

Looking forward to hearing from you,

Kind regards,

Sophie

September 16, 2019 at 11:04 am #4579631

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+01:00)

Hello Sophie,

I reproduced the issue as you can see in the attached image. You can also check it in this URL hidden link

The issue is now escalated to our compatibility team. I'll get back to you as soon as they provide a fix.

Best regards,
Jamal

September 16, 2019 at 11:32 am #4579813

rohanK

Hi Jamal,

Ok, but it is the 3rd time since 5th June that we escalate the problem, how this time going to be different. What is going on?

September 16, 2019 at 11:56 am #4579923

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+01:00)

Hi Sophie,

My bad, for the previous ticket, I was replacing Andreas, and I did not understand the issue very well so I did not communicate well with the compatibility team.
Now, we will work on the search bar issue in this ticket and hopefully, we'll get it resolved very soon.

Best regards,
Jamal

September 16, 2019 at 11:57 am #4579927

rohanK

Ok, thanks for the follow up. I will wait news from you then,

Have a very good day,

Kind regards

September 16, 2019 at 12:03 pm #4579969

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+01:00)

- Status update -

September 16, 2019 at 2:39 pm #4581609

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+01:00)

Hi Sophie,

The compatibility team has provided a fix for the search bar location dropdown. I tested it on the test server and it is working here too hidden link

the patch is similar to the other patch, it consists of replacing one function with our code in wp-content/plugins/wp-jobsearch/includes/common-functions/candidate-functions.php:

function jobsearch_custom_get_terms($taxonomy = 'job-location', $parent = 0, $orderby = 'terms.name', $order = 'ASC', $hide_empty = false) {
    global $wpdb;

    $terms = $wpdb->get_results($wpdb->prepare("SELECT * FROM $wpdb->terms AS terms"
                    . " LEFT JOIN $wpdb->term_taxonomy AS term_tax ON(terms.term_id = term_tax.term_id) "
                    . " WHERE term_tax.taxonomy = '%s' AND term_tax.parent = " . $parent
                    . " ORDER BY " . $orderby . " " . $order, $taxonomy));
    $terms_this_lang = [];
    $current_lang = apply_filters( 'wpml_current_language', NULL );
    foreach ($terms as $term) {
        $args = array('element_id' => $term->term_id, 'element_type' => $taxonomy );
        $term_lang = apply_filters( 'wpml_element_language_code', null, $args );
        if ($current_lang === $term_lang)  {
            $terms_this_lang[] = $term;
        }
    }

    return $terms_this_lang;

}

Would you please check and confirm if it is resolved.

Best regards,
Jamal

September 16, 2019 at 2:50 pm #4581641

rohanK

Hello Jamal,

thanks for your help, unfortunately the issue is still visible on approachpeoplerecruitment.com as you can see on the screenshot. Do you not see it on your side?

Thanks for your help,

Sophie

September 16, 2019 at 3:43 pm #4582181

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+01:00)

Hello Sophie,

My apologies, I concentrated on the Countries filter, because it's the only one I could get in the test server.
As you can see in the attached images, the issue was visible before(job-search-bar.png) the patch and now resolved(countries.png).

Please reproduce this field(all locations) on the test server and let me approach the compatibility team. Here the link to log in
hidden link

Best regards,
Jamal

September 16, 2019 at 3:52 pm #4582329

rohanK

Hello Jamal,

indeed, it seems solve the issue with the country filter in the job search bar! It is amazing, can you implement the solution on internationalrecruitmentagency.com ? and let me know what to tell to the developer of the job board for they implement the solution in their plug in for next update?

Thanks a lot for your help 🙂

September 17, 2019 at 9:14 am #4586937

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+01:00)

Hello Sophie,

I tried to implement the solution on hidden link
I am afraid I crashed the server again, now it is always returning error 505, and I can't recover it without FTP access. Please provide FTP access and let me resolve the issue.

My apologies for any inconvenience.

Best regards,
Jamal

September 17, 2019 at 10:17 am #4587465

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+01:00)

Hello Sophie,

Thank you, I recovered the website and implemented the fix. As you can see in the attached image, the fix is working.

You can tell the plugin authors to use our code for their function as explained in my reply (#4581609). The code they have been using searches for terms in the database without taking into consideration WPML language information. We have replaced it with a code that searches for terms translations when in another language, or only return original terms when in primary language.
Here a quick link to get to the message https://wpml.org/forums/topic/wp-jobsearch-search-bar-shows-locations-from-all-languages/#post-4581609

You may also ask them to join our Go Global Program https://wpml.org/documentation/theme-compatibility/go-global-program/ in order to make the plugin fully compatible with WPML.

Best regards,
Jamal

September 17, 2019 at 11:32 am #4588039

rohanK

My issue is resolved now. Thank you so much, yo are fantastic Jamal! Thanks for your incredible follow up and support throughout this project! I will follow up with the job developers 😉

I wish you a wonderful day,

Kind regards,

Sophie