How to modify articles.
  • I want modify the "Published by USERNAME" to "Published by REAL NAME" where i need to check that, for example i got

    <?php
    printf( t('Published by %1$s, %2$s'),
    $this->_helper('user')->link( $article['author'] ),
    $this->_date->format( $article['date'] )
    );
    ?>


    This code is part of headline.html at views on article module.
  • Not all users have the 'First Name' and 'Surname' fields filled in, however you'd do something like this:
    <?php
    $user = $this->_ugmanager->getUser( $article['author'] );
    if ( $user['first_name'] ) {
    $name = rtrim( $user['first_name'].' '.$user['surname'] );
    } else {
    $name = $this->_helper('user')->link( $article['author'] )
    }
    ?>


    then replace the '$this->_helper' line in the existing code with '$name'. Of course, this doesn't check if the actual user exists, though.

    You've also given me an idea, which I shall try to implement for 2.6.0 :) How to display users names.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion