We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 29076
    • 615 Posts
    I want to show the backend users userimage and name on the frontend page. Is there any placeholders or any other tags I can use to get this?

    Thanks.
      I think, thererfor I am! But what I am, and why...?
      • 20413
      • 2,877 Posts
      I know this snippet can show managers _online_ by usernames: http://modxcms.com/forums/index.php/topic,31712.msg193147.html#msg193147

      Maybe modify showmember snippet to do this would be the way to go... That snippet enables all the placeholders.
      But how to is something I dont know in my head...
        @hawproductions | http://mrhaw.com/

        Infograph: MODX Advanced Install in 7 steps:
        http://forums.modx.com/thread/96954/infograph-modx-advanced-install-in-7-steps

        Recap: Portland, OR (PDX) MODX CMS Meetup, Oct 6, 2015. US Bancorp Tower
        http://mrhaw.com/modx_portland_oregon_pdx_modx_cms_meetup_oct_2015_us_bancorp_tower
        • 4041
        • 788 Posts
        Although this is a very simple example, it could at least set a start point for you:

        Create a snippet and call it (uncached I think is best) [!YourSnippetName!] in your document where you want the name and image to appear.

        <?php
        /*    Author_name_photo
        
        */
        $output ="";
        $tbl = $modx->dbConfig['table_prefix'];
        $authorID = isset($authorid) ? $authorid : $modx->documentObject['createdby'];
        
        if($authorID != ""){
        $sql = "SELECT fullname,photo
              FROM ".$tbl."user_attributes
              WHERE ".$tbl."user_attributes.internalKey = ".$authorID;
        
              $rs = $this->dbQuery($sql);
              $limit = $this->recordCount($rs);
              if($limit > 0 && $limit < 2) {
                 $user = $this->fetchRow($rs);
        
                 $modx->setPlaceholder('author_fullname', $user['fullname']);     // [+author_fullname+]
                 if($user['photo'] != ""){
                   $modx->setPlaceholder('author_photo', '<img src="'.$user['photo'].'" alt="'.$user['fullname'].'">');           // [+author_photo+]
                 }else{
                   $modx->setPlaceholder('author_photo', 'no photo available');
                 }
               // print out the info or use it in a chunk after the snippet is called
              $output .="created by: [+author_fullname+] <br>";
              $output .="[+author_photo+]";
              }
        
        }
        
        return $output;
        ?>


        hope this helps smiley
          xforum
          http://frsbuilders.net (under construction) forum for evolution
          • 29076
          • 615 Posts
          Work perfect! Thanks. laugh
            I think, thererfor I am! But what I am, and why...?