current="true", examples
nav_first.pngFirst: thread:382
Has work on this halted?
Edited: 16 Nov 2017 07:31 by: broxen
Comments: 2
Tags:
nav_prev.pngPrevious: thread:225
Page Template with Profile
Edited: 05 Jan 2010 00:51 by: tsangk
Comments: 2
Tags:
Last: thread:209
Liveness Selector
Edited: 22 Dec 2009 13:13 by: Ed Johnson
Comments: 4
Tags:
nav_last.png
Next: thread:220
Not working through Live Template
Edited: 02 Jan 2010 00:21 by: leiger
Comments: 6
Tags:
nav_next.png

GabrysGabrys wrote on 21 Dec 2009 19:14

I moved the current from value to option usertype (usertype="current") to separate selector (current="true").

Some example may prove it's a good thing:

Select members:

+ Members
[[module ListUsers usertype="member"]]
* %%title%%
[[/module]]

Show text only to logged in user:

[[module ListUsers current="true"]]
You're now logged in. Your nick name is %%title%%.
[[/module]]

Show menu to logged in admins of the site:

[[module ListUsers current="true" usertype="admin"]]
+ Admin panel

* [[[Add post]]]
* [[[Add thread]]]
* [[[Manage users]]]
* [[[Manage site]]]
[[/module]]

It works by selecting this admin, who is the one that currently views the page. If user is not an admin ListUsers returns nothing. If user is not logged in, the same applies. If user viewing the page is logged in and is admin of the page, it's selected and the contents of the module is rendered with some user variables (none used) being replaced with his name, title, id and other data.


Start a new sub-thread

Comments: 14

Add a New Comment
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License