Skip to content

Instantly share code, notes, and snippets.

@gwin
Created March 31, 2015 08:48
Show Gist options
  • Save gwin/63b8ec49a53aa664aa9e to your computer and use it in GitHub Desktop.
Save gwin/63b8ec49a53aa664aa9e to your computer and use it in GitHub Desktop.
Check if current user already applied to current job
<?php
/**
* Check if current user already applied to $job
*
* @var $job Wpjb_Model_Job
* @return boolean True if current user already applied to $job
**/
function my_wpjb_job_already_applied_to(Wpjb_Model_Job $job) {
$id = get_current_user_id();
$query = new Daq_Db_Query();
$query->from("Wpjb_Model_Application t");
$query->where("user_id = ?", $id);
$query->where("job_id = ?", $job->id);
$query->limit(1);
$result = $query->execute();
return !empty($result);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment