Hello @ilanb ,
You are already in the right direction.
The hook here is – do_action( 'dokan_vendor_disabled', $this->get_id() );
You will add your function to this like this –
add_action( ‘dokan_vendor_disabled’, your_function_here() )`;
If you are already trying a function but not working then you can share the code with me. I can take a further look at that.
Thank you 🙂
Thread Starter
ilanb
(@ilanb)
Thx Rashed,
I wrote this, but not sure how get the ID of vendor desactivated:
function delete_product_pharma_whendisabled( $user_id ) {
global $wpdb;
$wpdb->get_results($wpdb->prepare("DELETE FROM {$wpdb->prefix}geo_location WHERE user_id = '%d'", $user_id));
$wpdb->get_results($wpdb->prepare("DELETE FROM {$wpdb->prefix}postmeta WHERE user_id = '%d'", $user_id));
$wpdb->get_results($wpdb->prepare("DELETE FROM {$wpdb->prefix}posts_users WHERE user_id = '%d'", $user_id));
}
add_filter( 'dokan_vendor_disabled', 'delete_product_pharma_whendisabled');
Hello @ilanb
you using add_filter which is wrong. here you should use add_action
use this codes, here different only add_filter to add_action
function delete_product_pharma_whendisabled( $user_id ) {
global $wpdb;
$wpdb->get_results($wpdb->prepare("DELETE FROM {$wpdb->prefix}geo_location WHERE user_id = '%d'", $user_id));
$wpdb->get_results($wpdb->prepare("DELETE FROM {$wpdb->prefix}postmeta WHERE user_id = '%d'", $user_id));
$wpdb->get_results($wpdb->prepare("DELETE FROM {$wpdb->prefix}posts_users WHERE user_id = '%d'", $user_id));
}
add_action( 'dokan_vendor_disabled', 'delete_product_pharma_whendisabled' );