Wikidot Design & Development

Customisable pages with member options

Give your users more control with per-page options.

I recently discovered that you can use a ListUsers module inside a ListPages module if the former is on the page you are selecting in the latter. I’m not sure if I have come across this before; chances are I have, but yesterday I actually had an application for it. Custom options for logged-in users.

With the new set-tags buttons, we can now allow registered users to customise a page. This requires a ListUsers module, containing the options for customisation, and iftags, containing the customisations themselves. While on some pages it might be fine to show the customise options all the time, on others (such as a home page) they are an unnecessary distraction that should be hidden unless the user has clicked through to them. Enter my latest discover.

We can have the customise options in a ListUsers module on a separate page, and select them onto the page to be customised with a ListPages module, only showing the module body when a parameter is passed via the URL (as we did here).

I’ll attempt to explain how this is achieved in the code below, but it might be easier to understand by looking at this example I’ve setup on the home page.

Specific Notification System

Customised user messages the Wikidot way.

The premise is simple — you want to show a message to a user based on an action they have just performed. Ordinarily, you would create a new page containing the message, and perhaps some links to lead them elsewhere in the site. While this solution works just fine, it's not as streamlined as being able to show the message on an existing page of your site that the user would probably click through to anyway. Enter my Specific Notification System.

As always, the idea came to me just as I was dozing off to sleep, meaning I had to get up and act on it straight away, else I would never get some shut-eye. The system uses the recently revised limit="0" ListPages parameter to only show a message if a specific string is included in the URL, something we can control when a user completes a certain action.

So, to start things off, we setup a ListPages module with limit="@URL|0" - meaning by default no module body will be shown. Which page you select doesn't really matter, given we're not going to be using anything from the selected page itself. I also added a URL attribute prefix so as not to confuse other modules on the same page.

[[module ListPages category="blog" limit="@URL|0" urlAttrPrefix="i" separate="no"]]
[!-- Define message here --]
[[/module]]
Site design © BMC WebDesign, 2011. All rights reserved. All tutorials on this site are free for commerical use, subject to conditions outlined in the disclaimer.