Reputation: 1611
I've installed collective.portlet.tal. My goal is to show for each user, his info in his own folder by this portlet. Fox example now I want to show: username and email.
By default I have this portlet that show nothing of special:
<dl class="portlet portlet${portlet_type_name}"
tal:define="portal_state context/@@plone_portal_state;
context_state context/@@plone_context_state;">
<dt class="portletHeader">
<span class="portletTopLeft"></span>
<span>
Header
</span>
<span class="portletTopRight"></span>
</dt>
<dd class="portletItem odd">
Body text
</dd>
<dd class="portletFooter">
<span class="portletBotomLeft"></span>
<span>
Footer
</span>
<span class="portletBottomRight"></span>
</dd>
I've inserted in the Body this line to get the username of the folder, but it returns the name of the visitor. If I'm the admin, it will show "admin", or if I'm a member, it will show the member's name...and so on.
<p tal:content="user/getUserName"></p>
How can I show the creator of that folder? How can is possible get the emailof that user for that folder?
Upvotes: 2
Views: 426
Reputation: 1124558
You are looking for the Creator
of your folder:
<p tal:define="creator context/Creator;
mtool context/@@plone_tools/membership;
author python:mtool.getMemberInfo(creator)"
tal:content="python:author and author['fullname'] or creator">Author name</p>
The above snippet looks up the creator userid (this defaults to the owner of the content object), and uses the membership tool to look up a member info object for that user. We then display the user's full name, or if the creator is not a Plone user, just the userid.
Upvotes: 2