Adding a Twitter followers tile wall to Sugar

sugarcrmdevelopers —  April 27, 2012

So, for the second part of our series in what’s possible when integrating social media with Sugar. A very cosmetic, but useful way in which to show a customer’s Twitter followers is to build face pile.

A face pile is simply all of the Twitter photos of a specific Twitter account shown in a row.

So, to begin, let’s start with the PHP code needed to make this work. You’ll need Curl to be installed on the server you drop this script onto. The code is downloadable from here, but you can see it in the screenshot below:

First things first, add your new field. We’ll be making use of the Twitter field we added in the previous post. This field needs to be added as follows:

Module: Contacts
Data Type: IFrame
Field Name: facepile
Display Label: Followers Photos / List
Generate URL: Checked
Default Value: http://www.yourwebsitelocation.com?q={twittername_c}
Max Size: 255
IFrame Height: 150

Now check Dependent as we only want this new facepile field to appear if there is a value in twittername. Make the formula as follows:

not(equal($twittername_c,””))

We need to make sure we’re passing the Twitter ID as a parameter called ‘q’ to our PHP script. We’ve specified the location of where my HTML file will be uploaded to. This is outside of SugarCRM.

Next add it to the layout. I’ve added mine to the top panel on the EditView:

and added it to the DetailView as well:

So finally, our new facepile looks like this: