Removing the username from the personal bar for a specific role

2 messages Options
Embed this post
Permalink
FilipeFreitas () Removing the username from the personal bar for a specific role
Reply Threaded More More options
Print post
Permalink
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
vedaw () Re: Removing the username from the personal bar for a specific role
Reply Threaded More More options
Print post
Permalink
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" <[hidden email]> 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


_______________________________________________
UI mailing list
[hidden email]
http://lists.plone.org/mailman/listinfo/ui