Skip to content

Commit

Permalink
fix: vendor is able to assign his product to another vendor fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
sabbir1991 committed Sep 4, 2018
1 parent 9f5664a commit 5d97346
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions includes/wc-template.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ function dokan_manage_capability_for_woocommerce_product( $capability ) {
* @return void
*/
function dokan_author_field_quick_edit(){
if ( ! current_user_can( 'manage_woocommerce' ) ) {
return;
}
$admin_user = get_user_by( 'id', get_current_user_id() );
$user_query = new WP_User_Query( array( 'role' => 'seller' ) );
$sellers = $user_query->get_results();
Expand Down Expand Up @@ -204,6 +207,10 @@ function dokan_vendor_quick_edit_data( $column,$post_id ) {
* @return void
*/
function dokan_save_quick_edit_vendor_data ( $product ){
if ( ! current_user_can( 'manage_woocommerce' ) ) {
return;
}

if ( isset( $_REQUEST['dokan_product_author_override'] ) ) {
$vendor_id = esc_attr( $_REQUEST['dokan_product_author_override'] );
wp_update_post( array( 'ID' => $product->get_id(), 'post_author' => $vendor_id ) );
Expand Down

0 comments on commit 5d97346

Please sign in to comment.