3

I am trying to override the Last Visit Date in the admin area of my Joomla 3.4.1 site.

I have manually made overrides to the following constants (site and admin)

enter image description here

and

enter image description here

it's not making any difference to the Last Visit Date, it's still i the following format.

enter image description here

I have cleared the cache and logged in/out numerous times. The dates seem to have effected other parts of the site, just not the part I want!

I would then also like to display this info one the site front end when a user is logged in, my curreny code I am using is below;

<?php
$user = JFactory::getUser();
if (!$user->guest) {
echo "<h3>Hi {$user->name}</h3>";
echo "<p>You were last here on {$user->lastvisitDate}.</p>";
}
?>

Any help appreciated.

  • Is this for that Saxum IP Logger component or a different extension? – Lodder Jun 26 '15 at 15:31
  • No the standard Joomla user manager. – jonboy Jun 26 '15 at 15:31
1

The functionality you're referring to has not been implemented for the Last Visit Date in the Joomla User Manager.

If you open the following file and go to line 152:

administrator\components\com_users\views\users\tmpl\default.php

you will see the following:

<?php echo JHtml::_('date', $item->lastvisitDate, 'Y-m-d H:i:s'); ?>

You can create a Template Override for this file and format it however you like.

You could either change the format there and then, or use one of Joomla's pre-defined formats, for example:

<?php echo JHtml::_('date', $item->lastvisitDate, JText::_('DATE_FORMAT_LC4')); ?>

Hope this helps

  • 1
    @johnny_s - Assuming you're using the default Isis admin template, you would create your override in administrator\templates\isis\html. Same process as a frontend template override, but it goes in your admin template folder instead – Lodder Jun 29 '15 at 9:33
  • 1
    @johnny_s - Replace $user->lastvisitDate with JHtml::_('date', $item->lastvisitDate, 'Y-m-d H:i:s');.....Inside you can change Y-m-d H:i:s to the format of your choice ;) – Lodder Jun 29 '15 at 10:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.