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 | |
/** | |
* This recipe allows non-members to view specific restricted posts | |
* if they are less than 30 days old. | |
* | |
* To set which posts to unlock set the post id's in the array of | |
* the $posts_to_unlock variable | |
* Change the '-30 Days' below if you'd like to allow access for longer or shorter. | |
* | |
* You can add this recipe to your site by creating a custom plugin |
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 | |
/** | |
* This is just a class for our tests | |
*/ | |
class Foo | |
{ | |
/** | |
* @var foo | |
*/ | |
public $foo = 'foo'; |
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 | |
/** | |
* This recipe stores data when a user checks out for a level. | |
* If that user tries to checkout for the same level, the Subscription Delay is removed. | |
* The user is instead charged for their first subscription payment at checkout. | |
* | |
* You can add this recipe to your site by creating a custom plugin | |
* or using the Code Snippets plugin available for free in the WordPress repository. | |
* Read this companion article for step-by-step directions on either method. | |
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ |
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 | |
/** | |
* This recipe was moved to | |
* https://gist.github.com/ipokkel/b89417247fedc473515e9e980fc34996 | |
*/ |
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
# | |
# Verify captcha | |
$post_data = http_build_query( | |
array( | |
'secret' => CAPTCHA_SECRET, | |
'response' => $_POST['g-recaptcha-response'], | |
'remoteip' => $_SERVER['REMOTE_ADDR'] | |
) | |
); | |
$opts = array('http' => |
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 | |
/* | |
Member Numbers | |
* Change the unique_alphanumeric_member_number function if your member number needs to be in a certain format. | |
* Member numbers are generated when users are registered or when the membership account page is accessed for the first time. | |
*/ | |
// randomize alphabetical string |
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 | |
/** | |
* This recipe will only allow approved users of a certain levels to shop. | |
* Update line 25 with the membership level IDs to allow into the store. | |
* | |
* You can add this recipe to your site by creating a custom plugin | |
* or using the Code Snippets plugin available for free in the WordPress repository. | |
* Read this companion article for step-by-step directions on either method. | |
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ |
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 | |
/** | |
* This recipe adds Website and Biographical Info to the Membership Checkout. | |
* | |
* You can add this recipe to your site by creating a custom plugin | |
* or using the Code Snippets plugin available for free in the WordPress repository. | |
* Read this companion article for step-by-step directions on either method. | |
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ |
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 | |
/** | |
* Dynamically display certain levels on the Membership Levels page based on the current user's active level | |
* This example allows you to show/hide specific levels on the Membership Levels page. | |
*/ | |
function dynamic_pmpro_levels_array( $levels ) { | |
// Get all the levels | |
$levels = pmpro_getAllLevels( false, true ); | |
// remove levels 1, 5, 6, and 7 user has level 1. |
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 | |
/** | |
* On login, redirect to the last post viewed or custom page if no last page available. | |
* Add this code into a custom plugin. | |
* Note that many themes and plugins hook into login_redirect. | |
* Whichever hook has the highest priority will be the last call | |
* on where to redirect. The priority below is set to 20. | |
* Note also that some URLs/pages may note be "posts" | |
* and may not have an ID we can track. |