MyBB Community Forums

Full Version: Found code to hide content until a link is shared! Where do I paste it?!
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm using this code Viral Lock PHP - Like, Google+1 or Tweet to Unlock
I show a preview of it below

What templates do I paste this in and what conditions/code need to be added to hide specifically zip attachments and individual threads in a specific forum?

this hides content until a share link like Google 1+, facebook like, or tweet is initiated then it seamlessly shows the content it's hiding, very useful.
<div style="width:45.9%;margin: 0 auto;text-align: justify;">
<!-- Start: Viral Lock Script to hide premium content -->
<?php	
	/** Incude the Viral Locker Class **/
	require_once( 'viral-lock.class.php' );
	/** New Viral Object **/
	$virallocker = new virallocker_class();
	/** Get the default array **/ 
	$defArr = $virallocker->default_vl_array();
	/** Define the specific page VL fields if you want to **/
	$pageVLArr = array( 
						'URL' => 'your domain',
						'TURL' => 'http://www.twitter.com',
						'GURL' => 'http://www.google.com',
						'FURL' => 'http://www.facebook.com',
						'MESSAGE' => 'Like or Tweet about this page to reveal the content.',
						'MY_ID' => 'myid123',
						'TWEET' => 'Check out this great script!'
					);

blah blah blah... this script is long plus I shouldn't paste all of it to protect the authors rights.

		<!-- Content that needs to be hidden -->

zip attachment or entire thread in a particular forum

        <!-- End of hidden content -->
	<?php
	}
	else 
	{
		echo '
			<script type="text/javascript">
				virallocker_use = true;
			</script>
			<div class="virallocker-box">
				'.$message.'
				<div><a data-related="webtemplates" href="http://twitter.com/share" class="twitter-share-button" data-text="'.$tweet.'" data-url="'.$turl.'" data-count="horizontal" data-lang="en">Tweet</a></div>
				<div><g:plusone size="medium" annotation="inline" callback="virallocker_plusone" href="'.$gurl.'"></g:plusone></div>
				<div><fb:like id="fbLikeButton" href="'.$furl.'" show_faces="false" width="450"></fb:like></div>
			</div>';
	}
/** Include the required fb div and short code handler **/
$virallocker->virallocker_handler( $my_id, $pageVLArr );
?>
<!-- End: Viral Lock Script to hide premium content -->
</div>

Thanks in advance for help!

btw someone should make this as a MyBB plugin mod imo.

well anyone know how to warp this around only zip file attachments? is there a condition string that I could use?
... I'm not sure where to paste this... would someone please help?

Edit:
Doing something like this would piss off a lot of users... so actually... I don't recommend using something like this anymore.