Blog Post Byline

Permalink
Hi, I'm using Concrete5 version 5.6.2.1 Earthtones Stone theme. I wanted to know if it is possible to modify the byline of blog posts to show a custom user attribute, in this case full_name, instead of the user name. I searched around for a while already but couldn't find a solution.

Thank you in advance.

 
planist1 replied on at Permalink Reply
planist1
Try this: check your blog_entry.php page around line 49.

It might have something that looks similar to

<?php  
            $u = new User();
            if ($u->isRegistered()) { ?>
               <?php   
               if (Config::get("ENABLE_USER_PROFILES")) {
                  $userName = '<a href="' . $this->url('/profile') . '">' . $u->getUserName() . '</a>';
               } else {
                  $userName = $u->getUserName();
               }
            }
            ?>
            <p><?php  echo t('Posted by:');?> <span class="post-author"><?php   echo $userName; ?> at <a href="<?php  $c->getLinkToCollection;?>"><?php  echo $c->getCollectionDatePublic('g:i a')?> on <?php  echo $c->getCollectionDatePublic('F jS, Y')?></a></span>


Try changing to this

<?php  
            $u = new User();
            $ui = UserInfo::getByID($u->getUserID());
            $userfullname = $ui->getAttribute('full_name');
            if ($u->isRegistered()) 
            { ?>
               <?php   
               if (Config::get("ENABLE_USER_PROFILES")) {
                  $userName = '<a href="' . $this->url('/profile') . '">' . $userfullname . '</a>';
                  } else {
                  $userName = $userfullname;
               }
            }
            ?>
            <p><?php  echo t('Posted by:');?> <span class="post-author"><?php   echo $userfullname; ?> at <a href="<?php  $c->getLinkToCollection;?>"><?php  echo $c->getCollectionDatePublic('g:i a')?> on <?php  echo $c->getCollectionDatePublic('F jS, Y')?></a></span>
adajad replied on at Permalink Reply
adajad
or use the 'magic' getUser function:
<?php  
            $u = new User();
            $ui = UserInfo::getByID($u->getUserID());
            $userfullname = $ui->getUserFullName();
            if ($u->isRegistered()) 
            { ?>
               <?php   
               if (Config::get("ENABLE_USER_PROFILES")) {
                  $userName = '<a href="' . $this->url('/profile') . '">' . $userfullname . '</a>';
                  } else {
                  $userName = $userfullname;
               }
            }
            ?>
            <p><?php  echo t('Posted by:');?> <span class="post-author"><?php   echo $userfullname; ?> at <a href="<?php  $c->getLinkToCollection;?>"><?php  echo $c->getCollectionDatePublic('g:i a')?> on <?php  echo $c->getCollectionDatePublic('F jS, Y')?></a></span>
kenan24 replied on at Permalink Reply
Thanks for the responses, I couldn't find my theme's blog_entry.php file for some reason. I ended up allowing spaces in usernames which accomplished my goal, hopefully without any negative side-effects.