Yuku free message boards

Forgot
Password?

Display / Replace Usernames
Community Scripts

About Display / Replace Usernames

Author: Chris

Created: Sep 13, 2007

Related Tags: , ,

Description: Display users own usernames and or replace all profile links for a user with custom text

18 kudos

Instructions

The display usernames script is actually a dual purpose script. First it can be used to display the username of whoever is viewing the page, as in a "welcome by username" script. The second use it has is to replace all profile links for a given user with custom text, either board wide or just in the whosonline list.

Displaying a Username

To display a user's own username on your board, you need to add two things to your skin. First, you must add the following to the custom footer

Custom Footer

<username type="display"></username>

On its own, this does not display the username. To display the username, you must add some code where you want the name to appear.

<span class="yukuname"></span>

Wherever you put the code above, the user's name will be replaced. It can be placed any place on the board that accepts HTML, for example, forum names, forum descriptions, posts and skins.

Replacing Usernames

To replace a username with custom text, you need to add the following code to the custom footer

Custom Footer

<username type="replace">
alison : <span style="color: pink">gawdess</span>
joe.reallylongboardname : joe 2
Chris : <b>Chris</b>
</username>

The example above will replace all profile links of alison with gawdess and Chris with Chris. The format of the text inside the <username> tags is one line per user - each line is the username to change, followed by a colon, followed by the text to replace the username with. The replacement text can be text or HTML.

By default usernames right across the board will be replaced. You can set the script to only replace usernames in the whosonline by adding the following option to the code example above

Custom Footer

<username type="replace" whosonline="true">
alison : <span style="color: pink">goddess</span>
joe.reallylongboardname : joe 2
Chris : <b>Chris</b>
</username>

Topic Titles

The script can also be used to replace a username in a topic title. The first step to replacing usernames in topic titles is adding the following code to the custom footer

Custom Footer

<username type="posttitles"></username>

Now when you create a new topic, include the text [you] anywhere in the title and it will be replaced by the current user's name.