Forums / Install & configuration / Handling users with templates.

Handling users with templates.

Author Message

Paul Forsyth

Thursday 30 January 2003 3:27:32 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
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 :)

Many thanks

Paul

Jan Borsodi

Friday 31 January 2003 3:10:29 am

> 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 :)

--
Amos

Documentation: http://ez.no/ez_publish/documentation
FAQ: http://ez.no/ez_publish/documentation/faq

Stuart Fenton

Friday 31 January 2003 4:45:26 am

> > 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 :)

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.

Paul Forsyth

Friday 31 January 2003 6:11:05 am

> > 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

Paul Forsyth

Friday 31 January 2003 6:11:21 am

> > 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

Paul Forsyth

Friday 31 January 2003 6:13:03 am

> > 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

Rib Rdb

Tuesday 04 February 2003 2: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 :)
>
> 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.

Jan Borsodi

Wednesday 05 February 2003 4:04:06 am

> 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.

--
Amos

Documentation: http://ez.no/ez_publish/documentation
FAQ: http://ez.no/ez_publish/documentation/faq

eZ debug

Timing: Jan 18 2025 02:07:58
Script start
Timing: Jan 18 2025 02:07:58
Module start 'content'
Timing: Jan 18 2025 02:07:59
Module end 'content'
Timing: Jan 18 2025 02:07:59
Script end

Main resources:

Total runtime1.4984 sec
Peak memory usage4,096.0000 KB
Database Queries213

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0073 588.9453180.8281
Module start 'content' 0.00731.3772 769.7734730.5547
Module end 'content' 1.38460.1137 1,500.3281352.4453
Script end 1.4983  1,852.7734 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00420.2772210.0002
Check MTime0.00150.0969210.0001
Mysql Total
Database connection0.00090.062710.0009
Mysqli_queries1.380592.13052130.0065
Looping result0.00190.12512110.0000
Template Total1.461397.520.7307
Template load0.00200.131820.0010
Template processing1.459497.394720.7297
Template load and register function0.00010.008510.0001
states
state_id_array0.00090.058810.0009
state_identifier_array0.00150.102020.0008
Override
Cache load0.00220.14542450.0000
Sytem overhead
Fetch class attribute can translate value0.00120.083150.0002
Fetch class attribute name0.00090.061590.0001
XML
Image XML parsing0.00100.069250.0002
class_abstraction
Instantiating content class attribute0.00000.0013100.0000
General
dbfile0.00370.2456280.0001
String conversion0.00000.000530.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
8content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
18content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
17content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
2content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 47
 Number of unique templates used: 6

Time used to render debug report: 0.0002 secs