We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 25551 ☆ A M B ☆
    • 1,231 Posts
    I need some help with reading a tv value from a parent document and have phx say if value="PRIVATE" to redirect the page.

    What I have in mind is this

    [+phx:if=`[*parent*]`:is=`[[AuthorID]]`:if=`[*tvPRIVATE*]`:is=`PRIVATE`:then=`[[redirect]]`:else=``+]

    if [*parent*] is 10 and the [*tvPRIVATE*] value is equal to PRIVATE then use the [[redirect]] snippet, else allow to continue.

    I want to allow a user to control access to a page that they created and all child pages. I have the snippet working in the parent document with [*tvPRIVATE:is=`PRIVATE`:then=`[!redirect!]`*] which works well but I want the child documents to read this value and redirect if the parent is set to redirect. I hope that makes sense!
      Ross Sivills - MD AugmentBLU Edinburgh, Scotland UK
      AugmentBLU - MODX Partner

      BLUcart - MODX Revolution E-Commerce & Shopping Cart
      • 33992 ☆ A M B ☆
      • 455 Posts
      If you add an "AND" to your PHx, it should work,
      [+phx:if=`[*parent*]`:is=`[*createdby*]`:and:if=`[*tvPRIVATE*]`:is=`PRIVATE`:then=`[[redirect]]`:else=``+] 
        God loves me. 【ツ】


        MODX.ir (Persian Support)

        Boplo.ir/modx/ (Persian)
        • 25551 ☆ A M B ☆
        • 1,231 Posts
        Thanks alot! That worked exactly as I needed. grin
          Ross Sivills - MD AugmentBLU Edinburgh, Scotland UK
          AugmentBLU - MODX Partner

          BLUcart - MODX Revolution E-Commerce & Shopping Cart
          • 25551 ☆ A M B ☆
          • 1,231 Posts
          For some reason this isn’t working on further tests lol.

          For some reason that no matter what the tvPRIVATE value is, it’s using the redirect snippet.

          [+phx:if=`[*parent*]`:is=`[*createdby*]`:and:if=`[*tvPRIVATE*]`:is=`PRIVATE`:then=`[[redirect]]`:else=``+]

          I have tried

          [+phx:if=`[*parent*]`:is=`434`:and:if=`[*tvPRIVATE*]`:is=`PRIVATE`:then=`2`:else=`1`+]

          The parent of the document is 434 as shown and the output on the page is 1 when it should be 2.

          This works on the parent page [*tvPRIVATE:is=`PRIVATE`:then=`[!redirect!]`*] and if the tv is checked the redirect snippet works... how do I get that to work in the child document but take the tvPRIVATE value from the parent. I have tried using text and checkbox for the tvPRIVATE option type but this made no difference.
            Ross Sivills - MD AugmentBLU Edinburgh, Scotland UK
            AugmentBLU - MODX Partner

            BLUcart - MODX Revolution E-Commerce & Shopping Cart
            • 33992 ☆ A M B ☆
            • 455 Posts
            See http://wiki.modxcms.com/index.php/PHx/CustomModifiers
            I think parent modifier can get [*tvPRIVATE*] from parent doc .... see others too.
              God loves me. 【ツ】


              MODX.ir (Persian Support)

              Boplo.ir/modx/ (Persian)
              • 25551 ☆ A M B ☆
              • 1,231 Posts
              I have this placeholder [*phx:input=`[+myplaceholder+]`:AuthorPrivateProfile*] showing a custom field in my database and on a users page it shows up with the correct value. How can I use this placeholder but in Ditto to list all profiles and for each listed page it will show the [*phx:input=`[+myplaceholder+]`:AuthorPrivateProfile*] value. It works on the users page as I said but I can’t seem to get it working in Ditto. I made a simple Ditto Tpl and put [*phx:input=`[+myplaceholder+]`:AuthorPrivateProfile*] in there to repeat for each listed page but it’s not getting the value from the pages.

              Thanks
                Ross Sivills - MD AugmentBLU Edinburgh, Scotland UK
                AugmentBLU - MODX Partner

                BLUcart - MODX Revolution E-Commerce & Shopping Cart
                • 25551 ☆ A M B ☆
                • 1,231 Posts
                OK I’m getting everything working how I should now!  I need some help with this Phx call though.  I want to get this working but with member groups as well. 

                This works but I want to add and is not a member of `members`
                [+phx:if=`[+view.privateprofile+]`:is=`PRIVATE`:and:isnot:``:then=``:else=`my code`+]

                This doesn’t
                [+phx:if=`[+view.privateprofile+]`:is=`PRIVATE`:and:isnot:mo=`members`:then=``:else=`my code`+]

                huh
                  Ross Sivills - MD AugmentBLU Edinburgh, Scotland UK
                  AugmentBLU - MODX Partner

                  BLUcart - MODX Revolution E-Commerce & Shopping Cart
                  • 33992 ☆ A M B ☆
                  • 455 Posts
                  I think you should use a modifier in a individual placeholder:
                  [+phx:if=`[+view.privateprofile+]`:is=`PRIVATE`:and:isnot=[+phx:mo=`members`+]:then=``:else=`my code`+]
                    God loves me. 【ツ】


                    MODX.ir (Persian Support)

                    Boplo.ir/modx/ (Persian)
                    • 25551 ☆ A M B ☆
                    • 1,231 Posts
                    I didn’t realize you could nest phx holders, this has opened up all new ideas for me now... I have phx and webloginPE working together to create expensive profiles with public or private permissions. smiley Thanks AHHP!
                      Ross Sivills - MD AugmentBLU Edinburgh, Scotland UK
                      AugmentBLU - MODX Partner

                      BLUcart - MODX Revolution E-Commerce & Shopping Cart