Skip to content

Instantly share code, notes, and snippets.

View MaryOJob's full-sized avatar
🏠
Working remotely 😈

Mary Job MaryOJob

🏠
Working remotely 😈
View GitHub Profile
@strangerstudios
strangerstudios / disable_membership_ending_emails_for_some_levels.php
Created June 30, 2015 11:29
Don't send membership expiring or expired emails for certain levels.
/*
Don't send membership expiring or expired emails for certain levels.
Place this code in your active theme's functions.php or a custom plugin.
*/
function disable_membership_expiring_emails_for_some_levels($recipient, $email)
{
//check template
if($email->template == "membership_expiring" || $email->template == "membership_expired")
{
<?php
require_once( get_template_directory() . esc_attr( "/options_divi.php" ) );
global $options;
$epanel_key = "name";
$epanel_value = "Show RSS Icon";
$custom_options = array (
array( "name" => esc_html__( "Show GitHub Icon", $themename ),
"id" => $shortname."_show_github_icon",
@strangerstudios
strangerstudios / init_disable_pmpro_crons.php
Created November 27, 2015 21:24
Disable PMPro Cron Jobs for Expirations, Expiration Warnings, and Expiring Credit Card Warnings
/*
Note the commented out lines below. This is setup now to only disable the expiration warnings email,
but if you uncomment the other lines it will disable those scripts.
Add this code to your active theme's functions.php or a custom plugin.
*/
function init_disable_pmpro_crons()
{
//remove_action("pmpro_cron_expire_memberships", "pmpro_cron_expire_memberships");
remove_action("pmpro_cron_expiration_warnings", "pmpro_cron_expiration_warnings");
@greathmaster
greathmaster / pmpro-prorate-initial-payment.php
Created December 22, 2015 17:22
Prorate the initial payment. Useful for subscriptions that occur on the first of every month.
function my_pmpro_checkout_level($level)
{
$current_day = date('j');
$days_in_month = date('t');
$level->initial_payment = $level->initial_payment*(($days_in_month - $current_day)/$days_in_month);
return $level;
}
@strangerstudios
strangerstudios / remove_pmpro_footer_link.php
Created February 9, 2016 21:54
Remove the (hidden as an HTML comment) comment that is added to mark a site as using Paid Memberships Pro
@greathmaster
greathmaster / pmpro-sponsored-member-message-shortcode.php
Created June 30, 2016 16:03
Creates a PMPro email shortcode for the sponsored members message to use for greater control over location of message. Use !!sponsored_message!! in email checkout body to display. Removes the automatic insertion of message at the top of the email.
/*Creates a PMPro email shortcode for the sponsored members message to use for greater control over location of message.
Use !!sponsored_message!! in email checkout body to display.
Removes the automatic insertion of message at the top of the email.
*/
function my_sponsored_email_shortcode($pmpro_email)
{
global $wpdb, $pmprosm_sponsored_account_levels;
$user_id = $wpdb->get_var("SELECT ID FROM $wpdb->users WHERE user_email = '" . $pmpro_email->data['user_email'] . "' LIMIT 1");
@andrewlimaza
andrewlimaza / my_logout_go_home.php
Created August 9, 2016 12:59
Redirect users to home page when logging out of WordPress
<?php
//copy lines 5 onwards into your active theme's function.php or custom plugin for code snippets.
function my_logout_go_home(){
wp_redirect( home_url() );
exit();
}
add_action( 'wp_logout', 'my_logout_go_home' );
@eighty20results
eighty20results / pmpro-append-to-end.php
Created October 10, 2016 16:16
When user renews membership we append the duration to their current enddate
<?php
/*
Plugin Name: Paid Memberships Pro: Extend membership by new level duration
Plugin URI: http://www.paidmembershipspro.com/wp/pmpro-customizations/
Description: On change of level, modify the end date to add the new level's time
Version: 1.0
Requires: 4.5.3
Author: Thomas Sjolshagen <thomas@eighty20results.com>
Author URI: http://www.eighty20results.com/thomas-sjolshagen/
License: GPL2
@andrewlimaza
andrewlimaza / member_days_left_pmpro.php
Created November 16, 2016 15:07
Show "Days Left" for Paid Memberships Pro
<?php
//Copy lines 5 onwards into your PMPro Customizations plugin -> https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
/**
* Add days left to members list
*/
function my_pmpro_days_left_members_list_col_header( $theusers )
{
?>
@greathmaster
greathmaster / pmpro-user-pages-enable-comments.php
Created January 7, 2017 00:24
Enables comments for User Pages
//Enables comments for User Pages
function enable_comments_for_user_pages($postdata, $user, $level)
{
$postdata['comment_status'] = 'open';
return $postdata;
}
add_filter('pmpro_user_page_postdata', 'enable_comments_for_user_pages', 10, 3);