Detail view - display name of the user instead of his username (SOLVED) 7 years 3 weeks ago #1

  • Uyttebroeck Michel
  • Localtime: 10:08
  • Europe/Bucharest
  • Posts: 15
Hi,

In default.php (show views), how can I modify the following code in order to display the name of the user instead of his username ?

   <!-- Uploaded by -->
<div style="text-align: right;">
   <?php echo JText::_('SHOW_UPLOADED_BY'); ?>
   <?php if($this->image['user_id']): ?>
     <a href="<?php echo JRoute::_('index.php?option=com_hotornot&task=userpictures&id=' . $this->image['user_id'] . '&Itemid=' . $this->Itemid); ?>"><?php echo $this->image['username']; ?></a>
   <?php else: ?>
     <?php echo $this->image['username']; ?>
   <?php endif; ?>
</div>

Thanks to all
Michel


The administrator has disabled public write access.

Re: Detail view - display name of the user instead of his username 7 years 3 weeks ago #2

  • Alexandru
  • Alexandru's Avatar
  • Senior Developer
  • Bucharest
  • Localtime: 10:08
  • Europe/Bucharest
  • Posts: 4631
Hello!

Edit [Joomla dir]\components\com_hotornot\models\show.php and change line 126 from:
. '   i.category_id, c.title AS category_name, IF(u.username IS NOT NULL, u.username, "' . JText::_('Anonymous') . '") AS username'

to:
. '   i.category_id, c.title AS category_name, IF(u.username IS NOT NULL, u.name, "' . JText::_('Anonymous') . '") AS username'
thePHPfactory Customer Support
The administrator has disabled public write access.

Re: Detail view - display name of the user instead of his username 7 years 3 weeks ago #3

  • Uyttebroeck Michel
  • Localtime: 10:08
  • Europe/Bucharest
  • Posts: 15
:) Brillant thanks a lot. Job done.
The administrator has disabled public write access.