Function Reference: geodir_wpml_allowed_to_duplicate
Summary
Checks the user allowed to duplicate listing or not for WPML.
Parameters
- $post_id
- (int) (required) The post ID.
- Default: None
Return Values
- (bool)
- True if allowed.
Change Log
Since: 1.6.18
Filters
‘geodir_wpml_allowed_to_duplicate’ [Line: 3036]
Source File
geodir_wpml_allowed_to_duplicate() is located in geodirectory-functions/custom_functions.php [Line: 3003]
Source Code
function geodir_wpml_allowed_to_duplicate( $post_id ) { $allowed = false; if ( !geodir_is_wpml() || empty( $post_id ) ) { return $allowed; } $user_id = (int)get_current_user_id(); if ( empty( $user_id ) ) { return $allowed; } $post_type = get_post_type( $post_id ); if ( !geodir_wpml_is_post_type_translated( $post_type ) || get_post_meta( $post_id, '_icl_lang_duplicate_of', true ) ) { return $allowed; } if ( geodir_listing_belong_to_current_user( $post_id ) ) { $allowed = true; } $disable_cpts = get_option( 'geodir_wpml_disable_duplicate' ); if ( $allowed && !empty( $disable_cpts ) && in_array( $post_type, $disable_cpts ) ) { $allowed = false; } /** * Filter the user allowed to duplicate listing or not for WPML. * * @param bool $allowed True if allowed. * @param int $post_id The post ID. */ return apply_filters( 'geodir_wpml_allowed_to_duplicate', $allowed, $post_id ); }