Direct Linking To Your Persona
I have to give credit where credit is due… the guys in Sacramento cooked this up (thanks, Kevin McClusky).
If you’re like me you needed a simple link to get someone to their persona page and you did NOT need the avatar with it.
You need two functions:
// Grabs a cookie based on cookie, and optionally sub value (for cookies like AT)
function grabCookie(cookieName, valueName) {
var cookiearray = document.cookie.split(”; “);
var value = “”;
var returnvalue = “”;
for (var cookie in cookiearray) {
var namevalue = cookiearray[cookie].split(”=”);
if (namevalue[0] == cookieName) value = namevalue[1];
}
if (valueName == “”) return value;
value = unescape(value);
valuearray = value.split(”&”);
for (var valuepair in valuearray) {
var namevalue = valuearray[valuepair].split(”=”);
if (namevalue[0] == valueName) returnvalue = namevalue[1];
}
return returnvalue;
}
// Call this to send a user to their Pluck profile, or to the login page if logged out
function goToPluckProfile() {
userid = grabCookie(”AT”,”u”);
if (userid == “”) {
url = “http://www.sacbee.com/static/insite/slogin.html?;goto=”+location.href;
}
else {
url = “http://www.sacbee.com/personas/?plckUserId=”+userid+”&insiteUserId=”+userid;
}
location.href = url;
}
Link can be used like this:
<a href=”javascript: goToPluckProfile()”>Whatever text you want</a>