Last active
August 29, 2015 14:20
-
-
Save gwin/18ac44f031c8f23cf090 to your computer and use it in GitHub Desktop.
Checks if current job is already bookmarked
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 current user already bookmarked $job | |
* | |
* @var $job Wpjb_Model_Job | |
* @return boolean True if current user already bookmarked $job | |
**/ | |
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