This is a public Forum  publicRSS

Topic

    Ali Raza Jahangir
    Grid Filtering for Logged In User
    Topic posted April 20, 2017 by Ali Raza JahangirJourneyer 
    59 Views, 9 Comments
    Title:
    Grid Filtering for Logged In User
    Content:

    Hi all,

    i have a scenerio where i want to show the orders of logined user on customer portal. i have made a custom report of orders with a filter on contact id. But when i use that report in a Grid widget, its showing all order records even if im not logined yet.

     

    Thanks 

    Image:

    Answer

     

    • Just Rhianna

      Can you export the report definition and post?

       

      A few questions come to mind:

      1. When you say it is showing even if logged in does that mean you have this on a page that does not require login?

      2. Is the filter selectable at runtime in the report definition?

      3. What does the CP code look like?

    • Barrilito

      Hi,

      Seems to make sense... not logged in means no contact means any contact... and that is what you see.

      Regards

    • Ali Raza Jahangir
      Just Rhianna said:

      Can you export the report definition and post?

       

      A few questions come to mind:

      1. When you say it is showing even if logged in does that mean you have this on a page that does not require login?

      2. Is the filter selectable at runtime in the report definition?

      3. What does the CP code look like?

      View original

      Thanks Rhianna  for Reply.

      Please find attacment, its a Report definition. Following are the answers of your questions:

      1 - I want orders only if a contact is logined. and that orders should be only associated to that logined Contact.

      2 - Filter is runtime selectable

      3 - CP is in attachment

    • Anurag Mittal

      Ali,

      When you are not logged in then you don't have any value to pass to report filter, so in that case report will show all result. If you want to restrict grid widget to logged person only then

      either you have to place your widget within <rn: condtion> 

      <rn:condition logged_in="true">

      ...... GRID Widget......

      </rn:condition>

       

      or you have to put logged-in condition to page itself using meta tag

      <rn:meta title="***" template="***.php" login_required="true"  />

      Hope this helps..

    • Barrilito

      Agree with Anurag, as I said this is the expected behaviour from what is made and done with the report.

      Anurag is giving you the solid options you can choose to work with. In general if you want to show contact related stuff you should use a login_required tag in your pages, at least that is how I would choose to do it.

      ps. I hope that Anurag has not only given you the complete answer, but perhaps triggered you to think about things. I don't always feel the need to tell all the choices you can make, I many times prefer giving a little hint or give an answer to the specific question only, hoping that it will trigger something, or give a tiny spark that makes you think a step further then where you are now. To be specific, when you say "it shows everything even when I am not logged in", then instead of telling you what to do, I hope that by saying only that this is normal because there is no contact being logged in and it is not filter, I hope you start thinking about making sure first that only contacts can log in.

      Anyway, Anurag is spot on, work with that and your issue is resolved! Good luck!

      Regards

    • Pramod V

      Anurag has hit the bull's eye, another option is make the filter "required" if no values passed it wont display anything.

      - VIP

    • Ali Raza Jahangir
      Anurag Mittal said:

      Ali,

      When you are not logged in then you don't have any value to pass to report filter, so in that case report will show all result. If you want to restrict grid widget to logged person only then

      either you have to place your widget within <rn: condtion> 

      <rn:condition logged_in="true">

      ...... GRID Widget......

      </rn:condition>

       

      or you have to put logged-in condition to page itself using meta tag

      <rn:meta title="***" template="***.php" login_required="true"  />

      Hope this helps..

      View original

      Thanks Anura for your Comment.

      Actually i have some order records against a specific contact and i want if that contact get logined on portal, he can see his records associated to him only.

    • Muhammad Awais Fayyaz

      Hi Ali,

      Got your point and same question from my side to Anurang Mittal

      When specific user gets logged in he can only see his orders..

       

      Thanks

    • Bastiaan van der Kooij

      hey Ali,

      if your filter on the contactID is called ID, you can set this up like;

      <rn:condition logged_in="true">
          <rn:widget path="reports/Grid" report_id="123456" static_filter="ID=#rn:profile:contactID# "/>
      </rn:condition>
      

      Bastiaan