User:Andrewds1021/UserAvatarLink

This solution was created in response to Thread:1621411.

The purpose of this script is to extend the functionality of User Avatar Finder such that the avatar acts as a link to the corresponding user's page. The script accomplishes this with minimal changes to the required page content. At most, two additional HTML attributes will need to be added to an existing usage of User Avatar Finder.

Configuration
To have this script add a link to an instance of a user's avatar, add the HTML attribute  to the User Avatar Finder element and assign the user's username as the value (see example section).

By default, the script attempts to link to the corresponding user's user page (ex. ). However, the namespace can be changed to point to a different user-specific page (ex.  ). To change the namespace that the script links to for all users, copy and paste the following into the appropriate JS page. Replace  with the actual namespace.

To change the namespace for a specific instance of a user's avatar, add the HTML attribute  to the User Avatar Finder element and assign the desired namespace as the value (see example section).

Example
The following example would create two instances of my avatar; each 100x100px. The first instance would link to my user page and the second to my message wall. If the namespace had not been set in the site JS, then both would link to my user page.

Template:UserAvatar
Note: A simply modified version of the template provided by the User Avatar Finder documentation. 

Limitations/Additional Notes

 * 1) The script does not validate either the username or the namespace. As such, it is the responsibility of the editor to ensure that the provided values will produce a proper link to the intended target.