Skip to content

Instantly share code, notes, and snippets.

@andrewlimaza
andrewlimaza / make_old_posts_free.php
Last active August 31, 2021 10:01 — forked from strangerstudios/make_old_posts_free.php
Make any post older than 18 months available for free with Paid Memberships Pro.
<?php
/**
* Allow non-members to view restricted posts if they are less than 30 days old.
* Change the '-30 Days' below if you'd like to allow access for longer or shorter.
* Adjust $categories array for the categories this should apply to.
* Add this code to your Customizations Plugin by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function open_new_posts_to_non_members($hasaccess, $thepost, $theuser, $post_membership_levels) {
global $wpdb;
<?php if(!defined('ABSPATH')) {die('You are not allowed to call this page directly.');} ?>
<?php do_action('mepr-above-checkout-form', $product->ID); ?>
<div class="mp_wrapper">
<form class="mepr-signup-form mepr-form" method="post" action="<?php echo $_SERVER['REQUEST_URI'].'#mepr_jump'; ?>" enctype="multipart/form-data" novalidate>
<input type="hidden" name="mepr_process_signup_form" value="<?php echo isset($_GET['mepr_process_signup_form']) ? esc_attr($_GET['mepr_process_signup_form']) : 1 ?>" />
<input type="hidden" name="mepr_product_id" value="<?php echo esc_attr($product->ID); ?>" />
<input type="hidden" name="mepr_transaction_id" value="<?php echo isset($_GET['mepr_transaction_id']) ? esc_attr($_GET['mepr_transaction_id']) : ""; ?>" />
@cartpauj
cartpauj / replace-admin-email-password-changed-email-memberpress.php
Created November 10, 2020 20:16
Replace admin email in password change email - MemberPress
<?php
// Replace admin email in password changed email
// We can replace all message or other params like
// ###USERNAME### or ###SITENAME### this way
add_filter('password_change_email', 'replace_admin_email_in_pass_email', 10, 3);
function replace_admin_email_in_pass_email($pass_change_email, $user, $userdata) {
$pass_change_email['message'] = str_replace( '###ADMIN_EMAIL###', 'other_email@your-domain.com', $pass_change_email['message'] );
return $pass_change_email;
}
<?php
/*
Plugin Name: MemberPress Account Page Nav
Plugin URI: http://www.memberpress.com/
Description: Allows developers to add more nav menu links/pages to their members account page
Version: 1.0.0
Author: Caseproof, LLC
Author URI: http://caseproof.com/
Copyright: 2004-2013, Caseproof, LLC
*/