[Plone-UI] Removing the username from the personal bar for a specific role

Veda Williams veda at onenw.org
Fri Nov 28 23:46:43 UTC 2008


Hello,

In the plone.app.layout egg, under the viewlets/ directory, there is a file
named common.py that defines the behavior of the personaltools area:

class PersonalBarViewlet(ViewletBase):
    render = ViewPageTemplateFile('personal_bar.pt')

    def update(self):
        super(PersonalBarViewlet, self).update()

        context_state = getMultiAdapter((self.context, self.request),
                                        name=u'plone_context_state')
        tools = getMultiAdapter((self.context, self.request),
name=u'plone_tools')
        
        sm = getSecurityManager()

        self.user_actions = context_state.actions().get('user', None)

        plone_utils = getToolByName(self.context, 'plone_utils')
        self.getIconFor = plone_utils.getIconFor

        self.anonymous = self.portal_state.anonymous()

        if not self.anonymous:
        
            member = self.portal_state.member()
            userid = member.getId()
            
            if sm.checkPermission('Portlets: Manage own portlets',
self.context):
                self.homelink_url = self.site_url + '/dashboard'
            else:
                self.homelink_url = self.site_url + '/author/' +
quote_plus(userid)
            
            member_info = tools.membership().getMemberInfo(member.getId())
            fullname = member_info.get('fullname', '')
            if fullname:
                self.user_name = fullname
            else:
                self.user_name = userid

My suggestion is to alter the Python code (in your own theme product) to
suppress the user name.

If that's too difficult, you can probably do it using CSS:

#user-name {display:none; }

Cheers,

- Veda


On 11/27/08 7:44 PM, "FilipeFreitas" <filipefreitas at ua.pt> wrote:

> 
> Hello!
> I'm trying to remove the username from the personal bar (where it says "home
> folder" and "logout",etc) for a specific role. The role is 'job'.
> My best bet is in the ZMI -> portal_view_customizations> plone.personal_bar
> (there's 2)
> There's a bit of code:
> 
> <ul id="portal-personaltools"
> tal:condition="python:view.user_actions or not view.job"
> 
>     class="visualInline">
>    <tal:block condition="not: view/job">
>        <li>   
>             
>                 John
>             </li>
>    </tal:block>
> 
> I think the bold code is responsible for displaying the username. Where it
> says 'job' it was 'anonymous'.
> Unfortunately this didn't work.
> Does anyone know where/how i could remove the username from the personal
> bar?
> Thank you





More information about the UI mailing list