We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 6953
    • 94 Posts
    Is it possible to make for user after he (she) has loggined on my site to see in sidebar not only logout link, but also user’s avatar? I suppose TV can help me but I’m not sure how I must define content of TV. Can you help me?
      L.O.V.E is just a four letter word
      • 4041
      • 788 Posts
      try this and see if it helps....

      1. make this code a snippet, name it whatever you want, for this example i will use
      [!WebUserPhoto!]

      <?php
      // WebUserPhoto snippet code
      $output ="";
      
      if(isset($_SESSION['webValidated'])){
      $uid = $modx->getLoginUserID();
      $wuser = $modx->getWebUserInfo($uid);
      $wuser_photo = $wuser['photo'];
      
        if$wuser_photo !=""){
          $output .="<img src='$wuser_photo' border='0' alt=''>";
        }
      // else{
      // $output .="add your default content here if needed and remove the forward slashes from the front of the lines";
      //  }
      }
      
      return $output;
      ?>
      


      2. make a TV named whatever, i will use the same name as the snippet, then add the TV to your template in the spot to show the image.
      [*WebUserPhoto*]

      edit: make the default value of the TV be the snippet:

      If the user is logged in as a web user then their photo will show in the TV spot, if not it will show nothing.

        xforum
        http://frsbuilders.net (under construction) forum for evolution
        • 6953
        • 94 Posts
        Sorry, but I can’t understand your thought about making a default value of TV a snippet...how do you do it???
          L.O.V.E is just a four letter word
          • 4041
          • 788 Posts
          smiley
          In the manager, go to Resources/manage resources/Template Variables

          Click the Template Variables tab, then New Template variable

          Give your new TV a name, such as WebUserPhoto - add that in the first input box

          Give the new TV input type a textarea

          ** add your snippet call to the Default value box ***
          [!WebUserPhoto!]

          Make sure the template you want to use this TV in has a checkbox in the Template Access section

          Add the template variable to your template.... [*WebUserPhoto*]
            xforum
            http://frsbuilders.net (under construction) forum for evolution
            • 6953
            • 94 Posts
            Doesn’t work.shows me only [!WebUserPhoto!] and that’s all
              L.O.V.E is just a four letter word
              • 19797
              • 18 Posts
              You have to have a snippet named WebUserPhoto. Also try deleting trailing spaces. Because of the rich text editor, I often type my snippet calls into notepad and copy and paste them.
                • 6953
                • 94 Posts
                I explored and installed PPP snippet on my site. It really rocks)
                  L.O.V.E is just a four letter word