Banner Logo

Be a part of the family: Connect, Receive Support,
Contribute, and Reap Abundant Rewards!

Validate if dashboard link exists to check if it’s vendor dash page

MultivendorX Pro

Resolved
Viewing 9 reply threads
  • Author
    Posts
    • #215042
      webmaster.mid
      Participant

      Hello,

      Please, add this condition “$dashboard_link &&” to this function as shown in the image below:
      https://imgur.com/HimjRfe.png

      If the link is empty (I’m not using AFM), it is returning as if it were the vendor dashboard page.

    • #215054

      @webmaster.mid Can you please let us know about the flow that you are looking for on your end so that we can assist you accordingly with the code.

    • #215055
      This reply has been marked as private.
    • #215088
      webmaster.mid
      Participant

      Hello Sangita. Our license has not expired. We placed the order on September 30, 2023.

      About our flow: We have a custom dashboard for vendors, so we don’t use yours. Thus, when checking if the user is on the vendor’s dashboard page and this page does not exist (or is not defined in the MVX settings), the function incorrectly returns true, as if it were the vendor’s dashboard page. I added a condition to check if it isn’t empty (see image).

      In my case, as this function returned true, MVX removed all scripts inserted by theme from the queue and should not behave this way.

    • #215128

      Hello @webmaster.mid, As you have added your own custom vendor dashboard and not using our default one, so our code shouldn’t affect your custom flow.

      However it is still unclear what flow you are exactly looking for your custom page. A detailed flow will guide us what are you expecting so we can assist you with this.

    • #215267
      webmaster.mid
      Participant

      Hello Sangita.

      Ok, a more detailed flow:
      We have our custom dashboard that replaces wp-admin for vendors and vendor staffs. However, they still have access to the front of our website when logged in. When they go to the front, all the JS files registered by our theme disappear because the MVX filter ‘mvx_frontend_enqueue_scripts’ is removing them.

      What is the function of this filter?
      It checks if the user is located in the vendor dashboard and, if yes, it removes all added scripts by theme. Ok, makes sense.

      Why does the filter remove them even when the user is not in the vendor’s dashboard?
      When MVX checks if the user is on the vendor’s dashboard, it returns true because the “Vendor Dashboard Field” in the MVX settings is empty or has been set to a page that no longer exists. It should return false.

      Solution
      When checking, the code must consider whether the page actually exists or whether the field is defined in the MVX Settings.
      That’s what I suggested in the last messages.

      Test it:
      Delete the Vendor’s Dashboard page completely and go to the front logged as a Vendor.

    • #215276

      As per our code the above mentioned hook will only work for the My account page, vendor dashboard page and for users having the ‘vendor’ role.
      Now on your custom page this should not work and remove the added scripts from your custom page if the custom code for your custom page does not match with any of the conditions mentioned.
      Also if you want you can just remove the hook by doing remove action on your end and it will no longer affect your custom flow.

    • #215469
      webmaster.mid
      Participant

      Hello Sangita.

      I’m spending a lot of time trying to help, even though I’ve already resolved it on my end. I won’t continue here after this comment…
      I’m also a developer and, regardless of the scenario and the conditions to be met, you need to check if the field is set to a value to check “is_vendor_dashboard_page”, the rest of the conditions are not important.

      It’s simple: is it the vendor’s dashboard page? If it is not defined in the MVX settings, it is not. And your code is returning as if it were.

    • #215470

      @webmaster.mid I’ll communicate this to my developers regarding this.
      However, could you please share a video demonstrating your user interface and explaining the flow? This will help us better understand it and provide the necessary assistance.

    • #217552

      It’s been long and we have not heard back from you. We are closing this thread. If you need any help or face issue in future please do create a new support topic.

Viewing 9 reply threads

The topic ‘Validate if dashboard link exists to check if it’s vendor dash page’ is closed to new replies.