Gabrys 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.
This is your code:
Edit: And I noticed that this one is "ListUser" and not "ListUsers" — is that a mistake or intentional?
~ Leiger - Wikidot Community Admin - Volunteer
Wikidot: Official Documentation | Wikidot Discord server | NEW: Wikiroo, backup tool (in development)
To all admins
Only the name of the admin that views the page.
Feel free to make the description (maybe name also?) of the selector more understandable and explicit.
Piotr Gabryjeluk
visit my blog
Okay, so please confirm if I have got the first two right.
As for the third… I've tried to explain why I am having trouble understanding it.
There is a theoretical wiki with these members:
Code
Output (visible to anonymous and up)
Variable %%title%% applies to the usertype of "member"
Members
Code
Output (visible to anonymous and up)
Variable %%title%% applies to the current user
You're now logged in. Your nick name is Anonymous.
or
You're now logged in. Your nick name is Gabrys.
Code
Output (visible to ?)
CONFUSION — Does variable %%title%% apply to the usertype of "admin" or to the current user? You said current user in your post, but why is this? Does that mean that the 'current' attribute has precedence over the 'usertype' attribute?
Admin panel
~ Leiger - Wikidot Community Admin - Volunteer
Wikidot: Official Documentation | Wikidot Discord server | NEW: Wikiroo, backup tool (in development)
Selectors don't take precedence, they are all applied to set of users. If I select users that:
It's clear it's those admins who where busy in last 15 minutes OR that users which were busy in last 15 minutes who are admins.
Current="true" limits the users to show to only one user, which currently views the page, so for each user viewing the same page, ListUsers with current="true" list at max one (=them) user. If you filter even further, for example admins and current="true" it means it will list only yourself IF you are admin.
So in third example variable %%title%% applies to the title of current users if they're admin. Otherwise no users will be listed, so the variable won't apply to anything.
It should be clear now.
Piotr Gabryjeluk
visit my blog
And taking each of your examples:
1. It should work exactly this way. No matter who you are this ListUsers should list members of current site.
2. Almost OK. Anonymous is not a user, so it won't list anything in that case.
3. As explained above. Shown only to logged-in admins (Shane and Simon), for each of them listing themselves (for Shane listed user is Shane, for Simon it is Simon).
Some more hypothetical examples:
Shown to Shane and Simon:
This would be shown to any user visiting the site, saying:
(One "doesn't make much sense" for each admin).
Piotr Gabryjeluk
visit my blog
Okay, that makes more sense now. It doesn't seem logical though, somehow. I need to think carefully about each situation to try to figure out (a) who will be able to see it (b) what will appear on the page.
Perhaps that's because this is new and I haven't used it as often as I use the ListPages module … or perhaps it could be designed differently to make things easier.
The only thing I can go back to is the ListPages module. Here is something that seems to act similarly to the current="true" attribute…
Perhaps something like range="." would be better than current="true" ???
Edit: Or user="."
~ Leiger - Wikidot Community Admin - Volunteer
Wikidot: Official Documentation | Wikidot Discord server | NEW: Wikiroo, backup tool (in development)
Right, user="." is nicer than current="true". I'm updating design. Eventually it could work like:
When . is special and means current user.
So rather users="…", just like ListPages and planned pages="start, welcome, ., .." (when . is current page and .. is parent page).
Thanks!
Piotr Gabryjeluk
visit my blog
Still a little bit confusing… but I'm hoping that actually using the module will help to sort that out :)
Just to confirm:
[[module ListUsers user="gabrys, leiger" usertype="admin"]]
[[/module]]
[[module ListUsers user="gabrys, leiger"]]
[[/module]]
And an example of what I would put on my website's welcome page, if I wanted to direct the user to their per-site profile page, would be this:
~ Leiger - Wikidot Community Admin - Volunteer
Wikidot: Official Documentation | Wikidot Discord server | NEW: Wikiroo, backup tool (in development)
Visibility has nothing to do with this module. It's only a side effect of users="." listing only (at max) one user, so it can happen it will list NO users (so it's "invisible").
So
The latter two examples are correct.
Piotr Gabryjeluk
visit my blog
Aha. Once again I understand a bit more. I'm getting there :) No further questions for now… it makes sense.
This module is visible to all website visitors, except in the situation where user="." and usertype="something" are combined. In that situation the current user must be of the specified user group.
~ Leiger - Wikidot Community Admin - Volunteer
Wikidot: Official Documentation | Wikidot Discord server | NEW: Wikiroo, backup tool (in development)
Pieter's 3rd rule of design: if it does not rapidly make sense to the typical target user, the design is wrong.
Portfolio
Yes, but as you see, it's not a magical situation or rule, but only a logical effect of selecting current user.
Piotr Gabryjeluk
visit my blog
A mistake, there are no subtle variations on module names, that would be pathological. I've fixed Piotr's text.
Portfolio
This sentence took me three parses to understand. Especially the 'OR'. What you mean is that selectors are ANDed together so it's "users who are admins AND who were busy in the last 15 minutes".
This subthread started on the wrong basis. Piotr, you did not specify your requirements, you jumped straight into proposals of technical solutions and then tried to justify them with examples. The resulting confusion is entirely predictable, and a waste of time.
Please define your requirements in advance!
I need independent selectors for users who are admins AND for the user who is currently looking at the page.
Having defined your requirement, the solution is clear. You need a selector that specifies the user, where 'current user' is a special case, and indeed 'user = "."' is the best answer.
Portfolio