Template:Sandbox link/doc

Usage
This template, designed mainly for use within user warning templates, produces the sandbox, linking to the shared sandbox, if placed on an IP's talk page or a non-user page, and your sandbox, linking to the recipient's sandbox, if placed on a user's talk page.

If the desired behavior is instead to have the link change based on the status of the viewer rather than the status of the page, If IP may be used instead.