This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit ezplatform.com

eZ Community » Forums » Install & configuration » Handling users with templates.
expandshrink

Handling users with templates.

Handling users with templates.

Friday 31 January 2003 12:27:32 am - 7 replies

Hi,

Im progressing with ez and am looking at adding users where each user will have
custom content that they can create/edit. Im having trouble finding the information I
need to allow users to handled correctly within the ez template language. I've seen
examples on sdk.ez for handling such things within the kernel but i haven't made
the connection yet with how to handle this within templates.

I can get a user to log in but what object and attributes do i access within templates
in order to determine that particular user has logged in so that i can insert a switch
statement to serve content? In addition how can i add this user information to the fetch statement
to return content belonging to that user? Are there code examples to illustrate this?

I can say more here but I want to start simple and understand the basics happy.gif Emoticon

Many thanks

Paul

Friday 31 January 2003 12:10:29 pm

> Hi,
>
> Im progressing with ez and am looking at adding users where
> each user will have
> custom content that they can create/edit. Im having trouble
> finding the information I
> need to allow users to handled correctly within the ez
> template language. I've seen
> examples on sdk.ez for handling such things within the
> kernel but i haven't made
> the connection yet with how to handle this within
> templates.
>
> I can get a user to log in but what object and attributes do
> i access within templates
> in order to determine that particular user has logged in so
> that i can insert a switch

The current user is availabe trough the $current_user variable, however this is not available from module views since modules run before the pagelayout.

> statement to serve content? In addition how can i add this
> user information to the fetch statement
> to return content belonging to that user? Are there code
> examples to illustrate this?

At the moment you cannot restrict lists by user created content, we'll consider adding this for the RC2 or the final release.

> I can say more here but I want to start simple and
> understand the basics happy.gif Emoticon

Friday 31 January 2003 1:45:26 pm

> > Hi,
> >
> > Im progressing with ez and am looking at adding users
> where
> > each user will have
> > custom content that they can create/edit. Im having
> trouble
> > finding the information I
> > need to allow users to handled correctly within the ez
> > template language. I've seen
> > examples on sdk.ez for handling such things within the
> > kernel but i haven't made
> > the connection yet with how to handle this within
> > templates.
> >
> > I can get a user to log in but what object and attributes
> do
> > i access within templates
> > in order to determine that particular user has logged in
> so
> > that i can insert a switch
>
> The current user is availabe trough the $current_user
> variable, however this is not available from module views
> since modules run before the pagelayout.
>
> > statement to serve content? In addition how can i add
> this
> > user information to the fetch statement
> > to return content belonging to that user? Are there code
> > examples to illustrate this?
>
> At the moment you cannot restrict lists by user created
> content, we'll consider adding this for the RC2 or the final
> release.
>
> > I can say more here but I want to start simple and
> > understand the basics happy.gif Emoticon

I need to be able to have custom content per user as well where only the specific user can edit their own information. Since the user account is edited only by the user in question can I use the user account as the link to their own content by related object.

This way I can get a workaround while waiting for this feature as it is essential to the whole operation of my site.

If not when will this functionality be available?

Is it possible to simply limit access to these layouts by putting them into a section and defining a role allowing only users from a specific group to access them then display the details using the $current_user variable?

Thanks in advance.

Friday 31 January 2003 3:11:05 pm

> > Hi,
> >
> > Im progressing with ez and am looking at adding users
> where
> > each user will have
> > custom content that they can create/edit. Im having
> trouble
> > finding the information I
> > need to allow users to handled correctly within the ez
> > template language. I've seen
> > examples on sdk.ez for handling such things within the
> > kernel but i haven't made
> > the connection yet with how to handle this within
> > templates.
> >
> > I can get a user to log in but what object and attributes
> do
> > i access within templates
> > in order to determine that particular user has logged in
> so
> > that i can insert a switch
>
> The current user is availabe trough the $current_user
> variable, however this is not available from module views
> since modules run before the pagelayout.

Im a little confused about whether this is a yes, i can performed a switch based on $current_user, or not. I've heard that rc2 will contain more documenation and examples about users. Would it be possible to provide a little sample code for this? Performing a grep on the source code does show $current_user being used in a few places but its not enough to illustrate how to use for my purpose.

Stuart wrote:
"Is it possible to simply limit access to these layouts by putting them into a section and defining a role allowing only users from a specific group to access them then display the details using the $current_user variable?"

I have something similar like at the moment. All users+anonymous can view the information, but only my users can edit/create. However, for example, i would love to have a little area thats lists information that *only* the logged in user has created/edited. My current level of knowledge leads me to believe a fetch with user information would be required. Is there another way?

Thanks

Paul

Friday 31 January 2003 3:11:21 pm

> > I can get a user to log in but what object and attributes
> do
> > i access within templates
> > in order to determine that particular user has logged in
> so
> > that i can insert a switch
>
> The current user is availabe trough the $current_user
> variable, however this is not available from module views
> since modules run before the pagelayout.

Im a little confused about whether this is a yes - can i perform a switch based on $current_user - or not. I've heard that rc2 will contain more documenation and examples about users. Would it be possible to provide a little sample code for this? Performing a grep on the source code does show $current_user being used in a few places but its not enough to illustrate how to use for my purpose.

Stuart wrote:
"Is it possible to simply limit access to these layouts by putting them into a section and defining a role allowing only users from a specific group to access them then display the details using the $current_user variable?"

I have something similar like that at the moment. All users+anonymous can view the information, but only my users can edit/create. However, for example, i would love to have a little area thats lists information that *only* the logged in user has created/edited. My current level of knowledge leads me to believe a fetch with user information would be required. Is there another way?

Thanks

Paul

Friday 31 January 2003 3:13:03 pm

> > I can get a user to log in but what object and attributes
> do
> > i access within templates
> > in order to determine that particular user has logged in
> so
> > that i can insert a switch
>
> The current user is availabe trough the $current_user
> variable, however this is not available from module views
> since modules run before the pagelayout.

Im a little confused about whether this is a yes - can i perform a switch based on $current_user - or not. I've heard that rc2 will contain more documenation and examples about users. Would it be possible to provide a little sample code for this? Performing a grep on the source code does show $current_user being used in a few places but its not enough to illustrate how to use for my purpose.

Stuart wrote:
"Is it possible to simply limit access to these layouts by putting them into a section and defining a role allowing only users from a specific group to access them then display the details using the $current_user variable?"

I have something similar like that at the moment. All users+anonymous can view the information, but only my users can edit/create. However, for example, i would love to have a little area thats lists information that *only* the logged in user has created/edited. My current level of knowledge leads me to believe a fetch with user information would be required. Is there another way?

Thanks

Paul

Tuesday 04 February 2003 11:21:10 pm

it is possible to add the variables $current_user and $anonymous_user_id to a content view template by searching for
$tpl->setVariable( 'node', $node ) in kernel/content/view.php
and placing these two lines before it.
$tpl->setVariable( "current_user", $user );
$tpl->setVariable( "anonymous_user_id", $ini->variable( 'UserSettings', 'AnonymousUserID' ) );

> > > Hi,
> > >
> > > Im progressing with ez and am looking at adding users
> > where
> > > each user will have
> > > custom content that they can create/edit. Im having
> > trouble
> > > finding the information I
> > > need to allow users to handled correctly within the ez
> > > template language. I've seen
> > > examples on sdk.ez for handling such things within the
> > > kernel but i haven't made
> > > the connection yet with how to handle this within
> > > templates.
> > >
> > > I can get a user to log in but what object and
> attributes
> > do
> > > i access within templates
> > > in order to determine that particular user has logged
> in
> > so
> > > that i can insert a switch
> >
> > The current user is availabe trough the $current_user
> > variable, however this is not available from module
> views
> > since modules run before the pagelayout.
> >
> > > statement to serve content? In addition how can i add
> > this
> > > user information to the fetch statement
> > > to return content belonging to that user? Are there
> code
> > > examples to illustrate this?
> >
> > At the moment you cannot restrict lists by user created
> > content, we'll consider adding this for the RC2 or the
> final
> > release.
> >
> > > I can say more here but I want to start simple and
> > > understand the basics happy.gif Emoticon
>
> I need to be able to have custom content per user as well
> where only the specific user can edit their own information.
> Since the user account is edited only by the user in
> question can I use the user account as the link to their own
> content by related object.
>
> This way I can get a workaround while waiting for this
> feature as it is essential to the whole operation of my
> site.
>
> If not when will this functionality be available?
>
> Is it possible to simply limit access to these layouts by
> putting them into a section and defining a role allowing
> only users from a specific group to access them then display
> the details using the $current_user variable?
>
> Thanks in advance.

Wednesday 05 February 2003 1:04:06 pm

> I need to be able to have custom content per user as well
> where only the specific user can edit their own information.
> Since the user account is edited only by the user in
> question can I use the user account as the link to their own
> content by related object.
>
> This way I can get a workaround while waiting for this
> feature as it is essential to the whole operation of my
> site.
>
> If not when will this functionality be available?
>
> Is it possible to simply limit access to these layouts by
> putting them into a section and defining a role allowing
> only users from a specific group to access them then display
> the details using the $current_user variable?

A fetch function has been added for the user module, this means that the current user can be fetched with.
{fetch('user','current_user')}

For instance do
{fetch('user','current_user')|attribute(show,1)}
to get the attributes.

This new function will be present in RC2.

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from