“Viral Lock” Documentation by “WESMASHED.IT” v1.3


“Viral Lock”

Created: 30/01/2012
1.1 Released: 16/02-2012
1.2 Released: 16/03-2012
1.3 Released: 24/04-2012

By: WESMASHED.IT

There isn't a person anywhere who isn't capable of doing more than he thinks he can.
- Henry Ford


Check out the Video walkthrough here!

Table of Contents

  1. Upload files
  2. Using the plugin
  3. Cookies
  4. Customizing the code

A) Upload files - top

The first thing you need to do is upload the plugin to your server.

Install via WordPress admin dashboard
1) The easiest way to install Viral Lock is to login to your WordPress admin -> Click: Plugins -> Add new -> Upload.

Upload

2) Find the ZIP file of the Plugin in the "Plugin" folder of your download.

3) Click "Install now".

4) When it has been installed click "Activate Plugin".

Activate

Install via FTP:
1) Upload the "viral-lock" folder which you can find in the plugin folder to "/wp-content/plugins/" on your server.

2) Login to your WordPress admin and go to Plugins->Installed plugins.

3) Activate the plugin by clicking activeate under "Viral Lock".


B) Using the plugin - top

Once the plugin has been installed you can now start protecting your content.

You can use the lock icon in your WordPress editor or add the shortcodes manually.

Here is how the shortcode works:

[viral-lock]Content here[/viral-lock] - This protects the content between the tags, displays the default "share to unlock" message and links to the current page.

[viral-lock message="Like or share to unlock."]Content here[/viral-lock] - This protects the content between the tags, displays a custom message "share to unlock" message and links to the current page.

[viral-lock message="Like or share to unlock." url="http://wesmashed.it/"]Content here[/viral-lock] - This protects the content between the tags, displays a custom message "share to unlock" message and shares a custom link "http://wesmashed.it".

New in version 1.1

We have added a new paramter that gives you the option to define the message that is sent to Twitter. The new paramter is: tweet="Check out this link". Example usage:

[viral-lock message="Like or share to unlock." url="http://wesmashed.it/" tweet="Check out this cool site:"]Content here[/viral-lock] - This protects the content between the tags, displays a custom message "share to unlock" message, shares a custom link "http://wesmashed.it" and replaces the default twitter message (page title) with "Check out this cool site:". The twitter message would look like this "Check out this cool site: http://wesmashed.it"

New in version 1.2

A requested feature by some of our buyers was the possibility to unlock all locks or several locks with just one like or share. Because of this we have now made a slightly modified version of Viral Lock that uses a shortcode parameter "my_id" to identify the different locks. This means that if you use the same id for several locks then all of them will be unlocked. If you decide to use this version then you should always define an id for your locks.

Here is how you use the new paramter:

[viral-lock message="Like or share to unlock." url="http://wesmashed.it/" tweet="Check out this cool site:" my_id="1234"]Content here[/viral-lock]

The my_id can be any kind of number or text string but avoid spaces and special characters.

New in version 1.3

As requested by our buyers we have added the possbility to set indidivudal URL's for the different social networks. We have also merged the two version of the plugin where one used the post ID and the other used the my_id paramter to separate different locks (read above). Version 1.3 will default to use the post ID but if you use the my_id paramter then that will override the Post ID.

To set a URL for a specific social network use the following shortcode paramters:

gurl = Google URL
furl = Facebook URL
turl = Twitter URL

Using any of these will override the one set with the "url" paramter. You can combine the paramters to use individual links for some social networks and use the URL paramter for others. If none of the paramters are entered then the plugin will use the current page URL.

Example usage:

[viral-lock message="Like or share to unlock." gurl="http://wesmashed.it/" turl="http://wesmashed.it/facebook" furl="http://wesmashed.it/twitter" tweet="Check out this cool site:"]Content here[/viral-lock]

Please read "New in version 1.2" for usage instructions for the my_id paramter.

Final notes: This update changes both the CSS class used and updates the cookie handling. If you have styled an older version of the plugin then you will have to change the styles to style the new class "virallock-box". The updated cookie handling will cause locks used in older versions to once again become locked as the cookie name has changed.

If you wan't to keep your locks open/closed from an older version then you need to find and replace two lines in viral-lock.php. Replace the lines with the ones from your current version of Viral Lock.

Find and replace line 11:

define('VIRALLOCKER_COOKIEVALUE', '0001');

And line 60:

setcookie("virallocker_".$post_id, VIRALLOCKER_COOKIEVALUE, time()+3600*24*90, "/");


C) Cookies - top

Please note that this plugin tries to place a cookie on the users computer so that the user doesen't have to like or share the post again to view the content. In some countries you have to inform your visitors that your site uses cookies.

You can read more about cookies here:

http://en.wikipedia.org/wiki/HTTP_cookie


You can make some simple changes in the plugin code if you wan't to customize the plugin more then you can do with the shortcodes.

Change the cookie value
It is a good idea (but not required) to change the unique cookie value to something thats actually unique. One line 9 of viral-lock.php you will find the following.

define('VIRALLOCKER_COOKIEVALUE', '0001');

You can replace 0001 by any numbers. If you use this on multiple sites its a good idea to give all sites unique cookie values.

Change the cookie time
The default time that the cookie is valid for is 90 days. You can change this editing line 60 of viral-lock.php.

setcookie("sociallocker_".$post_id, VIRALLOCKER_COOKIEVALUE, time()+3600*24*90, "/");

Change 90 for the amount of days you would like the cookie to be valid for.

Change the default message

Edit line 10 of viral-lock.php

define('SOCIALLOCKER_DEFAULTMESSAGE', 'Like or Tweet this page to reveal the content.');

Change the bold message to the default message that you would like to use.

Change the language of the Facebook like button:

Edit line 15 of viral-lock.php

wp_register_script('facebooksdk', 'http://connect.facebook.net/en_US/all.js#xfbml=1');

Replace en_US with the ISO code of your country. Example: For germany it would be de_DE.

Change the language of the Tweet button:

Edit line 130 of viral-lock.php

<div><a data-related="webtemplates" href="http://twitter.com/share" class="twitter-share-button" data-text="'.$tweet.'" data-url="'.$my_url.'" data-count="horizontal" data-lang="en">Tweet</a></div>

Replace data-lang="en" with your own language code. Example: data-lang="de" for german. Then on the same line replace "Tweet" with the translated version.

Change the langauge of the Google+ button:

Add this somewhere in your themes header.php file (wp-content/your-theme/header.php).

<script type="text/javascript">
window.___gcfg = {
lang: 'zh-CN'
};(function() {
var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
po.src = 'https://apis.google.com/js/plusone.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
})();
</script>

Replace zh-CN with your own language and country ISO codes.


 

KIND REGARDS
WESMASHED.IT

Go To Table of Contents