Function Reference: geodir_listing_belong_to_current_user
Summary
Check whether a listing belongs to current user or not.
Global Values
- $current_user
- (object) (required) Current user object.
- Default: None
Package
GeoDirectory
Parameters
- $listing_id
- (int|string) (required) The post ID.
- Default: None
- $exclude_admin
- (bool) (optional) Do you want to exclude admin from the check?.
- Default: true
Return Values
- (bool)
Change Log
Since: 1.0.0
Filters
‘geodir_listing_belong_to_current_user’ [Line: 2863]
Source File
geodir_listing_belong_to_current_user() is located in geodirectory-functions/post_functions.php [Line: 2839]
Source Code
function geodir_listing_belong_to_current_user($listing_id = '', $exclude_admin = true) { global $current_user; if ($exclude_admin) { foreach ($current_user->caps as $key => $caps) { if (geodir_strtolower($key) == 'administrator') { return true; break; } } } $result = geodir_lisiting_belong_to_user($listing_id, $current_user->ID); /** * Filter if the listing belongs to a user. * * @since 1.6.23 * @param bool $result The result, true:false * @param int $listing_id The post ID. * @param int $current_user->ID The current user ID. * @param bool $exclude_admin Do you want to exclude admin from the check?. Default true. * return bool */ return apply_filters('geodir_listing_belong_to_current_user',$result,$listing_id,$current_user->ID,$exclude_admin); }