Last active
August 29, 2015 14:17
-
-
Save gwin/e2288b6c9c69a9169104 to your computer and use it in GitHub Desktop.
Check if job is bookmarked by current user.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Check if $job is bookmarked by currently logged in user | |
* | |
* @var $job Wpjb_Model_Job | |
* @return boolean True if job is bookmarked, false otherwise | |
**/ | |
function my_wpjb_job_is_bookmarked(Wpjb_Model_Job $job) { | |
$id = get_current_user_id(); | |
$query = new Daq_Db_Query(); | |
$query->from("Wpjb_Model_Shortlist t"); | |
$query->where("user_id = ?", $id); | |
$query->where("object = 'job'"); | |
$query->where("object_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