Website Links in block on profile page - need some coding help

I would like to add a list of common social networking site profile links to the profile on one of my sites.   I currently have a single website link by using a PHP block, but I would like to have the following sites (using the profile fields name I gave them:

Google (for Google+ profiles)

Skype

LINKEDIN

FACEBOOK1

TWITTER1

 
I am currently using some code that okweb posted here a while back, and it works well, but I think I will mess this up if I try to do this myself.  Does anyone want to give me a hand on this?   What would be really cool is if we could make it so that it would just skip a blank entry, rather than giving the message "No Website Link Yet" as it does now.
 
global $p_arr;
$Memb = (int)$p_arr[ID];
 
$arr = db_arr("SELECT `Website` FROM `Profiles` WHERE `ID` = $Memb");
$website = $arr[Website];
 
echo "
<table class=form_advanced_table cellspacing=0 cellpadding=0>
";
 
if(strlen($website) > 1)
{
echo "
<tr>
<td class=caption>My website:</td>
<td class=value>
<a href=http://$website target=_blank><b>$website</b></a>
</td></tr>
";
}
 
if(strlen($website) < 1)
{
echo "
<tr>
<td class=caption></td>
<td class=value>
<b>No website link yet</b>
</td></tr>
";
}
 
echo "
</table>
";
 

 

 

Quote · 5 Apr 2012

Rob,

 

Try changing this part:

 

if(strlen($website) < 1)
{
echo "
<tr>
<td class=caption></td>
<td class=value>
<b>No website link yet</b>
</td></tr>
";
}
 
To this:
 
if(strlen($website) < 1)
{
}
BoonEx Certified Host: Zarconia.net - Fully Supported Shared and Dedicated for Dolphin
Quote · 5 Apr 2012

Yeah, @msscott - that worked - thanks.   Here is a profile page from the site I am building that has that: http://american-startups.com/Margaret   - the "profile" fields block at bottom has the same website link, but now it doesn't show as I wanted.

Any chance you - or anybody, could show me how to add a second link to this blog - for example LINKEDIN.

This one has been bugging me for a while, so I appreciate your help. 

Quote · 5 Apr 2012

Rob,

 

Did you want them all in one block? Give this a shot and let me know if it's what you are looking for:

 

global $p_arr;
$Memb = (int)$p_arr[ID];
 
$arr = db_arr("SELECT `Website` FROM `Profiles` WHERE `ID` = $Memb");
$website = $arr[Website];
$linkedin = $arr[LINKEDIN];
$facebook = $arr[FACEBOOK1];
 
echo "
<table class=form_advanced_table cellspacing=0 cellpadding=0>
";
 
if(strlen($website) > 1)
{
echo "
<tr>
<td class=caption>My website:</td>
<td class=value>
<a href=http://$website target=_blank><b>$website</b></a>
</td></tr>
";
}
 
if(strlen($linkedin) > 1)
{
echo "
<tr>
<td class=caption>LinkedIn:</td>
<td class=value>
<a href=http://www.linkedin.com/in/$linkedin target=_blank><b>$linkedin</b></a>
</td></tr>
";
}
 
if(strlen($facebook) > 1)
{
echo "
<tr>
<td class=caption>Facebook:</td>
<td class=value>
<a href=http://www.facebook.com/$facebook target=_blank><b>$facebook</b></a>
</td></tr>
";
}
echo "
</table>
";
BoonEx Certified Host: Zarconia.net - Fully Supported Shared and Dedicated for Dolphin
Quote · 6 Apr 2012

Hi Msscott - thanks for taking a shot at this, but I couldn't get it to work.  I put your code in the "profile links" block but it still just shows the website link.   Here is my profile - the "profile links" field at the bottom still just shows the website link, even though I have the others http://american-startups.com/RobGordon

Yes, I would like them all in one block.  Does it make a difference if they are in two blocks?  Probably does.  I had the websites block as separate from the profile links block.  I wasn't sure about that SELECT statement so I tried adding TWITTER, LINKEDIN, etc to it but got the same results.   Then, strangely, when I moved LINKEDIN to the Website block it did display two sets of links in that block, but that was named  "LINKEDIN" as the actual link, and when you clicked it, it went to linkedin.com/linkedin. 

Obviously I don't know what I am doing.  Can you think of a quick fix for this though?  I think you are close. 

Rob

Quote · 7 Apr 2012

Rob,

 

No problem, glad to help.. even though I'm obviously not that skilled at this either lol. I think I just figured something out, that select statement is just pulling the "website" field from the database..

 

Try changing this:

$arr = db_arr("SELECT `Website` FROM `Profiles` WHERE `ID` = $Memb");
 
to this:
$arr = db_arr("SELECT * FROM `Profiles` WHERE `ID` = $Memb");
 
 
I think that in addition to the changes in my last post should do it..
BoonEx Certified Host: Zarconia.net - Fully Supported Shared and Dedicated for Dolphin
Quote · 7 Apr 2012

Bingo!  Worked like a charm.  Thanks for your help Msscott.   Here is a working link if you want to see it:

http://american-startups.com/RodneyPike

Quote · 7 Apr 2012
 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.