Bug Report & Fix (Vendor Plugin)
-
Hi Guys,
I reported this bug to you a while ago via email and it’s still not resolved.
The vendor plugin doesn’t play nicely when a user has access to wp-admin to edit a custom post type.
The bug:
– When a vendor with “limited access” edits/adds a custom post type it throws the error: “You do not have permission to edit this product.”, even though they have been granted permission to edit this custom post type.
The code causing the issue can be found below. The problem is that it’s not checking against the post type so it throws this error for all post types, even though they’re not products.
File: class.yith-vendors-admin.php
Function: disabled_manage_other_vendors_posts()
Code:if ( $vendor->has_limited_access() && false !== $product_vendor && $vendor->id != $product_vendor->id) { wp_die( sprintf( __( 'You do not have permission to edit this product. %1$sClick here to view and edit your products%2$s.', 'yith_wc_product_vendors' ), '<a href="' . esc_url( 'edit.php?post_type=product' ) . '">', '</a>' ) ); }
The fix:
Simply add && $post->post_type == “product” to the if statement, as follows so that it only fires when a user is trying to edi a product:
if ( $vendor->has_limited_access() && false !== $product_vendor && $vendor->id != $product_vendor->id && $post->post_type == "product") { wp_die( sprintf( __( 'You do not have permission to edit this product. %1$sClick here to view and edit your products%2$s.', 'yith_wc_product_vendors' ), '<a href="' . esc_url( 'edit.php?post_type=product' ) . '">', '</a>' ) ); }
If you could add this in your next release that would be brilliant as currently I’m having to edit the plugin code each time you release a new version, which isn’t a long term solution.
https://www.ads-software.com/plugins/yith-essential-kit-for-woocommerce-1/
- The topic ‘Bug Report & Fix (Vendor Plugin)’ is closed to new replies.