Screeny Shot Feb 5, 2014, 8.26.59 PM

SharePress: Setting up your twitter app

These are the steps for getting your twitter app set up to connect SharePress to your twitter account.

  1. Go to http://dev.twitter.com and log in with your twitter account.

  2. After you have logged in, hovering your avatar should show a drop down menu, giving you access to your applications. Also available here https://dev.twitter.com/apps

  3. Click the “Create a new application” button

  4. Fill in your application settings making sure your website url contains the whole url, including the “http://”.

  5. After your app is created, go to the Settings tab. About half way down the page are some radio buttons for setting your application type. Make sure your application type is set to “Read & Write”.

  6. Save your settings by clicking the button at the bottom of the page. After saving, verify that your radio button is correctly set. I’ve noticed sometimes settings need to be saved multiple times before they actually “stick”.

  7. After those settings are saved, go to the details tab. Here you will see the OAuth settings, which hold the consumer key and consumer secret keys that you will need to add to the twitter settings in the SharePress settings page. At the bottom of the page since you are setting this app up for yourself, you can go ahead and create the access token by scrolling to the bottom of the details page, and clicking the “Create my access token” button.

  8. After your access token is generated, verify that the access level says “Read and Write”, take the “Consumer Key”, “Consumer Secret”, “Access Token”, and “Access token secret”, and go enter those into the Twitter setup on SharePress settings page. Then, click the test button on the settings page to do a test tweet and verify that everything is setup properly.

  9. Congratulations that is it.

<

p><

p><

p>If you have any trouble with this, don’t hesitate to email us.

Screeny Shot Feb 1, 2014, 10.27.15 AM

SharePress: Setting up a Facebook App in the new App Dashboard

Yep. They changed it, but the new app dashboard on Facebook is much simpler to operate. Here are the steps you need to follow. (This is assuming you have already set up your facebook dev account.)

  1. Create your new Facebook app. The link is in the upper left hand corner now.

  2. Once you’ve created the app, go to the settings tab, and click the “Add Platform” Button. Select website, from the popup window.

  3. Add the site url and the app domain. Notice the site url includes the full url with the http. And the app domain is just what comes after the www.

  4. Save those changes. Only one more step now

  5. Go to the “Status and Review” tab. Once there, a switch is in the upper right. It will be off. This puts your app in what used to be called “sandbox mode” having it off will result in your app updates only being visible to you. Good for development, but you need to switch it on so that other people can see the posts that SharePress makes to your facebook targets.

  6. Now you get your app id, and app secret, copy them to the SharePress settings, and connect. Make sure you accept all of the permissions. SharePress should now be set up.

  7. Rejoice!

If you have any trouble whatsoever, email us.

IMG_0685

Building Grids with PHP, the easy way

In my years as a developer, I have found myself building grids in html, always with a different number of elements per row. The first few times I solved this problem, I used the modulus (%) divided by the number of elements needed for the row, with an if statement to see if the row container should be closed or not.  This especially sucks if you are doing something recursively, so why not do it in a way that is easy to read, doesn’t require css hacks, and can take advantage of the row-fluid and span classes in bootstrap. Use array_chunk.

//row markup
$row = '
<div class="row-fluid">%s</div>
';
//$posts = whatever you are trying to put in a grid.
$span_divs = array();
foreach ( $posts as $post ) {
  //make a span box
  $span_divs[] = sprintf('
<div class="span4">%s</div>
', $post);
}
//chunk the array of grid items into a number if items
foreach ( array_chunk($span_divs, 3) as $spans ) {
  //pull the chunked array markup into the row markup and write it out
  echo sprintf($row, implode('', $spans));
}

Isn’t that much easier to read?