Skip to content

Instantly share code, notes, and snippets.

@janstieler
Created April 17, 2016 02:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save janstieler/9927e4b54c538c762fd6358925036d7e to your computer and use it in GitHub Desktop.
Save janstieler/9927e4b54c538c762fd6358925036d7e to your computer and use it in GitHub Desktop.
<?php
defined('JPATH_BASE') or die;
// Import the Profile Picture library
jimport('profilepicture.profilepicture');
// Get the current user object
$user = JFactory::getUser();
// Instantiate the ProfilePicture class with User ID
$profilepicture = new ProfilePicture($user->get('id'));
$profilepicture = $profilepicture->toHTML(PROFILEPICTURE_SIZE_200, $displayData['item']->author, ['class' => 'thumbnail col-md-10 img-responsive']);
?>
<dd class="createdby" itemprop="author" itemscope itemtype="https://schema.org/Person">
<?php $author = ($displayData['item']->created_by_alias ? $displayData['item']->created_by_alias : $displayData['item']->author); ?>
<?php $author = '<div itemprop="name" class="authorname col-md-24">' . $author . '</div>'; ?>
<?php $kontakt = '<div itemprop="name" class="authorcontact col-md-24">' . JText::_('TPL_DATAGON_AUTHOR_CONTACT') . '</div>'; ?>
<?php $authorinfo = '<div class="authorinfo col-md-14">' . $author . $kontakt . '</div>'; ?>
<?php if (!empty($displayData['item']->contact_link ) && $displayData['params']->get('link_author') == true) : ?>
<?php echo JHtml::_('link', $displayData['item']->contact_link, $profilepicture . $authorinfo, array('itemprop' => 'image', 'itemprop' => 'url', 'class' => 'authorbox' )); ?>
<?php else :?>
<?php echo $author; ?>
<?php endif; ?>
</dd>
@mierza
Copy link

mierza commented Apr 28, 2016

Hi,
Can you try this please ::
1-
REPLACE :
$profilepicture = new ProfilePicture($user->get('id'));
WITH:
$profilepicture = new ProfilePicture($this->escape($item->created_by));
IF NOT WORK , CHECK WITH THIS :
$profilepicture = new ProfilePicture($item->created_by);

IF NOT WORK BOTH PLEASE PROVIDE ME THE WHOLE PHP CODE OF FILE OR WHICH IS LOCATE EXACTLY FOLDER IN JOOMLA

Best Regards,
Mierza

@janstieler
Copy link
Author

Good evening,
thanks for your reply!
Sorry but nothing of this worked for me.
The original code is located in this folder: https://github.com/joomla/joomla-cms/blob/staging/layouts/joomla/content/info_block/author.php

Kind Regards,
Jan

@darmolloy
Copy link

darmolloy commented May 9, 2016

Hi,
I used the following line of code and it works for me:

$profilepicture = new ProfilePicture($displayData['item']->created_by); //passes in the author ID

instead of:

$profilepicture = new ProfilePicture($user->get('id')); // this will pass in the currently logged in user ID

Note:
In the author.php file above the following two lines should be removed:

//Get the current user object
$user = JFactory::getUser();

Regards,
Darran

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment