On Wednesday, April 11, 2012 9:46:21 AM UTC-4, BlueShadow wrote:
>
> Hi I like to hide a couple links on my page if users are not logged in and
> in the group of authors.
> I tried the following
> in the html page:
> {{if auth.requires_membership('Author')==True: =A('new Article' ,
> _href=URL(r=request,f='newArticle'))}}
> but I only get syntax errors
>
auth.requires_membership() is a function decorator -- you need to use
auth.has_membership(). Also, move the link to the next line and add a pass
statement at the end:
{{if auth.has_membership('Author'):}}
{{=A('new Article', _href=URL(r=request, f='newArticle'))}}
{{pass}}
Note, that will only keep the link out of the page -- you still need to
protect the newArticle() function with the auth.requires_membership()
decorator.
Anthony