Forum » Hidden / Per page discussions » Specific Users Only Include
Started by: Wikidot
Date: 12 Apr 2010 03:23
Number of posts: 42
rss icon RSS: New posts
This is the discussion related to the wiki page Specific Users Only Include.
page 1 of 21
leiger leiger 12 Apr 2010 04:22

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

Last edited on 12 Apr 2010 04:30 by leiger
by leiger leiger , 12 Apr 2010 04:22
GoVegan GoVegan 12 Apr 2010 04:29

any idea why? :S

Hmm. It means you've found a hole in my programming… :(
Working on a fix right now…

by GoVegan GoVegan , 12 Apr 2010 04:29
leiger leiger 12 Apr 2010 04:30

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

by leiger leiger , 12 Apr 2010 04:30
GoVegan GoVegan 12 Apr 2010 04:31

@ Edit 2, If you see neither, that's fantastic, and it's working as it should… look at the code you posted here

by GoVegan GoVegan , 12 Apr 2010 04:31
leiger leiger 12 Apr 2010 04:33

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

by leiger leiger , 12 Apr 2010 04:33
GoVegan GoVegan 12 Apr 2010 05:06

Fixed with a new functionality: the unique attribute.

Thanks for pointing this out Shane!!! I'm ashamed as a programmer to not have seen it coming *hides embarrassment*

by GoVegan GoVegan , 12 Apr 2010 05:06
leiger leiger 12 Apr 2010 05:10

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

by leiger leiger , 12 Apr 2010 05:10
GoVegan GoVegan 12 Apr 2010 05:11

Sweet!

by GoVegan GoVegan , 12 Apr 2010 05:11
leiger leiger 12 Apr 2010 05:26

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

by leiger leiger , 12 Apr 2010 05:26
GoVegan GoVegan 12 Apr 2010 05:38

The current limit is 12:

  • user
  • user0
  • user1..user10

I can add a lot more users at request though.

Glad to hear you like it!

by GoVegan GoVegan , 12 Apr 2010 05:38
leiger leiger 12 Apr 2010 05:46

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

by leiger leiger , 12 Apr 2010 05:46
GoVegan GoVegan 12 Apr 2010 06:00

Haha! That's great!

I just added support for 101 users now (user, then from user0 to user99)

by GoVegan GoVegan , 12 Apr 2010 06:00
leiger leiger 12 Apr 2010 06:57

I just added support for 101 users now

Thanks!


~ Leiger - Wikidot Community Admin - Volunteer
Wikidot: Official Documentation | Wikidot Discord server

by leiger leiger , 12 Apr 2010 06:57
(account deleted) 13 Apr 2010 00:13

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

by (account deleted), 13 Apr 2010 00:13
leiger leiger 13 Apr 2010 01:09

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

by leiger leiger , 13 Apr 2010 01:09
(account deleted) 13 Apr 2010 01:37

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

Last edited on 30 May 2010 12:48 by (account deleted)
by (account deleted), 13 Apr 2010 01:37
(account deleted) 13 Apr 2010 01:46

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

by (account deleted), 13 Apr 2010 01:46
GoVegan GoVegan 13 Apr 2010 10:47

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

by GoVegan GoVegan , 13 Apr 2010 10:47
leiger leiger 14 Apr 2010 01:21

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

by leiger leiger , 14 Apr 2010 01:21
GoVegan GoVegan 14 Apr 2010 10:12

Remember bug 16? That's the reason nothing is appearing.

by GoVegan GoVegan , 14 Apr 2010 10:12
leiger leiger 15 Apr 2010 00:12

=(


~ Leiger - Wikidot Community Admin - Volunteer
Wikidot: Official Documentation | Wikidot Discord server

by leiger leiger , 15 Apr 2010 00:12
Check this out!
GoVegan GoVegan 30 May 2010 04:14

I found a workaround!

Check it out!

by GoVegan GoVegan , 30 May 2010 04:14
"type" is required, isn't it?
GoVegan GoVegan 30 May 2010 05:31

Yes, I'm stupid =D

by GoVegan GoVegan , 30 May 2010 05:31
Re: "type" is required, isn't it?
leiger leiger 30 May 2010 05:37

Your words, not mine :)


~ Leiger - Wikidot Community Admin - Volunteer
Wikidot: Official Documentation | Wikidot Discord server

by leiger leiger , 30 May 2010 05:37
Thought I'd Just Add
Deonte Deonte 24 Apr 2011 09:38

With the new fix, you can just type %%created_by_unix%% for in code use

by Deonte Deonte , 24 Apr 2011 09:38
GoVegan GoVegan 22 May 2011 05:45

At the time of this post (405 days after the birth of SUO), there are 216 pages on Wikidot using this technology!

Last edited on 22 May 2011 05:48 by GoVegan
by GoVegan GoVegan , 22 May 2011 05:45
leiger leiger 22 May 2011 07:17

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

by leiger leiger , 22 May 2011 07:17
GoVegan GoVegan 22 May 2011 07:29

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!

by GoVegan GoVegan , 22 May 2011 07:29
Form Data Inside SUO
(account deleted) 27 May 2011 15:32

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]]
Last edited on 27 May 2011 15:35 by (account deleted)
by (account deleted), 27 May 2011 15:32
Re: Form Data Inside SUO
leiger leiger 27 May 2011 16:41

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

by leiger leiger , 27 May 2011 16:41
Module Troubles
Uberman Uberman 13 Jul 2011 09:46

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]]
Last edited on 13 Jul 2011 09:52 by Uberman
by Uberman Uberman , 13 Jul 2011 09:46
Re: Module Troubles
GoVegan GoVegan 13 Jul 2011 14:06

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?

by GoVegan GoVegan , 13 Jul 2011 14:06
Re: Module Troubles
Uberman Uberman 13 Jul 2011 14:13

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.

Last edited on 13 Jul 2011 14:17 by Uberman
by Uberman Uberman , 13 Jul 2011 14:13
Re: Module Troubles
GoVegan GoVegan 13 Jul 2011 22:28

Hmm, odd. I've created a bug report, hopefully something should get resolved soon.

by GoVegan GoVegan , 13 Jul 2011 22:28
Re: Module Troubles
Uberman Uberman 20 Jul 2011 23:23

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.

Last edited on 20 Jul 2011 23:25 by Uberman
by Uberman Uberman , 20 Jul 2011 23:23
Re: Module Troubles
leiger leiger 21 Jul 2011 00:35

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

by leiger leiger , 21 Jul 2011 00:35
page 1 of 21
/forum/t-233603/specific-users-only-include#post-
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License
Click here to edit contents of this page.
Click here to toggle editing of individual sections of the page (if possible). Watch headings for an "edit" link when available.
Append content without editing the whole page source.
Check out how this page has evolved in the past.
If you want to discuss contents of this page - this is the easiest way to do it.
View and manage file attachments for this page.
A few useful tools to manage this Site.
Change the name (also URL address, possibly the category) of the page.
View wiki source for this page without editing.
View/set parent page (used for creating breadcrumbs and structured layout).

AltStyle によって変換されたページ (->オリジナル) /