How to use S3Media Linksafe – Lite

Best follow the tabs below in the order of appearance for a smooth process. If you never setup your AWS bucket/distribution before, please read this pdf first: Setup-private-download-aws-console

[tab name='Installation']

Install like any other plugin on WordPress:

  1. Go to Plugins > Add New
  2. Select Upload
  3. Click the Browse button and locate the zip you downloaded.
  4. Click Install Now.
  5. After installation, click Activate plugin.

After install, you find the link to S3Media LinkSafe Lite on the lefthand pane in your admin panel of WordPress:

This will be used to set the Access keys and default options before you use the Link Wizard in the text editor of your posts/pages.

Back to the tabs >>

[/tab]

[tab name='Set the options']

Click the S3Media LinkSafe Lite link in the lefthand pane of your admin panel to set your AWS keys and default settings. Here everything is filled in already, but we show you step by step how to do this:

All fields have a convenient hint button that gives a short explanation how to fill in the field correctly:

In the the first part of the options, you need to fill in the Access keys and Keypairs (the latter only if you plan to download distributions):

Getting the Access Keys

After you sign up for AWS, you must create access keys for the account. You can retrieve the access key ID from the Security Credentials page, but you cannot retrieve the secret access key. If the secret access key is lost or forgotten, you need to create new access keys. Go to the Security Credentials page and sign in:

aws-security-credentials

Use your login and password to login. A new page opens with a popup box:

Continue AWS security credentials

Select Continue to Security Credentials.

In the Access Keys section, click Create New Access Key:

Create AWS access keys
When you have done that, save the Access Keys by downloading them:

download access keys

Open the file and go to the window tab that shows the S3Media Stream – options, then paste that key into the S3 Access Key – field as shown below.
Then copy the Secret Key and paste it into the S3 Secret Key – field of the S3Media Stream Options. You recognize the secret key easily since it is much longer then the access key:

You can do the same with the Key Pairs of CloudFront. If you have not signed up yet with CloudFront, sign up here logging it with your existing account and follow the instructions, it is fixed in a minute.
NOTE:
You do not need CloudFront if you do not plan to work with download distributions but it is a good idea for an international audience.

Getting the Keypairs

To set the Key Pairs, click on the tab CloudFront Key Pairs and click on Create New Key Pair:

create keypair ID

You will be asked to safe the Private Key File:

create-keypair-ID2

Download the file to a safe place. Then copy the public key:

copy-keypair-ID

and paste it in the CloudFront Key Pair ID field of the S3Media LinkSafe options.
NOTE: Do not download the Public Key.  It serves no purpose, just copy the string above that link.

Now, open the private key file. The file typically has a name like this: pk-xxxxxx.pem where xxxxx is the name of the public key. In the file you will see the private key displayed. Now, copy everything you see in the file, including the comments and paste it into the CloudFront Private Keyfile field. It should now look more or less like this:

If you forget to comments, it will not work. Make also sure that there are no spaces after each line.

The default options

To make it easy, we provided a set of default options in case you always want to use the same settings:

The Download distribution/S3 bucket field can have the following options:
Either fill in the original name of the bucket, like mybucket
or a download distribution, like https://dhkhhkhkh.cloudfront.net

You can find the correct names in the AWS console. For a bucket, login to the AWS console:
https://console.aws.amazon.com/console/

For the bucket name, click on the S3 Service. There you find a list of your existing buckets:

Copy the name and paste in in the Download distribution/S3 bucket field.

For a download distribution, click on the Cloudfront service:

This will show a list with distributions:

Select the download distribution name in the Domain Name Column and copy it.
Unfortunately, it is not possible to select and copy the full address for some unfathomable reason. So, you need do construct it like this: http://d5djz3p829xdh.cloudfront.net
In your situation, the link will be different, but download distributions names always start with a 'd' while streaming distributions start with an 's'. Do not use a streaming distriubtion. It won't work.
Paste your link in the Download distribution/S3 bucket field. We are done with the AWS console now.

URL expires (in seconds)

Here you set the expiring time for your links. This can be as long and as short as you want. On a page with little content, you can get away with 10 minutes or less (600), but keep in mind that visitors are sometimes distracted, so a time 30 minutes is in most cases better (3600).
If a link is expired before the visitor clicks, he/she gets an access denied error and needs to refresh the page to generate a new link.
NOTE: the expiring time is unrelated to the download time. Once the visitor clicks on a link, the file starts to download and when this is a big file, it will keep downloading even if the link expires in the meantime.

Plugin deactivation

If you want to keep the options stored in the databse when you deactivate the plugin for some reason, leave this option set to Keep data upon deactivation.
This is useful if you happen to have compatibility problems with another plugin and want to deactivate this plugin to check whether it has anytihng to do with it. Afterwards, you can activate it again while keeping all keys and default intact.

When you are ready, click the Save button. Now we can place our first link.
Back to the tabs >>

[/tab]

[tab name='Inserting a link']

Inserting protected links in posts an pages

Create post or open an existing one. place your cursor where you want the protected link to appear. This can be within text or on its own line.
Then click the Download Link button above the text editor:

If you don't see that button, your are probably working with the Gutenberg editor, which is not supported. You can either work with the Classic editor or use write the shortcode yourself, using the examples further down the page. We continue here presuming you have access to this button.
Once you click it, it opens the Link Wizard:

S3Media LInkSafe wizard

Link Title

This is where you fill in the hyperlink name. In our example, we set this to Webinar - how to market your product.
On the front end of your site you would get this: Webinar - how to market your product

Image

This is an optional field. When you fill this in, the plugin produces an image as a hyperlink instead of a regular hyperlink. Give here the full path to the image, like: https://mydomain.com/myimage.jpg.
The image can reside on your site, on AWS or any other domain, as long as you have permission to use it.  For instance, linking to wp-content/uploads/myimage.jpg from another website won't work because permission is automatically restricted to that domain only.
It is possible to influence image size, border, etc via the css class .s3medialinksafe.
Note: This option may give a strange result if you use within a text block, unless you insert a break.

Download file

If you do not know the name of the file anymore, you can look it up in the AWS console by going to the S3 service pane and in the list of buckets, click the bucket that contains your file:

Then you get the list of items in your bucket:

Unfortunately, the copy function in the AWS console does not work on all browsers. You have to click on the file name(1) and then select the Properties(2)button to be able to copy the name in the right hand pane:

Then you get can copy the name from the Properties pane:

Paste this in the Download file field.
NOTE: if you placed files in a folder, the file name must be preceded by the folder name. like this: myfolder/myfile.pdf
It is actually easier to work with a list you in a text document you prepared upfront, or you could download a client application to manage your AWS files instead of using the rather cumbersome AWS console:

For Windows, you can download CloudBerry Explorer and for Mac there is Cyberduck.
Cyberduck exists for Windows also but we recommend CloudBerry Explorer as it is a better choice, alas not available on Mac.  Those applications are also better suited to upload files, create folders and buckets.

Download distribution/S3bucket

If you filled this in the default settings already, you can leave this as is or you can override the default if you like.

URL expires (seconds)

Expressed in seconds. If you filled this in the default settings already, you can leave this as is or you can override the default if you like.

Select target

Determines how the link behaves. Either in the same window or a new window. It is best to set this to new window for all file types that can be opened in the browser itself, like PDF, images, text files, xml, etc...

When you are done, click Insert Link. The short code is now inserted in the text editor:

The short code generating the download link.

Working with default settings keeps the shortcode nice and short.  When you select the short code, you can format it to stand out if you like. Making it bold or give it another color.

And this is how it looks at the front end without any formatting. When the user clicks on it, the file can be downloaded or if it is a file type supported by the browser, open it directly in the browser itself, like a PDF or a JPEG, for example.

See the demo site to view a couple of possible options.
Back to the tabs >>

[/tab]

[tab name='Shortcode']

Working with the shortcode

The shortcode is quite easy to adapt, therefore after you inserted the first shortcode via the Link Wizard, then use that example to quickly insert a range of links in your pages and posts.

There are 5 attributes when you do not use the default options but override them:

  1. title (any regular alpha and nummerical characters)
  2. file (case sensitive name of the file you link to)
  3. path (bucket or download distribution)
  4. expireseconds (only nummercial value )
  5. target (either _blank or _parent)

For example:
Adoptie.
Although the shortcode shows up here on two lines, do not use new lines or it won't work.

If you filled in all the default options, the shortcode only needs to contains 2 attributes:

  1. title
  2. file

For example:
Adoptie

NOTE: Sometimes, links to download distributions turn into real links in the editor. In that case select the link and use the break link icon.

You can wrap the shortcode in html tags like h1, h2, h3, etc... or use a div with a class or inline style to influence the look. See the demo site to view a couple of possible options.

Back to the tabs >>

[/tab]

[end_tabset]

12 Comments on “How to use S3Media Linksafe – Lite

  1. Where’s the download link for this? I do’t see 1 anywhere.

    • I’m sorry, we just updated the site and forgot to adapt the link. It’s back on the page now. Thanks for reporting this.

  2. I have set up everything in Amazon S3 and set up the plugin on my site. But when I try to add a link to a post and I click on “insert link”, th page just goes to the “All POsts” page – it does not add the link or anything.

    Can this be fixed?

  3. I am building a responsive website which is not Joomla or WordPress. I would like to use S3Media. Would this be at all possible without using Joomla or WordPress? Also, meanwhile I am reviewing your website for more details but would be grateful if you could respond to email?

    • Hi Jerome,
      Sorry, it is only available for WordPress and Joomla. The Joomla version can be found on http://www.footprintaddons.com.
      However, it is possible to create a custom script. Contact us if you are interested in that.

  4. after upgrading to WP 4.7 the lite plugin causes an error

    Warning: call_user_func_array() expects parameter 1 to be a valid callback, no array or string given in /home/globalwelcome/public_html/wp-includes/class-wp-hook.php on line 298

    Dont know if you can suggest some code edit to repair so we can test it out and see if it will work for us?

    • Hi Dan,
      This is the problem caused by changes in a function of WordPress 4.7.
      Monday 12 December 2016 we will upload the new version with the issue resolved. Thanks for reporting the problem. 🙂

  5. That’s brilliant, thanks! Glad to report it’s installed and working perfectly.

Leave a Reply

Your email address will not be published. Required fields are marked *