Skip to content

Instantly share code, notes, and snippets.

@J-H-Mojumder
Last active September 19, 2023 07:35
Show Gist options
  • Save J-H-Mojumder/888b8e29b4041f513c4e8bebb0c1bd3a to your computer and use it in GitHub Desktop.
Save J-H-Mojumder/888b8e29b4041f513c4e8bebb0c1bd3a to your computer and use it in GitHub Desktop.
Add a custom message for the enabled sellers on the vendor dashboard in Dokan
<?php
//Add a new message for the enabled sellers on the vendor dashboard
function add_message_for_active_vendors(){
dokan_remove_hook_for_anonymous_class( 'dokan_dashboard_content_inside_before', 'WeDevs\Dokan\Dashboard\Templates\Dashboard', 'show_seller_dashboard_notice', 10 );
function show_custom_seller_dashboard_notice(){
$user_id = get_current_user_id();
if ( ! dokan_is_seller_enabled( $user_id ) ) {
dokan_get_template_part( 'global/seller-warning' );
}
else{?>
<div class="dokan-alert dokan-alert-success">
<strong><?php esc_attr_e( 'Congrats!', 'dokan-lite' ); ?></strong> <!--Your custom message--->
<?php esc_attr_e( 'Your account is enabled', 'dokan-lite' ); ?> <!--Your custom message--->
<a href="<?php echo get_site_url()."/dashboard/settings/payment/"; ?>">Add Payments</a> to get
uninterrupted payment from [<a href="<?php echo get_site_url();?>"><?php echo get_option('blogname'); ?></a>].
</div>
<?php }
}
add_action( 'dokan_dashboard_content_inside_before', 'show_custom_seller_dashboard_notice', 10 );
}
add_action( 'wp_head', 'add_message_for_active_vendors' );
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment