Skip to content

Instantly share code, notes, and snippets.

@gwin
Last active August 29, 2015 14:17
Show Gist options
  • Save gwin/e2288b6c9c69a9169104 to your computer and use it in GitHub Desktop.
Save gwin/e2288b6c9c69a9169104 to your computer and use it in GitHub Desktop.
Check if job is bookmarked by current user.
<?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