test
Viewing 1 post (of 1 total)
  • Author
    Posts
  • brentwilliams2 Friend
    #192165

    Currently, if your job seeker adds a keyword to the job alert, it only searches the description field. I wanted it to also search a custom “City” field I had made, so that job seekers could get updates when a job was posted in their city. So to do this, I had to edit helper/jafunctions.class.php. Find the following section:

    if ($result_list[$i]->keyword) {
    switch ($result_list[$i]->keyword_option) {
    case 1 :
    $tem_keyword = explode(' ', $result_list[$i]->keyword_option);

    for ($j = 0; $j < count($tem_keyword); $j++) {
    if ($tem_keyword [$j] == '') {
    unset($tem_keyword [$j]);
    }
    }

    $result_keyword = false;

    for ($j = 0; $j < count($tem_keyword); $j++) {
    if (strpos($job->title, $result_list[$i]->keyword) !== false || strpos($job->job_detail, $result_list[$i]->keyword) !== false) {
    $result_keyword = true;
    break;
    }
    }

    if (!$result_keyword) {
    $checkKey = false;
    }

    break;

    case 2 :
    $tem_keyword = explode(' ', $result_list[$i]->keyword_option);

    for ($j = 0; $j < count($tem_keyword); $j++) {
    if ($tem_keyword [$j] == '') {
    unset($tem_keyword [$j]);
    }
    }

    $result_keyword = true;

    for ($j = 0; $j < count($tem_keyword); $j++) {
    if (!(stripos($job->title, $result_list[$i]->keyword) !== false) && !(stripos($job->job_detail, $result_list[$i]->keyword) !== false)) {
    $result_keyword = false;
    break;
    }
    }

    if (!$result_keyword) {
    $checkKey = false;
    }

    break;

    case 3 :
    if (!is_numeric((stripos($job->title, $result_list[$i]->keyword) !== false)) && ! is_numeric((stripos($job->job_detail, $result_list[$i]->keyword) !== false))) {
    $checkKey = false;
    }

    break;
    }
    }

    I modified it within each “case” to have it look in my custom field, as well. So you can use the following code, BUT you need to change $job->city to your custom field.

    if ($result_list[$i]->keyword) {
    switch ($result_list[$i]->keyword_option) {
    case 1 :
    $tem_keyword = explode(' ', $result_list[$i]->keyword_option);

    for ($j = 0; $j < count($tem_keyword); $j++) {
    if ($tem_keyword [$j] == '') {
    unset($tem_keyword [$j]);
    }
    }

    $result_keyword = false;

    for ($j = 0; $j < count($tem_keyword); $j++) {
    if (strpos($job->title, $result_list[$i]->keyword) !== false || strpos($job->job_detail, $result_list[$i]->keyword) !== false || strpos($job->city, $result_list[$i]->keyword) !== false) {
    $result_keyword = true;
    break;
    }
    }

    if (!$result_keyword) {
    $checkKey = false;
    }

    break;

    case 2 :
    $tem_keyword = explode(' ', $result_list[$i]->keyword_option);

    for ($j = 0; $j < count($tem_keyword); $j++) {
    if ($tem_keyword [$j] == '') {
    unset($tem_keyword [$j]);
    }
    }

    $result_keyword = true;

    for ($j = 0; $j < count($tem_keyword); $j++) {
    if (!(stripos($job->title, $result_list[$i]->keyword) !== false) && !(stripos($job->job_detail, $result_list[$i]->keyword) !== false) && !(stripos($job->city, $result_list[$i]->keyword) !== false)) {
    $result_keyword = false;
    break;
    }
    }

    if (!$result_keyword) {
    $checkKey = false;
    }

    break;

    case 3 :
    if (!is_numeric((stripos($job->title, $result_list[$i]->keyword) !== false)) && ! is_numeric((stripos($job->job_detail, $result_list[$i]->keyword) !== false)) && ! is_numeric((stripos($job->city, $result_list[$i]->keyword) !== false))) {
    $checkKey = false;
    }

    break;
    }
    }

    Please note that I think this may only work when all fields of the alert match all fields of the job. For example, if the job seeker does not input a location in the alert, this will not work.

    Hope that helps!

Viewing 1 post (of 1 total)

This topic contains 1 reply, has 1 voice, and was last updated by  brentwilliams2 11 years ago.

We moved to new unified forum. Please post all new support queries in our New Forum