Sign Up! Login: Password: New User? Forgot? Support
Code 
 
 
Forums 
Forums : Roster > Roster Links
Mottie (SuperAdmin) 4/8/2009 6:20 AM EST : Roster Links
ACK!
Mottie
Posts: 3883

0
Like

0
Dislike

Roster Links

GuildPortal admin site link to the original post

This script is specifically for "Special Interest (None)" type guilds. They usually have members from many different games and the roster page is a little different. When you add a character to the roster, you can "Add a Character" which allows you to enter the character name and a "Home Page URL"



This resulted in a "link" that would take you to that site.



This script enables you to enter several links into the box above (when you add a character) which is then coverted into clickable icons.



Sadly, the input box is limited to 125 characters but you could possibly (I haven't tested this) add more using the "Characters & Settings" from the top bar, clicking the "Edit" button next to the name, then clicking on "Game Stats". You'll see the "Home Page URL" box again. Add or modify your links here.

The Code - Add this to a Free Form Text/HTML box on your Roster page
<script type="text/javascript">
$(document).ready(function(){
/********************************
This script replaces Home Page URL "link" in the Special Interest (none) type of guild roster
formats accepted:
- http://www.myspace.com/kiddkraddick,http://www.facebook.com/profile.php?id=48129544153,http://twitter.com/KiddKraddick
- ms:kiddkraddick,fb:48129544153,tw:KiddKraddick
*********************************/
 var newTitle = "Contact Links";

 // Don't Change Anything Below
 // **********************
 $("table[id*='grdRoster']").find("a:contains('Home Page URL')").html(newTitle);
 $("table[id*='grdRoster']").find("a:contains('link')").each(function(){
  var lnk = $(this).attr('href').split(',');
  for (j=0;j<lnk.length;j++){
   var img = " <img width='16' src='http://i201.photobucket.com/albums/aa236/Mottie1/testsite/icons/";
   var tmp = unAbbrev(lnk[j]);
   var icon = "link.gif'>";
   if (tmp.match('myspace')){ icon = "myspace.gif'>" }
   if (tmp.match('facebook')){ icon = "facebook.gif'>" }
   if (tmp.match('twitter')){ icon = "twitter.gif'>" }
   if (j==0) {
    $(this).attr('href',tmp).html(img+icon)
   } else {
    $(this).parent().append("<a href='" + tmp + "'>" + img + icon + "</a>");
   }
  }
 })
 function unAbbrev(t){
  var t2 = t.split(':');
  if (t2[0]=="ms") return "http://www.myspace.com/" + t2[1];
  if (t2[0]=="fb") return "http://www.facebook.com/profile.php?id=" + t2[1];
  if (t2[0]=="tw") return "http://twitter.com/" + t2[1];
  return t;
 }
})
</script>
Using the Code
  • You can replace the column header "Home Page URL" with whatever you want by modifying the text in red.

  • To make the links work, just add the URLs separated by a comma. I used "Kidd Kraddick" who is a radio celebrity as an example.

    http://www.myspace.com/kiddkraddick,http://www.facebook.com/profile.php?id=48129544153,http://twitter.com/KiddKraddick

    Notice there are no spaces and I used the full URL for each site. You may have to extract out this shorter versions of the links as they can get quite long.

  • If you start to run out of space, I've included a way to abbreviate the above links. So far it only works with myspace, facebook and twitter. I'll add more if you guys just tell me which others ones to add.

     Full Link Abbreviated Link 
     http://www.myspace.com/kiddkraddick ms:kiddkraddick
     http://www.facebook.com/profile.php?id=48129544153 fb:48129544153
     http://twitter.com/KiddKraddick tw:KiddKraddick

    So an abbreviated version of the line above (with full URLs) would be:

    ms:kiddkraddick,fb:48129544153,tw:KiddKraddick

    and of course you can mix and match the URLs...

    http://www.myspace.com/kiddkraddick,fb:48129544153,http://guildportal.com/Guild.aspx?GuildID=258012&TabID=2168223
Characters: Mottie Motty Mortie Ooshiny Mot Fudgems
TopBottom

 
 
Key 
New posts No new posts
New posts ( popular ) No new posts ( popular )
New posts ( sticky ) No new posts ( sticky )
New posts ( locked ) No new posts ( locked )
 
 
Who's Online 
There are   members online.
 
 
So-and-so has logged on!
%title%
%message%