Plugin: Social Locker for WordPress
Version: 2.0.0+

If you use the plugin “Add Twitter, Facebook Like, Google plus one Social share” by Being Maverick, the Tweet Button of the Social Locker will not work. The problem is caused by the way how the Being Maverick’s plugin loads the Twtter API.


Part of the Being Maverick’s plugin page on WordPress.org

In order to make both the plugins compatible, you need to alter the file “tf_display.php” of the Being Maverick’s plugin by following the instruction:

1. Open to edit the file wp-content/plugins/twitter-facebook-google-plusone-share/tf_display.php on your server. You will need to replace 3 blocks of code.

Warning! Be very careful, else if you replace something wrong you will not able to open your site and you will need to delete the altered plugin in order to fix it.

2. Find the code block (from the line 275):

if ($option['active_buttons']['twitter']==true) {
$data_count = ($option['twitter_count']) ? 'horizontal' : 'none';
if ($option['twitter_id'] != ''){
$output .= '
	<div style="float:left; width:' .$option['twitter_width']. 'px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
	<a href="http'.(is_ssl()?'s':'').'://twitter.com/share" class="twitter-share-button" data-url="'. $post_link .'"  data-text="'. $post_title . '" data-count="'.$data_count.'" data-via="'. $option['twitter_id'] . '"></a>
	</div>';
} else {
$output .= '
	<div style="float:left; width:' .$option['twitter_width']. 'px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
	<a href="http'.(is_ssl()?'s':'').'://twitter.com/share" class="twitter-share-button" data-url="'. $post_link .'"  data-text="'. $post_title . '" data-count="'.$data_count.'"></a>
	</div>';
}
}

And replace it with:

if ($option['active_buttons']['twitter']==true) {
$data_count = ($option['twitter_count']) ? 'horizontal' : 'none';
if ($option['twitter_id'] != ''){
$output .= '
    <div style="float:left; width:' .$option['twitter_width']. 'px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
    <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?"http":"https";if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document, "script", "twitter-wjs");</script>
    <a href="http'.(is_ssl()?'s':'').'://twitter.com/share" class="twitter-share-button" data-url="'. $post_link .'"  data-text="'. $post_title . '" data-count="'.$data_count.'" data-via="'. $option['twitter_id'] . '"></a>
    </div>';
} else {
$output .= '
    <div style="float:left; width:' .$option['twitter_width']. 'px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
    <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?"http":"https";if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document, "script", "twitter-wjs");</script>
    <a href="http'.(is_ssl()?'s':'').'://twitter.com/share" class="twitter-share-button" data-url="'. $post_link .'"  data-text="'. $post_title . '" data-count="'.$data_count.'"></a>
    </div>';
}
}

3. Find the code block (from the line 219):

if ($option['active_buttons']['twitter']==true) {
if ($option['twitter_id'] != ''){
$output .= '
	<div class="buttons">
	<a href="http'.(is_ssl()?'s':'').'://twitter.com/share" class="twitter-share-button" data-url="'. $post_link .'"  data-text="'. $post_title . '" data-count="vertical" data-via="'. $option['twitter_id'] . '"></a>
	</div>';
} else {
$output .= '
	<div class="buttons">
	<a href="http'.(is_ssl()?'s':'').'://twitter.com/share" class="twitter-share-button" data-url="'. $post_link .'"  data-text="'. $post_title . '" data-count="vertical"></a>
	</div>';
}
}

And replace it with:

if ($option['active_buttons']['twitter']==true) {
if ($option['twitter_id'] != ''){
$output .= '
    <div class="buttons">
    <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?"http":"https";if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document, "script", "twitter-wjs");</script>
    <a href="http'.(is_ssl()?'s':'').'://twitter.com/share" class="twitter-share-button" data-url="'. $post_link .'"  data-text="'. $post_title . '" data-count="vertical" data-via="'. $option['twitter_id'] . '"></a>
    </div>';
} else {
$output .= '
    <div class="buttons">
    <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?"http":"https";if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document, "script", "twitter-wjs");</script>
    <a href="http'.(is_ssl()?'s':'').'://twitter.com/share" class="twitter-share-button" data-url="'. $post_link .'"  data-text="'. $post_title . '" data-count="vertical"></a>
    </div>';
}
}

4. Find the code block (from the line 21):

if ($option['active_buttons']['twitter']==true) {
	wp_enqueue_script('twitter_facebook_share_twitter', 'http'.(is_ssl()?'s':'').'://platform.twitter.com/widgets.js','','',$option['jsload']);
}

And replace it with:

if ($option['active_buttons']['twitter']==true) {
	//wp_enqueue_script('twitter_facebook_share_twitter', 'http'.(is_ssl()?'s':'').'://platform.twitter.com/widgets.js','','',$option['jsload']);
}

4. Save changes.

Now both the plugins have to work correctly. But please keep in mind that after updating the Being Maverick’s plugin, all changes you made will be cancelled and you will need to repeat the steps above.

Check other Social Locker issues

Leave a Reply

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