Pigeon WordPress Plugin

Install Plugin

Install the plugin by downloading the latest zip from our Github repository, and uploading the plugin via WordPress plugin interface.

Download Latest Pigeon WordPress Plugin

Settings

On the Settings > Pigeon page you need to add your supplied Pigeon Subdomain or the demo pigeon domain. Consult with a representative to determine what settings are relevant to your scenario.

Get Pigeon Setting variable array with this function:

get_option( 'wp_pigeon_settings' )

Server Mode

Use the following method to get access to response variables in WordPress templates when in Server Mode.

get_pigeon_value( [response variable] );

Refer to the Response Reference section to see what variables you can use.

For example, if you want to get the user status it would like this:

get_pigeon_value( 'user_status' );

User Status Example

You can use the pigeon-widget-status HTML placeholder in server mode to show user status. For more control you can use the following example that creates the Pigeon status HTML with the WordPress server get_option method.

<?php
// Get values from Pigeon for use below
$pigeon_settings = get_option( 'wp_pigeon_settings' );
$user_status = get_pigeon_value( 'user_status' );
$meter_limit = get_pigeon_value( 'meter_limit' );
$current_meter = get_pigeon_value( 'meter' );
$user_profile = get_pigeon_value("profile");
$credits = get_pigeon_value("credits");
?>

<ul>
<?php if( $credits ){ ?>
    <li class="credits">Credits Left <?php echo $credits; ?></li>
<?php } ?>

<?php if( $meter_limit > 0 && !$user_profile["ip_access"] ){ ?>
    <li class="limit"><?php echo $meter_limit - $current_meter; ?> out of <?php echo $meter_limit; ?> pages left</li>
<?php } ?>

<?php if( $user_status == 1 ){?>
    <?php if($user_profile["ip_access"]){ ?>
    <!-- run ip access code -->
    <li class="group-ip-access">Access provided by <?php echo $user_profile["parent_name"]; ?></li>
    <?php }else{ ?>
    <!-- run true code -->
    <li class="account"><a href="<?php echo $pigeon_settings["pigeon_subdomain"]; ?>/user">My Account</a></li>
    <li class="signout"><a href="<?php echo $pigeon_settings["pigeon_subdomain"]; ?>/action/public/vo/logout">Sign Out</a></li>
    <?php } ?>
<?php }else{ ?>
    <!-- run false code -->
    <li class="signin"><a href="<?php echo $pigeon_settings["pigeon_subdomain"]; ?>">Sign In</a></li>
    <li class="subscribe"><a href="<?php echo $pigeon_settings["pigeon_subdomain"]; ?>">Subscribe</a></li>
<?php } ?>

</ul>

JavaScript Mode

Add wrappers to protect your content directly into the your WordPress templates like single.php, Or use the functions.php to add your wrapper. In JavaScript Mode you can have additional control using the JavaScript callbacks here.

Templates

Scenario 1 - Remove all but first paragraph

This wrapper will look for the first paragraph and keep it, then remove the rest of the wrapped content.

<div class="pigeon-first-p">
	<p>The content of your article. Only this paragraph will show if the visitor is not authorized.</p>
	<p>This paragraph and any subsequent content will be removed if the visitor is not authorized.</p>
	<?php get_the_content(); ?>
</div>

Scenario 2 - Remove all content

This wrapper will all the content within the wrapper.

<div class="pigeon-remove">
	<p>All content with a class of pigeon-remove will be removed if the visitor is not authorized.</p>
	<?php get_the_content(); ?>
</div>

Promotional Wrapper

The following wrapper will show when a person does not have access. You can put your promotional copy and calls to action in there.

<div class="pigeon-context-promotion" style="display:none;">
    <?php // You could show the excerpt here if you are removing all content in Scenario 2 ?>
    <?php get_the_excerpt(); ?>
    <?php 
        // This is where you can promote your content.
        // The link with a class of pigeon-open will open the pigeon modal in JS Mode
    ?>
    <p>This page is available to subscribers. <a href="#" class="pigeon-open">Click here to sign in or get access</a>.</p>
</div>

Facebook WebView Wrapper (optional)

The Facebook mobile app opens shared content in their own web viewer. This web viewer limits the ability for the Pigeon plugin to check the status of a user, thus showing your potentially protected content. And sometimes this web viewer doesn't represent your content correctly. So this block will lead the viewer to open the page in the mobile device's native browser app.

<div class="pigeon-facebook-webview" style="display:none;">
    <p>It looks like you are opening this page from the Facebook App. This article needs to be opened in the browser.</p>
    <p><strong>iOS</strong>: Tap the three dots in the top right, then tap on "Open in Safari".</p>
    <p> <strong>Android</strong>: Tap the Settings icon (it looks like three horizontal lines), then tap App Settings, then toggle the "Open links externally" setting to On (it should turn from gray to blue).</p>
</div>

functions.php

This approach allows you to wrap the content at the function level in WordPress.

Example

add_filter( 'the_content', 'pigeon_content_filter', 20 );

/**
 * @uses is_single()
 */
function pigeon_content_filter( $content )
{
	if (is_single() || is_page()) {
        // Wrap content with secure block and add promotional landing page
		$content = '<div class="pigeon-remove">' . $content . '</div>';

		$content .= '<div class="pigeon-context-promotion" style="display:none;">'
                        . get_the_excerpt()
                        .'<p class="pigeon-cta">'
                            .'This page is available to subscribers. <a href="#" class="pigeon-open">Click here to sign in or get access</a>.'
                        .'</p>'
                    .'</div>';

		$content .= '<div class="pigeon-facebook-webview" style="display:none;">'
		                .'<p>It looks like you are opening this page from the Facebook App. This article needs to be opened in the browser.</p>'
                        .'<p><strong>iOS</strong>: Tap the three dots in the top right, then tap on "Open in Safari".</p>'
                        .'<p> <strong>Android</strong>: Tap the Settings icon (it looks like three horizontal lines), then tap App Settings, then toggle the "Open links externally" setting to On (it should turn from gray to blue).</p>'
                    .'</div>';
	}

	return $content;
}