Skip to content

Instantly share code, notes, and snippets.

View LMNTL's full-sized avatar

Jessica Thomas LMNTL

  • Chicago, IL
View GitHub Profile
@LMNTL
LMNTL / pmprosm_discount_code.php
Created June 3, 2019 19:54
Example of using the 'discount_code' attribute to change expiration date for PMPro Sponsored Members
/*
Override the discount code given to sponsored members.
This recipe makes any sponsored members with level 2 expire in 2 days.
The 'discount_code' array supports the following attributes:
code_id, level_id, initial_payment, billing_amount, cycle_number, cycle_period, billing_limit,
trial_amount, trial_limit, expiration_number, expiration_period
Make sure that strings in the _period values are wrapped in single quotes, e.g. 'expiration_period' => "'Year'"
*/
@LMNTL
LMNTL / pmprosm_additional_account_pages.php
Created May 31, 2019 02:53
Show sponsored seats on the main account page in PMPro settings and other selected pages that contain the [pmpro_account] shortcode.
/*
Show sponsored seats on the account page in PMPro settings and on other selected pages.
Useful for multi-language sites that have different account pages per language.
Requires PMPro and Sponsored Seats Add On.
*/
function my_pmprosm_the_content_account_page($content)
{
global $post, $pmpro_pages, $current_user, $wpdb;
/*
/*
Restrict membership access based on parent category
*/
function category_restrictions($hasaccess, $mypost, $myuser, $post_membership_levels)
{
global $post, $current_user;
$categories = wp_get_post_categories($mypost->ID);
$restrict = false;
@LMNTL
LMNTL / pay-by-check-no-access.php
Last active July 26, 2019 20:52 — forked from andrewlimaza/pay-by-check-no-access.php
Force users with pending orders from Pay By Check Add On and PMPro to not have access to any member content.
<?php
/**
* This checks to see if the user has a 'pending' check order and will deny access whever member content is called.
* Add this code below to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function pmpro_deny_if_user_is_pending( $hasaccess, $post, $user, $levels ) {
$order = new MemberOrder();
$order->getLastMemberOrder( $user->ID, array( 'pending', '', 'check' ) );
@LMNTL
LMNTL / my_pmpro_email_membership_cost
Last active May 24, 2019 23:43
// change !!membership_cost!! email variable to refer to current level cost, only when checking out with paypal
// change !!membership_cost!! email variable to refer to current level cost, only when checking out with paypal
function my_pmpro_email_membership_cost( $data, $email ) {
global $pmpro_levels;
// are we on the paypal ipnhandler page? if not, stop
if( !isset( $_SERVER["REQUEST_URI"] ) || ( strpos( $_SERVER["REQUEST_URI"], "/admin-ajax.php?action=ipnhandler" ) === false ))
return $data;
$level_id = $data['membership_id'];
$current_level = $pmpro_levels[$level_id];
$data['membership_cost'] = pmpro_getLevelCost( $current_level );
@LMNTL
LMNTL / my_pmproec_pmpro_after_change_membership_level.php
Created May 22, 2019 18:35 — forked from messica/my_pmproec_pmpro_after_change_membership_level.php
Make PMPro MailChimp compatible with PMPro Email Confirmation
<?php
/**
* Make PMPro MailChimp compatible with PMPro Email Confirmation
*/
// Don't subscribe to MailChimp if user is not validated.
function my_pmproec_pmpro_after_change_membership_level($level_id, $user_id) {
if( function_exists('pmproec_isEmailConfirmationLevel') && pmproec_isEmailConfirmationLevel($level_id) ) {
$validation_key = get_user_meta($user_id, "pmpro_email_confirmation_key", true);
@LMNTL
LMNTL / my_pmpro_change_email_link_styling.php
Last active May 21, 2019 22:03
customize the HTML/styling of links in PMPro-generated emails
@LMNTL
LMNTL / my_pmpro_always_show_renew_levels.php
Created May 20, 2019 20:33
Always show renew links for certain PMPro levels if the member already has that level.
// always show renew links for certain levels if the member already has that level.
function my_pmpro_always_show_renew_levels( $show, $level ){
/*--- change this line to the levels you want to show a renew link---*/
$show_levels = array( 1, 2 );
if( in_array( $level->id, $show_levels ) ) {
$show = true;
}
@LMNTL
LMNTL / pmpro_gettext_membership_options.php
Last active November 7, 2019 09:56
Hide "View all Membership Options" link on PMPro Account page
function my_gettext_pmpro_hide_view_membership_options($translated_text, $text, $domain)
{
if($domain == "paid-memberships-pro" && $text == "View all Membership Options" )
$translated_text = "";
return $translated_text;
}
add_filter('gettext', 'my_gettext_pmpro_hide_view_membership_options', 10, 3);
@LMNTL
LMNTL / my_pmpro_js_on_submit.php
Created May 17, 2019 17:21
example of adding Javascript to run after the checkout button is clicked with PMPro
// example of adding Javascript to run after the checkout button is clicked
function my_pmpro_js_on_submit() {
?>
<script>
jQuery(document).ready( function(){
jQuery("#pmpro_form").submit( function(){
alert("hello world!");
});
});
</script>