Social Update

Automatically send updates to Twitter and Facebook when ExpressionEngine entry is published.

Since version 1.0 Social Update is intended to be used as a custom channel field(s) and not a publish tab

Installation

Upload 'social_update' and 'shorteen' folders to your 'third_party' folder. The Social Update addon consists of module, fieldtype and extension - make sure you install all 3 of them.
When you install Social Update, Shorteen will also be installed automatically.

Setting up

Settings

The 'general' settings include entry statuses that will trigger social update (by default, social posts are made only for entries with 'open' status).

You also have to provide the desired service you would like to use for links shortening. For detailed shortening setup, go to Shorteen module settings.

By default, the links are only shortened if the total length of post + link is greater than size allowed by social network. If you want to force links to be always shortened, you have an option to do so. You can also disable URL shortening by setting shortening service to 'none'.

The fieldtype includes dynamic characters counter showing how many characters you can enter for the post. If you need to disable it, you have option to do so.

You can also specify the default URL scheme that your site follows (can be changed on per-custom-field basis). It will be used as default when creating custom field and will also serve as 'fallback' scheme if URL is based on Pages/Structure module and Page URL is not available.

Adding social accounts

To add a social account, select Social network in "Add new app settings" box and click Add. You will be presented with 2 fields for App key and secret (might be named differently for different social networks). After you enther those (the details on obtaining thems are described below) click Authorize. After authorization, you'll be redirected back to settings page, and then you should click Save.

To get your site authorized for Twitter posts, enter your Consumer Key and Consumer Secret for Twitter API. If you don't have API key & secret, you can obtain them here: https://dev.twitter.com/apps/new. The application Access level should be set to "Read and write". Make sure you specify something as callback URI in Twitter app settings. Though it will be overridden, this field should not be empty.

To get your site authorized for Facebook posts, enter your Application ID and Secret Key for Facebook API. If you don't have API App ID & secret, you can obtain them here: http://developers.facebook.com/setup/.

If you administer several pages on Facebook, you are able to choose where you want to post after authorizing.

You can add as many social accounts as you need, but one custom channel field is always used for one account.

If you want to remove an account, clean up API key/secret pair fields and Save.

Adding custom fields

Social Update allows you to use custom channel fields to enter the content of post to be made to social network (and optionally URL).

Custom fields can be used on Publish page in Control Panel and in Safecracker. You can also use them in Matrix.

Be aware that Matrix fields are limited comparing to regular channel fields: they cannot include field to override automatic URL and characters counter.

There are 3 settings for custom field of Social Update type:

Social network - the wall/page to post to (pre-authorized on module settings page)

URL type - select the method that should be used to generate URL attached to the post. If you select any automatic module, make sure the Comment page URL/Channel URL are set in channel preferences.

Show input to override URL - if checked, editors will be able to enter URL to include with the post (will override automatically generated). This might be useful in some cases, e.g. if you include category name within page URL. Note this needs to be full URL, starting with http://

Do not forget to re-save custom field if you re-authorize app or change settings.

Scheduled posting

The post is made when both of following conditions are met: the entry status is in the list of trigger statuses defined in Control Panel and entry date is in the past.

Usually this is right after entry is added, but if you are publishing an entry with entry date in the future, the social post will not be made when entry is added. If will be made only after entry date has been reached.

If you use publishing with entry dates in the future, you'll need to set up CRON job on your server that will fetch the URL mentioned as "Cron Job URL" on module settings page. It will check the entry dates and post social update, if needed.

If you don't have access to CRON, you can still use delayed posting - the check is made each time any entry is edited in Control Panel (so you basically need it only if you want to be sure the post is made at certain time).

Template tags

The Social Update custom fields can be used in templates using pair tags, e.g. {my_custom_field}...{/my_custom_field}

{twitter_post}
{post}
{if posted}
<em>Posted as {remote_user} at {post_date format="%Y-%m-%d %H:%i"}. <a href="{post_link}" target="_blank">Link</a></em>
{if:else}
<em>Not posted yet</em>
{/if}
{/twitter_post}

Conditional variables:

Single variables:

You can also use {exp:social_update:data} tag to display data of all posts to social networks for given entry.

{exp:channel:entries}
{if no_results}
<p>No such entry</p>
{/if}
<h1>{title}</h1>
{exp:social_update:data entry_id="{entry_id}"}
{if no_results}
<p>No posts to social networks</p>
{/if}
{if facebook_post}
<p><a href="{post_link}">Facebook post</a> ({post_date format="%Y-%m-%d"}):
<em>{post_text}</em></p>
{/if}
{if twitter_post}
<p><a href="{post_link}">Tweet</a> ({post_date format="%Y-%m-%d"}):
<em>{post_text}</em></p>
{/if}
{/exp:social_update:data}
{/exp:channel:entries}

Tag parameters:

Conditional variables:

Single variables:

Top of page