Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply WPML delete post actions to the Dokan dashboard. #83

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions dokan-wpml.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,9 @@ public function plugins_loaded() {
add_filter( 'wp', [ $this, 'set_translated_query_var_to_default_query_var' ], 11 );
add_filter( 'dokan_set_store_categories', [ $this, 'set_translated_category' ] );
add_filter( 'dokan_get_store_categories_in_vendor', [ $this, 'get_translated_category' ] );

add_action( 'dokan_product_delete', [ $this, 'before_product_delete' ] );
add_action( 'dokan_product_bulk_delete', [ $this, 'before_product_delete' ] );
}

/**
Expand Down Expand Up @@ -1291,6 +1294,20 @@ public function get_translated_verification_method_title( $title ) {
public function get_translated_verification_method_help_text( $help_text ) {
return $this->get_translated_single_string( $help_text, 'dokan', 'Dokan Vendor Verification Method Help Text: ' . $help_text );
}

/**
* Support WPML delete post actions on the frontend dashboard.
*
* @since 1.1.7
*
* @return void
*/
public function before_product_delete() {
if ( class_exists( 'WPML_Frontend_Post_Actions' ) ) {
global $wpml_post_translations;
add_action( 'delete_post', [ $wpml_post_translations, 'delete_post_actions' ] );
}
}
} // Dokan_WPML

function dokan_load_wpml() { // phpcs:ignore
Expand Down