yurj
(Yuri)
February 8, 2024, 1:25pm
7
If you inspect with @@manage_viewlets , you'll see that part is already a viewlet. You've just to override its view and template using zcml:
https://5.docs.plone.org/develop/plone/views/more_view_examples.html#overriding-the-title
Instead of the Title viewlet, override the plone.personal_bar viewlet class to implement the method to get the portrait url and the template to display it as outlined here:
If the method returns a URL the template will look like this:
<img src="${view/get_portrait_url}">
In one project I have the following method so you probably miss the call to absolute_url method aswell:
def get_user_portrait(self):
portal_membership = api.portal.get_tool('portal_membership')
portrait = portal_membership.getPersonalPortrait(self.user_id).absolute_url()
return portrait