Created
February 20, 2023 20:28
-
-
Save hivepress/7fe7d92419dd4f05e99165385cfb660d to your computer and use it in GitHub Desktop.
Restrict making offers to vendors with at least 1 listing #hivepress #requests
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 | |
add_filter( | |
'hivepress/v1/forms/offer_make/errors', | |
function( $errors ) { | |
$listing_id = \HivePress\Models\Listing::query()->filter( | |
[ | |
'status' => 'publish', | |
'user' => get_current_user_id(), | |
] | |
)->get_first_id(); | |
if ( ! $listing_id ) { | |
$errors[] = 'error text here'; | |
} | |
return $errors; | |
}, | |
1000 | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment