/** * @since 3.3 */ private function count_valid_listings($conditions = array()) { $conditions = AWPCP_Ad::get_where_conditions_for_valid_ads($conditions); return AWPCP_Ad::count(implode(' AND ', $conditions)); }
/** * Finds out if the Ad identified by $id belongs to the user * whose information is stored in $user. * * @param $id int Ad id * @param $user array See get_currentuserinfo() */ static function belongs_to_user($id, $user_id) { global $wpdb; if (empty($id) && empty($user_id)) { return false; } $where = $wpdb->prepare("ad_id = %d AND user_id = %d", $id, $user_id); $ad = AWPCP_Ad::count($where); return $ad > 0; }