Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_filter( 'woocommerce_account_menu_items', function( $items ) {
- global $WCFMmp, $WCFM, $WCFMu;
- $items_to_add = [];
- if( has_filter( 'woocommerce_account_menu_items', [ $WCFMmp->frontend, 'wcfm_dashboard_my_account_menu_items' ] ) ) {
- remove_filter('woocommerce_account_menu_items', [ $WCFMmp->frontend, 'wcfm_dashboard_my_account_menu_items' ], 999);
- if( wcfm_is_vendor() ) {
- $dashboard_page_title = __( 'Store Manager', 'wc-multivendor-marketplace' );
- $pages = get_option("wcfm_page_options");
- if( isset($pages['wc_frontend_manager_page_id']) && $pages['wc_frontend_manager_page_id'] ) {
- $dashboard_page_title = get_the_title( $pages['wc_frontend_manager_page_id'] );
- }
- $dashboard_page_title = apply_filters( 'wcfmmp_wcmy_dashboard_page_title', $dashboard_page_title );
- if( isset( $items['wcfm-store-manager'] ) ) unset( $items['wcfm-store-manager'] );
- $items_to_add['wcfm-store-manager'] = __( $dashboard_page_title, 'wc-multivendor-marketplace' );
- }
- }
- if( has_filter( 'woocommerce_account_menu_items', [ $WCFMu->wcfmu_vendor_followers, 'wcfm_followers_my_account_menu_items' ] ) ) {
- remove_filter('woocommerce_account_menu_items', [ $WCFMu->wcfmu_vendor_followers, 'wcfm_followers_my_account_menu_items' ], 190);
- $items_to_add[ $WCFMu->wcfmu_vendor_followers->wcfm_myaccount_followings_endpoint ] = __('Followings', 'wc-frontend-manager-ultimate');
- }
- if( has_filter( 'woocommerce_account_menu_items', [ $WCFMu->wcfmu_support, 'wcfm_support_my_account_menu_items' ] ) ) {
- remove_filter('woocommerce_account_menu_items', [ $WCFMu->wcfmu_support, 'wcfm_support_my_account_menu_items' ], 201);
- $items_to_add[ $WCFMu->wcfmu_support->wcfm_myaccount_support_ticket_endpoint ] = __('Support Tickets', 'wc-frontend-manager-ultimate');
- }
- if( has_filter( 'woocommerce_account_menu_items', [ $WCFM->wcfm_enquiry, 'wcfm_enquiry_my_account_menu_items' ] ) ) {
- remove_filter('woocommerce_account_menu_items', [ $WCFM->wcfm_enquiry, 'wcfm_enquiry_my_account_menu_items' ], 200);
- $items_to_add[ $WCFM->wcfm_enquiry->wcfm_myaccount_inquiry_endpoint ] = __( 'Inquiries', 'wc-frontend-manager' );
- }
- if( $items_to_add ) {
- $items = array_slice($items, 0, 1, true) + $items_to_add + array_slice($items, 1, count($items) - 1, true) ;
- }
- return $items;
- }, 1 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement