Keyword

Avatar instead of the name in the author of the article

  • Alaabouch
  • Alaabouch's Avatar Topic Author
  • Offline
  • Senior Member
More
6 years 10 months ago #166406 by Alaabouch
Hello everybody,

Knowing that I am not an encoder, I work with a gavick pro site whose k2 system for articles. So I would like to change the name of the article author to show below the title by his avatar. I know that I have to change something in this line located in the item.php page:

<?php if($params->get('itemAuthor')): ?>
<li><?php echo K2HelperUtilities::writtenBy($this->item->author->profile->gender); ?>&nbsp;<?php if(empty($this->item->created_by_alias)): ?><a rel="author" href="<?php echo $this->item->author->link; ?>"><?php echo $this->item->author->name; ?></a><?php else: ?><?php echo $this->item->author->name; ?><?php endif; ?></li>
<?php endif; ?>

but I do not know how to do it anymore! Is there anyone who can help me edit and thank you


here is the code that I insert in the article so that it shows me the avatar of the author but I replace id by its number manually :(


<p class="flotte" style="line-height: 65px;">Ecrit par<a href="/profil/aidepharmacien" target="_blank"> <img src="/{user avatar 564 raw}" alt="" style="width: 45px; border-radius: 100%;" /></a></p>

Please Log in or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
6 years 9 months ago #166422 by Krikor Boghossian
Replied by Krikor Boghossian on topic Avatar instead of the name in the author of the article
Hello,
You are almost there.
The image part in your code needs to be replaced with this:
github.com/getk2/k2/blob/master/components/com_k2/templates/default/item.php#L391-L393

You also need to keep or update the CSS styling you applied.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

  • Alaabouch
  • Alaabouch's Avatar Topic Author
  • Offline
  • Senior Member
More
6 years 9 months ago - 6 years 9 months ago #166436 by Alaabouch
Hello,

thank you first for attention ! I think I did not explain things well. in fact even with the integration of this code in the part concerned by the profile, I must put it every time I write an article. which is not practical. I wonder if it is possible to display the avatar instead of the name of the author under the title of the article ?


[img]http://http://zupimages.net/viewer.php?id=18/05/u5l9.png[/img]
Last edit: 6 years 9 months ago by Alaabouch.

Please Log in or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
6 years 9 months ago #166457 by Krikor Boghossian
Replied by Krikor Boghossian on topic Avatar instead of the name in the author of the article
Of course you need to override the item.php file
getk2.org/documentation/tutorials/174-templating-with-k2-and-the-concepts-of-sub-templates

If you are using multiple sub-templates read this www.joomlaworks.net/blog/item/194-k2-inheritance-sub-templating

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

  • Alaabouch
  • Alaabouch's Avatar Topic Author
  • Offline
  • Senior Member
More
6 years 9 months ago #166484 by Alaabouch
Hello and thank you for the answer. I could replace the code and display the avatar. but I do not know how to synchronise the users of k2 and joomla. because the avatar of k2 is empty !

Please Log in or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
6 years 9 months ago #166619 by Krikor Boghossian
Replied by Krikor Boghossian on topic Avatar instead of the name in the author of the article
Hello,

Make sure that the K2 user plugin is activated.
This will sync all new users for you.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum