Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // My Store link to WCVendors Pro dashboard
- if ( class_exists('WCV_Vendors') && class_exists('WCVendors_Pro') && WCV_Vendors::is_vendor( get_current_user_id() ) ) {
- add_action( 'wp_enqueue_scripts', function() {
- wp_add_inline_script( 'c27-main', sprintf(
- "jQuery('.user-menu-my-store a, .woocommerce-MyAccount-navigation-link--my-store a').attr('href', %s);",
- json_encode( get_permalink( WCVendors_Pro::get_option( 'dashboard_page_id' ) ) )
- ) );
- }, 100 );
- }
- add_action( 'init', function() {
- if ( class_exists( 'WCV_Admin_Users' ) ) {
- // @link https://gist.github.com/tripflex/c6518efc1753cf2392559866b4bd1a53
- function remove_class_filter( $tag, $class_name = '', $method_name = '', $priority = 10 ) {
- global $wp_filter;
- if ( ! isset( $wp_filter[ $tag ] ) ) return FALSE;
- if ( is_object( $wp_filter[ $tag ] ) && isset( $wp_filter[ $tag ]->callbacks ) ) {
- $fob = $wp_filter[ $tag ];
- $callbacks = &$wp_filter[ $tag ]->callbacks;
- } else { $callbacks = &$wp_filter[ $tag ]; }
- if ( ! isset( $callbacks[ $priority ] ) || empty( $callbacks[ $priority ] ) ) return FALSE;
- foreach( (array) $callbacks[ $priority ] as $filter_id => $filter ) {
- if ( ! isset( $filter[ 'function' ] ) || ! is_array( $filter[ 'function' ] ) ) continue;
- if ( ! is_object( $filter[ 'function' ][ 0 ] ) ) continue;
- if ( $filter[ 'function' ][ 1 ] !== $method_name ) continue;
- if ( get_class( $filter[ 'function' ][ 0 ] ) === $class_name ) {
- if( isset( $fob ) ){
- $fob->remove_filter( $tag, $filter['function'], $priority );
- } else {
- unset( $callbacks[ $priority ][ $filter_id ] );
- if ( empty( $callbacks[ $priority ] ) ) {
- unset( $callbacks[ $priority ] );
- }
- if ( empty( $callbacks ) ) {
- $callbacks = array();
- }
- unset( $GLOBALS['merged_filters'][ $tag ] );
- }
- return TRUE;
- }
- }
- return FALSE;
- }
- remove_class_filter( 'product_type_selector', 'WCV_Admin_Users', 'filter_product_types', 99 );
- }
- } );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement