WikiWealth

03 Mar 2011 07:24 | listusers module wikidot

With the addition of the ListUsers module, Wikidot gave us a very powerful tool. We have the ability to show some custom text to any signed-in user.

listusers.png

Image taken from DreamsTime.com

That text is not only hidden from anonymous visitors to your site - making it very useful in some specific cases - but it also allows you to use the current user's name and ID number in creative ways.

Here's a quick summary of the variables that can be used in the module body, taken directly from the documentation that I linked to in the first paragraph:
Variable Description
number The current user's ID number
title The current user's title or name
name The current user's name in unix format (lowercase, no spaces)

For some of you, the examples that I will go through later in this post will be nothing new - but for others, I hope they help you to improve your website slightly and to give your visitors a more personalised experience!

My next blog post will also be about the ListUsers module, but will cover a slightly more advanced topic that deserves it's own post.


Welcome message

This is useful for displaying on the home page of any website you create, or on the welcome page that your visitors see after becoming a member:

[[module ListUsers users="."]]
Hi, %%title%%! Welcome to //<website name here>//!
[[/module]]

Example:

The %%title%% variable is used where you want the user's name to appear. As a quick reference point, a user named "Bob Jones" would appear like this:

  • %%title%% displays: Bob Jones
  • %%name%% displays: bob-jones

Redirecting a user to their profile page (Pro and Pro+)

If you are a Pro or Pro+ account holder and have the Per-site Profiles feature enabled on one of your websites, you can redirect a user to their profile page or give them a link to edit it.

This is also a particularly useful one to use on any welcome page that new members see.

[[module ListUsers users="."]]
Hi, %%title%%!
Please [/profile:%%number%% visit] or [/profile:%%number%%/edit/true edit] your profile page to get started!
[[/module]]

Example:

The %%title%% variable I have already explained above, but there are a few other things going on here as well.

Cast your eyes to this part of the code: [/profile:%%number%% visit]. This is the first link, and if the user's ID number is 12345, then it will link to the profile:12345 page on your website.

This is particularly useful, as the per-site profiles feature automatically creates a page for each user in the 'profile' category, using their ID number. You can change this behaviour, and therefore would need to modify the link to suit, but those are the default settings.

Next, see this part of the code above: [/profile:%%number%%/edit/true edit]. Once again, this is another link. The main difference here is /edit/true appended to the end of the URL.

This tells Wikidot to navigate to that page, and then to automatically open the page for editing — without the user needing to click the "edit" link first! And this technique works on any link, as long as you are using the single-bracket syntax ([link text]), rather than the triple-bracket syntax ([[[link | text]]] or [[[link]]])!

Redirecting a user to their profile page (Pro Lite and FREE accounts)

If you do not have a Pro or Pro+ account, you are unable to use the per-site profiles feature. One way around this is to manually create a profile page for each user (or allow them to manually create it themselves).

For example, on the welcome page for new members, you can add this code:

[[module ListUsers users="."]]
Hi, %%title%%!
Please start by [/profile:%%name%%/edit/true creating a profile page] for yourself!
[[/module]]

Example:

This code encourages your new members to create a profile page for themselves. Unfortunately, there will always be some that skip this step (for whatever reason), and then you'll have to either create it yourself or remind them to create it.

Let's see how this works. By looking at [/profile:%%name%%/edit/true creating a profile page], I hope you can notice by now that this is - once again - going to generate a link. That link is to the profile:%%name%% page, and because we have appended /edit/true, Wikidot will automatically open up the editing mode for this page.

But what if the page doesn't exist?

This isn't a problem! Wikidot does not care if the page exists or not when you use /edit/true - if it needs to, it will create the page and then open the editing dialog for you. (technically, this is not correct, but to the user it seems to act this way)

As I mentioned above, the link I gave you will take the user to the profile:%%name%% page. For me, that is profile:leiger, and for our friend Bob Jones that is profile:bob-jones.

The important thing to note is that this will create a unique page name for each user! If it didn't, you would have to use the ID number instead as part of the page name, just as the per-site profiles feature does.

Of course, the ID number will also work if you actually prefer it that way. Just change the link to this instead: [/profile:%%number%%/edit/true creating a profile page]. You may also change the category if you wish.


Submit Feedback
Please rate this page based on the quality and helpfulness of the content to you.

Average 0% rating from 0 votes.

You may also be interested in…


OLD COMMENT SYSTEM (0 comments)

Add a New Comment
or Sign in as Wikidot user
(will not be published)
- +

Add a new comment