We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3749
    • 24,544 Posts
    This is an auto-generated topic for Personalize 3.2.1-beta1 by bobray.

    Brief Description:

    Shows one chunk to logged-in users and another to everyone else.
    Optionally sets username or user full name as a placeholder.
      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
      • 6318
      • 11 Posts
      I don’t if it is a bug, or if the snippet is not called correctly, but it does not seem to function as it is suppose to.

      Here is how I call the snippet on a page:

      [[!Personalize? &yesChunk=`membres` &fullName=`membres` &noChunk=`offline`]]
      [[!Personalize? &yesChunk=`administrateurs` &fullName=`administrateurs` &noChunk=`offline`]]
      [[!Personalize? &yesChunk=`employés` &fullName=`employés` &noChunk=`offline`]]
      


      I the chunks should appear only to the identified users. What really happens is that any user, once logged in, will see the three chunks.

      So, is it just me?

      daedhel
        • 3749
        • 24,544 Posts
        Personalize shows one chunk to logged in users and another to not-logged-in users regardless of their names or groups they belong to so it only makes sense to use it once on a page. If &fullName=`1`, it will user the users full name rather than the username for the name placeholder.

        You need a more complicated snippet if you want to distinguish between different user groups. Something like this:

        [[!UserGroups]]

        <?php
        /* UserGroups snippet*/
        
        $user =& $modx->user;
        
        if ($user->isMember('membres') {
        
             $output = $modx->getChunk('membres');
        
        } elseif ($user->isMember('administrateurs') {
        
             $output = $modx->getChunk('administrateurs');
        
        } elseif ($user->isMember('employés') {
        
             $output = $modx->getChunk('employés');
        
        } else {
        
             $output = $modx->getChunk('offline');
        
        }
        
        return $output;
          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
          • 6318
          • 11 Posts
          Thanks for the tip. I have put that in a snippet, and when I call the snippet from a page, the page becomes all blank, without even an error code. Any other hint?




          Quote from: BobRay at Feb 09, 2011, 04:36 PM

          Personalize shows one chunk to logged in users and another to not-logged-in users regardless of their names or groups they belong to so it only makes sense to use it once on a page. If &fullName=`1`, it will user the users full name rather than the username for the name placeholder.

          You need a more complicated snippet if you want to distinguish between different user groups. Something like this:

          [[!UserGroups]]

          <?php
          /* UserGroups snippet*/
          
          $user =& $modx->user;
          
          if ($user->isMember('membres') {
          
               $output = $modx->getChunk('membres');
          
          } elseif ($user->isMember('administrateurs') {
          
               $output = $modx->getChunk('administrateurs');
          
          } elseif ($user->isMember('employés') {
          
               $output = $modx->getChunk('employés');
          
          } else {
          
               $output = $modx->getChunk('offline');
          
          }
          
          return $output;


          EDIT:

          Here is more info:

          http://modxcms.com/forums/index.php/topic,60962.0.html