I am using this code in a private page of mine, and I see both … any idea why? :S
[[include :snippets:suo BEGIN CODE |type=showto |user1=james-kanjo |user2=michal-frackowiak]]
Hello James Kanjo & Michał Frąckowiak!!!
[[include :snippets:suo END CODE]]
[[include :snippets:suo BEGIN CODE |type=showto |user1=james-kanjo |user2=michal-frackowiak |user3=leiger]]
Hello James Kanjo & Michał Frąckowiak & leiger !!!
[[include :snippets:suo END CODE]]
Edit: Code posted here: http://sandbox.wikidot.com/james-kanjo-suo-test:page (same result, I see both). If this works as you say it does, I am truly impressed. So far I can't get it working properly though :(
Edit2: It seems that if I use this code, I see neither. So the second one is taking precedence?
[[include :snippets:suo BEGIN CODE |type=showto |user1=james-kanjo |user2=michal-frackowiak]]
Hello James Kanjo & Michał Frąckowiak!!!
[[include :snippets:suo END CODE]]
[[include :snippets:suo BEGIN CODE |type=hidefrom |user1=james-kanjo |user2=michal-frackowiak |user3=leiger]]
Goodbye James Kanjo & Michał Frąckowiak & leiger !!!
[[include :snippets:suo END CODE]]
Edit3: Just to confirm for you… it is working perfectly fine in the example you have posted on this page. All I see is Hello Everybody Else!!!
~ Leiger - Wikidot Community Admin - Volunteer
Wikidot: Official Documentation | Wikidot Discord server
any idea why? :S
Hmm. It means you've found a hole in my programming… :(
Working on a fix right now…
Have posted a few updates to that comment, please check to see the other test I did :)
~ Leiger - Wikidot Community Admin - Volunteer
Wikidot: Official Documentation | Wikidot Discord server
Whoops, lol. Good point.
If I add my name to the first one, I see only the first one, so that works fine. :)
~ Leiger - Wikidot Community Admin - Volunteer
Wikidot: Official Documentation | Wikidot Discord server
I as a programmer understand how hard it is to find these bugs - it always helps to have a second set of eyes. So not sure why you're embarrassed xD
Will test it with the new attribute and post here if it doesn't work. So if I don't reply again today… it's probably because it works 100% fine and I'm too busy having fun with it :P
~ Leiger - Wikidot Community Admin - Volunteer
Wikidot: Official Documentation | Wikidot Discord server
Actually, I will post ;-) Works perfectly fine now!
Quick question — is there a limit to the number of user names I can provide? Is it ten (user1 - user10) or eleven (user + user1 - user10), or unlimited (user1 … user99) ?
~ Leiger - Wikidot Community Admin - Volunteer
Wikidot: Official Documentation | Wikidot Discord server
I love it! People on my site have been requesting this for ages and I can finally give it to them!
New announcement posted so they know about it: http://cyclods.wikidot.com/thread:84
Not going to give the code to use it though, as I don't want them to use 'hidefrom' to hide something from me :P So will just be used on the non-editable pages (e.g. homepage).
~ Leiger - Wikidot Community Admin - Volunteer
Wikidot: Official Documentation | Wikidot Discord server
I just added support for 101 users now
Thanks!
~ Leiger - Wikidot Community Admin - Volunteer
Wikidot: Official Documentation | Wikidot Discord server
Not to nit-pick, but users 0-99 only adds up to 100 users, not 101. Or, am I missing something?
Thanks for increasing the limit. I will be able to make good use of this.
Is there some clever way to create a page that has a group of users and then call that page's content inside the include? I'm thinking something like this:
[[include :snippets:suo BEGIN CODE |unique=first |type=showto |group1=mygroup:office-staff |group2=mygroup:salaried-managers]]
**Hello office staff and managers!**
[[include :snippets:suo END CODE]]
That way I could maintain a list of users on the pages in the mygroup category and not have to chase down every occurrence of the include if my list of users changes.
-Ed
Not to nit-pick, but users 0-99 only adds up to 100 users, not 101. Or, am I missing something?
Yes, 0-99 only adds up to 100 users. But James didn't say that. He said:
I just added support for 101 users now (user, then from user0 to user99)
I can count 101 there.
user
user0
user1
user2
…
user99
~ Leiger - Wikidot Community Admin - Volunteer
Wikidot: Official Documentation | Wikidot Discord server
OK, I didn't read it carefully. The docs and examples are a little confusing. Do we use user for just single users and user0-99 for multiples, or can we use something like:
[[include :snippets:suo BEGIN CODE |type=showto |user=leiger |user32=ed-johnson |user14=james-kanjo |user86=michal-frackowiak]]
Hello Shane, Ed, James & Michał!!!
[[include :snippets:suo END CODE]]
In other words, do we have to use the user, user0-99 sequentially? I suppose I should just go do some testing! (or study the source) xD
-Ed
James,
I was just looking at the code and found a small bug/typo.
{$code}
[[module CSS]]
{$hidefrom} {display: none; !important}
{$showto} {display: block !important;}
[[/module]]
The semicolon in the {$hidefrom} line is in the wrong place. I tried to edit it, but I don't have permission. It seems to be "non-fatal" since the !important may not be required, but it is a good safety measure.
-Ed
Yes, the whole reason I had !important was as a safety measure… but it's not a very good safety measure if it's outside the semi-column!!! Thanks Ed!
Do you need to use things sequentially? No, you can be as illogical as you want to be =P
I just added the "user=" option for programming aesthetics if I'm applying stuff to only one person.
Now grouping users… That's an interesting idea! I'll think about a design to implement that.
Thanks for the support guys! I'm glad you like it =D
Is there any way to use this to show it to only the page creator? I tried user=%%created_by%% but it doesn't seem to work, even when the name is already in lowercase (e.g. my own name) nothing appears.
~ Leiger - Wikidot Community Admin - Volunteer
Wikidot: Official Documentation | Wikidot Discord server
=(
~ Leiger - Wikidot Community Admin - Volunteer
Wikidot: Official Documentation | Wikidot Discord server
Your words, not mine :)
~ Leiger - Wikidot Community Admin - Volunteer
Wikidot: Official Documentation | Wikidot Discord server
At the time of this post (405 days after the birth of SUO), there are 216 pages on Wikidot using this technology!
Is that all?
We need to spread the word!
There are currently 8,893,011 pages at Wikidot. SUO deserves to be on at least half of those… surely! XD
~ Leiger - Wikidot Community Admin - Volunteer
Wikidot: Official Documentation | Wikidot Discord server
I know! Apparently people would rather have MP3 Players on their sites than to show things to specific users… what's going on?!
Actually, something made my day the other day — the Wikidot team are using SUO in the feedback site! I'm so happy!
I am using SUO in a live template to selectively display an email address field to only site admins and moderators. The problem is that I can't get the form data to display the contents of the field - it just displays the variable. Is this a bug or a limitation of using form data with SUO?
This code works in the live template when it's outside of the SUO snippet, but doesn't when it's inside the SUO wrapper.
User's email address: %%form_data{email}%%
Here's the source of the page:
[[include :snippets:tweet-button
|url=%%link%%
|text=I'm browsing: %%title%%
|via=eagletracegolf
|count=horizontal
|align=right
]]
[[div class="myblockquote" style="margin-left: 50px;"]]
Submitted by: [[size 120%]]%%form_data{name}%%[[/size]] on %%created_at|%B %d, %Y|agohover%%
%%form_data{summary}%%
%%form_data{readmore}%%
[[/div]]
[[include :snippets:suo BEGIN CODE |unique=announce|type=showto
|user1=ed-johnson
|user2=steve-johnson
|user3=joel-vogel
|user4=nancy-gohman
|user5=robelliott
]]
----
User's email address: %%form_data{email}%%
----
[[iftags +_active]]
This testimonial is currently **active**.
[[button edit text="Edit this testimonial" class="tag-buttons"]][[button set-tags -_active text="Make INACTIVE" class="tag-buttons"]]
[[/iftags]]
[[iftags -_active]]
This testimonial is currently **inactive**.
[[button edit text="Edit this testimonial" class="tag-buttons"]][[button set-tags +_active text="Make ACTIVE" class="tag-buttons"]]
[[/iftags]]
[[include :snippets:suo END CODE]]
~~~~
[!--
email:
label: Your email address
type: text
width: 50
match: /^$|^[_a-zA-Z0-9\-\+]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)+$/
[[module Comments]]
--]
====
[[form]]
fields:
header:
type: static
value: Thanks For Telling Us Your Story
intro:
type: static
value: Please fill out this form and save it. After saving, we will review the story before making it public. //We reserve the right to edit stories and control whether it's made visible to the public or not.//
join: true
name:
label: Your first name
type: text
default: Your first name
width: 30
join: true
email:
label: Your email address
type: text
width: 50
hint: Optional, won't be displayed. Enter it if you'd like a response.
match: /^$|^[_a-zA-Z0-9\-\+]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)+$/
join: true
summary:
label: Summary
type: wiki
width: 80
height: 3
default: This is the text displayed on the main index page before the "read more..." link.
join: true
readmore:
label: The rest of your story
type: wiki
width: 80
height: 5
default: Fill in the rest of your story here.
join: true
[[/form]]
Unfortunately, that's a limitation. The SUO module is based on the ListUsers module, which only allows the following:
- title
- name
- number
Other variables are ignored.
It's just like other modules (think of ListPages within a live template) - you can use variables as part of the module's parameters (e.g. perPage="%%form_raw{field}%%" should work), but if you try to put it inside the module body it becomes out of scope of the live template - it's in scope of the ListPages module instead.
As far as I understand, the same thing is happening here… the variable is in scope of the SUO (ListUsers) module, not the live template.
~ Leiger - Wikidot Community Admin - Volunteer
Wikidot: Official Documentation | Wikidot Discord server
Hey James,
Firstly thanks for this cracking snippet, it's really right up my street, but alas I've encountered a problem:
I've got several instances of this snippet at the top of the sidebar on my site all in default mode and all working perfectly. However, further down my sidebar I have a separate listpages module and several instances of the countpages module.
Now, despite my SUO snippets using only the listusers syntax (indeed, I've manually specified default mode for each of them), they stop both the listpages and countpages modules from updating for varying lengths of time (an hour to over a day's worth). The information they show remains the same even after I make new pages that should show up on or affect the data those modules display.
I tried removing it quickly to double check it was definitely the problem, and both sets of modules instantly updated themselves…
Having checked the "Important" segment of the documentation numerous times there seems to be no mention of such occurrences in default mode and nothing at all for the countpages module.
[[include :snippets:suo BEGIN CODE |unique=administrators |type=showto |mode=default |user1=uberman]]
++++ Hey, [http://ddl-anime.wikidot.com/profile:%%number%% %%title%%]!
[[size 80%]]Wikidot ID: %%number%%
Role: Admin
[http://ddl-anime.wikidot.com/mod:new-page New Page]
[http://ddl-anime.wikidot.com/sandbox Sandbox]
[http://ddl-anime.wikidot.com/mod:mod-cp Moderator CP]
[http://ddl-anime.wikidot.com/admin:manage Admin CP]
= [[button Edit]] [[button Tags]] [[button Rename]] [[button Source]][[/size]]
[[include :snippets:suo END CODE]]
[[include :snippets:suo BEGIN CODE |unique=managers|type=showto |mode=default |user1=psychia
++++ Hey, [http://ddl-anime.wikidot.com/profile:%%number%% %%title%%]!
[[size 80%]]Wikidot ID: %%number%%
Role: Manager
[http://ddl-anime.wikidot.com/mod:new-page New Page]
[http://ddl-anime.wikidot.com/sandbox Sandbox]
http://ddl-anime.wikidot.com/mod:mod-cp Moderator CP]
= [[button Edit]] [[button Tags]] [[button Rename]] [[button Source]][[/size]]
[[include :snippets:suo END CODE]]
[[include :snippets:suo BEGIN CODE |unique=staff |type=showto |mode=default |user1=xalathal |user2=bolei-cha |user3=daudemex]]
++++ Hey, [http://ddl-anime.wikidot.com/profile:%%number%% %%title%%]!
[[size 80%]]Wikidot ID: %%number%%
Role: Staff
[http://ddl-anime.wikidot.com/mod:new-page New Page]
[http://ddl-anime.wikidot.com/sandbox Sandbox]
[http://ddl-anime.wikidot.com/mod:mod-cp Moderator CP]
= [[button Edit]] [[button Tags]] [[button Rename]] [[button Source]][[/size]]
[[include :snippets:suo END CODE]]
[[include :snippets:suo BEGIN CODE |unique=members |type=hidefrom |mode=default |user1=uberman |user2=psychia |user3=xalathal |user4=bolei-cha |user5=daudemex]]
++++ Hey, [http://ddl-anime.wikidot.com/profile:%%number%% %%title%%]!
= [[size 80%]]//[http://ddl-anime.wikidot.com/profile:%%number%%/edit/true click here to edit your profile]//[[/size]]
[[include :snippets:suo END CODE]]
------
++++ Latest Added Series
[[module ListPages separate="yes" limit="10" tags="anime" category="*, -template"]]
%%title_linked%%
[[/module]]
[[table style="margin: 0 5px;"]]
[[row]]
[[cell style="padding: 6px; background-color: #FFFFFF; border: 1px solid white; width: 100%;"]]
[[/cell]]
[[/row]]
[[/table]]
[[image http://ddl-anime.wikidot.com/local--files/nav:side/963eca7d69d5b41af39f15e35862ed0b.png alt="Peekaboo!" link="random" width="100%"]]
[[table style="margin: 0 5px;"]]
[[row]]
[[cell style="padding: 6px; background-color: #FFFFFF; border: 1px solid white; width: 100%;"]]
[[/cell]]
[[/row]]
[[/table]]
------
[[module CountPages category="*, -template" tags="anime" pagetype="*"]]
++++ DDL-Anime Stats
DDL-Anime has **%%total%%** anime series of which:
[[/module]]
[[module CountPages category="*, -template" tags="anime,-hentai,-redirect" pagetype="*"]]
• **[http://ddl-anime.wikidot.com/full-list %%total%%]** are anime
[[/module]]
[[module CountPages category="*, -template" tags="hentai,-redirect" pagetype="*"]]
• **[http://ddl-anime.wikidot.com/system:page-tags/tag/hentai %%total%%]** are hentai
[[/module]]
[[module CountPages category="*, -template" tags="redirect" pagetype="*"]]
• **[http://ddl-anime.wikidot.com/system:page-tags/tag/redirect %%total%%]** have alternative titles
[[/module]]
[[module CountPages category="*, -template" tags="dualaudio,-redirect" pagetype="*"]]
• **[http://ddl-anime.wikidot.com/system:page-tags/tag/dualaudio %%total%%]** are dual audio
[[/module]]
[[module CountPages category="*, -template" tags="mature,-redirect" pagetype="*"]]
• **[http://ddl-anime.wikidot.com/system:page-tags/tag/mature %%total%%]** are mature
[[/module]]
[[module CountPages category="*, -template" tags="720p,1080p,1440*1080,1440*768,1824*992,-redirect" pagetype="*"]]
• **[http://ddl-anime.wikidot.com/system:page-tags/tag/720p %%total%%]** are 720p HD or higher
[[/module]]
I've checked your code, and there's nothing wrong with it.
It sounds like a Wikidot caching issue… Let me ask, is the updating issue with the CountPages module only, by any chance?
Well, that's what I thought too, it just seemed like a fantastic coincidence for it to suddenly change when I removed the code and checked.
Edit: Especially since I've always kept a close eye on the goings on of the sidebar and I've never had this problem until I started using the SUO snippet.
Both the ListPages and CountPages modules fail to update.
Hmm, odd. I've created a bug report, hopefully something should get resolved soon.
Sadly the problem has progressed further:
Now occasionally when I save a page after editing it, it'll revert back to a previous iteration/save of the page.
In my case, I have two page layouts, an old one and a new one. After updating a page from the old layout to the new one and hitting save there's a good chance it'll show the old layout prior to my editing it (which is remarkably different to the new one, there's no mixing them up). I have to refresh the page once or twice to get it to behave.
To further compound the issue, when I start editing pages after refreshing them in such a manner they occasionally show the wiki code from a previous iteration using the old layout, despite me having completely rewritten it since. This happens regardless of whether the old layout or the new layout is showing.
*Pulls out hair*
Edit: It goes without saying that neither of these problems happened even once prior to the implementation of this code, not in over 2.5 years.
I've heard of similar things happening to other users before (and I think it may have happened to me as well). It's a Wikidot bug.
If you post what you just told us on http://feedback.wikidot.com as a bug report, they should be able to fix it.
~ Leiger - Wikidot Community Admin - Volunteer
Wikidot: Official Documentation | Wikidot Discord server