This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: Heartbeat API Demo | |
Plugin URI: http://www.strangerstudios.com/wp/heartbeat-api-demo | |
Description: Minimal example demonstrating the WordPress Heartbeat API being added in WP version 3.6. | |
Version: .1 | |
Author: strangerstudios | |
If logged in as a user and viewing the frontend of your website, | |
every 15 seconds you should see the following in your Javascript console: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Protect a specific page with PMPro | |
Edit the code below to check your specific page slug and membership level ID. | |
Add this code to your active theme's functions.php or a custom plugin. | |
*/ | |
function protect_specific_page() | |
{ | |
//make sure PMPro is active |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: PMPro BuddyPress Customizations | |
Plugin URI: http://www.paidmembershipspro.com/wp/pmpro-buddypress-customizations/ | |
Description: Example code to lock down parts of BuddyPress with PMPro | |
Version: 0.2 | |
Author: Stranger Studios | |
Author URI: http://www.strangerstudios.com | |
*/ | |
/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Redirect away from certain URLs with PMPro. | |
Becareful, the code will redirect any URL *containing* the strings in the $urls array. | |
So e.g., if /not-locked/about/ is public and you have /about/ in the list, it will still be locked down to non-members. | |
*/ | |
//hide some pages in buddypress | |
function pmpro_hide_urls() | |
{ | |
//make sure PMPro is activated | |
if(!function_exists('pmpro_hasMembershipLevel')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Set a maximum number of members allowed to register for a membership level. | |
Add this code to a plugin for PMPro Customizations. | |
Set the "Maximum" for a level on the Memberships > Membership Levels > Edit Level admin page. | |
*/ | |
function pmproml_pmpro_save_membership_level( $level_id) { | |
if( $level_id <= 0 ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function my_pmpro_category_filter($query) | |
{ | |
//get the members-only hidden categories | |
$hidden_cat_ids = $query->query_vars['category__not_in']; | |
//set the members-only category IDs NOT to filter | |
$not_hidden_cat_ids = array('1','10'); | |
//add hidden category IDs back to the query |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//add this line to your active theme's functions.php or a custom plugin | |
add_filter('pmpro_register_redirect', '__return_false'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
global $pmpro_pages, $pmpro_level; | |
if(is_page($pmpro_pages['levels'])) { | |
//on the pricing/levels page | |
} | |
if(is_page($pmpro_pages['checkout'])) { | |
//on the checkout page | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function my_pmpro_not_logged_in_text_filter($text) | |
{ | |
global $post; | |
$access = pmpro_has_membership_access($post->ID, NULL, true); | |
$level_ids = $access[1]; | |
if(is_array($level_ids) && in_array(2, $level_ids)) | |
{ | |
$text = '<h4>This page requires a Bronze Account or higher.</h4><p>Already have an account? <a href="/login?redirect_to=' . urlencode($_SERVER['REQUEST_URI']) . '">Login Now »</a></p><p>New to this site? <a href="/membership-checkout/?level=2">Register Now »</a></p>'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Default some PMPro fields based on other user meta. | |
Add this code to your active theme's functions.php or a custom plugin. | |
*/ | |
function get_user_metadata_pmpro_prepop($value, $user_id, $meta_key, $single) | |
{ | |
//fields to sync, make sure there are no loops in this | |
$sync_fields = array( | |
"pmpro_bfirstname" => "first_name", |
NewerOlder