We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36415
    • 8 Posts
    I wrote a code, something type:
    [[!+modx.user.id:ismember=`Mygroup_1`:then=`1`:else=`2`]]

    and in other place:
    [[!+modx.user.id:ismember=`Mygroup_2`:then=`3`:else=`4`]]

    Earlier everything worked perfectly, then was updated to version 2.5.0, and recently to 2.5.2 I noted that if the user isn't authorized, then in option of a code No.2 it is removed 4, and in option of a code No.1 1 is brought. Though, the unauthorized user shan't belong neither to Mygroup_1, nor to Mygroup_2. How it "made the way" in group 1 and how from there to move away him?
      • 3749
      • 24,544 Posts
      Are you testing in another browser where you're not logged into the Manager? If you're testing in another browser tab while logged into the Manager, MODX can get confused about who you are.

      What does this give you?

      <p>UserId: [[!+modx.user.id]]</p>
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 36415
        • 8 Posts
        Quote from: BobRay at Dec 23, 2016, 12:27 AM
        Are you testing in another browser where you're not logged into the Manager? If you're testing in another browser tab while logged into the Manager, MODX can get confused about who you are.

        What does this give you?

        <p>UserId: [[!+modx.user.id]]</p>

        UserId: 0

        I tried in different browsers. At the same time I haven't been logged into the Manager
          • 3749
          • 24,544 Posts
          I couldn't really follow your original post. What is the output of these two lines for the (anonymous) user?

          [[!+modx.user.id:ismember=`Mygroup_1`:then=`1`:else=`2`]]
          [[!+modx.user.id:ismember=`Mygroup_2`:then=`3`:else=`4`]]
            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting
            • 3749
            • 24,544 Posts
            I should have thought of this sooner.

            The Personalize snippet (author: me wink ) with the &allowedGroups property should do exactly what you want *much* faster than an output filter.

              Did I help you? Buy me a beer
              Get my Book: MODX:The Official Guide
              MODX info for everyone: http://bobsguides.com/modx.html
              My MODX Extras
              Bob's Guides is now hosted at A2 MODX Hosting
              • 36415
              • 8 Posts
              Quote from: BobRay at Dec 23, 2016, 02:04 PM
              I couldn't really follow your original post. What is the output of these two lines for the (anonymous) user?

              [[!+modx.user.id:ismember=`Mygroup_1`:then=`1`:else=`2`]]
              [[!+modx.user.id:ismember=`Mygroup_2`:then=`3`:else=`4`]]

              for the (anonymous) user:
              1. 1
              2. 4
                • 3749
                • 24,544 Posts
                Are you sure that the (anonymous) user is not a member of Mygroup_1 and that Mygroup_1 is spelled correctly in the tag?

                Did you try the Personalize snippet?
                  Did I help you? Buy me a beer
                  Get my Book: MODX:The Official Guide
                  MODX info for everyone: http://bobsguides.com/modx.html
                  My MODX Extras
                  Bob's Guides is now hosted at A2 MODX Hosting