Skip to content

Instantly share code, notes, and snippets.

View JarrydLong's full-sized avatar

Jarryd Long JarrydLong

  • Paid Memberships Pro
  • South Africa
  • 10:32 (UTC +02:00)
  • X @jarrydlong
View GitHub Profile
<?php
/**
* This recipe will add a fee to the initial and recurring value when using Stripe
*
* 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/
*/
function my_pmpro_checkout_level( $level ){
<?php
/**
* We'll add in a check to see which membership level was purchased.
* We can then specify which webhook each level should send data to.
* If it doesn't meet the criteria of our check, we'll use the default
* in the settings page.
* That URL is then added to the $data array
*/
function mypmpro_multiple_zapier_webhooks_after_order( $data, $order, $user_id ){
function disqus_embed($disqus_shortname) {
global $post;
wp_enqueue_script('disqus_embed','http://'.$disqus_shortname.'.disqus.com/embed.js');
echo '<div id="disqus_thread"></div>
<script type="text/javascript">
var disqus_shortname = "'.$disqus_shortname.'";
var disqus_title = "'.$post->post_title.'";
var disqus_url = "'.get_permalink($post->ID).'";
var disqus_identifier = "'.$disqus_shortname.'-'.$post->ID.'";
</script>';
@JarrydLong
JarrydLong / my_pmpro_bp_lockdown_all_bp.php
Created April 6, 2020 06:54 — forked from ideadude/my_pmpro_bp_lockdown_all_bp.php
Allow non-members to view the BuddyPress profile pages even if you are "locking down all of BuddyPress".
/**
* This gist will disable the default behavior in PMPro BuddyPress 5.2.5 or earlier,
* which would redirect users away from the BP profile pages if you had
* "all of BuddyPress" locked down for non-members or members of a specific level.
*
* We might address this in future versions of the Add-On, but for now, you can use
* this gist. Add it to a Code Snippet or a custom plugin.
*/
// First disable the default PMPro BuddyPress behavior.
<?php
function mypmpro_init_remove_filters(){
remove_filter("pmpro_email_body", "pmprosm_pmpro_email_body", 10, 2);
}
add_action( 'init', 'mypmpro_init_remove_filters' );
/*
Add code to confirmation email.
*/
function mypmpro_adjusted_pmpro_email_body($body, $pmpro_email)
<?php
function mypmpro_add_email_fields( $data, $object ){
global $pmprosm_sponsored_account_levels;
$data['sponsored_note'] = "";
$data['seats'] = "";
if( $object->data ){
$membership_id = intval( $object->data['membership_id'] );
<?php
function my_pmpro_levels_array($levels){
global $post;
if( isset( $post->ID ) ){
$specific_pages = array( 10 ); // Which pages should the hidden levels apply to?
if( in_array( $post->ID, $specific_pages ) ){
<?php
function mypmpro_before_change_membership( $level_id, $user_id, $old_levels, $cancel_level ){
global $wpdb;
if( $cancel_level !== null || $level_id == 0 ){
$uses = 1;
$level_id = 1;
$code = "P" . pmpro_getDiscountCode();
@JarrydLong
JarrydLong / my_pmpro_email_checkout_renewal.php
Created April 10, 2020 09:42 — forked from strangerstudios/my_pmpro_email_checkout_renewal.php
Use a custom checkout_renewal.html email template for renewal purchases in Paid Memberships Pro
/*
Use a custom checkout_renewal.html email template for renewals.
Add this code to a custom plugin.
Make sure there is a folder /email/ in the plugin folder.
Add a file /email/checkout_renewal.html in that email folder.
*/
function my_pmpro_email_checkout_renewal($email) {
@JarrydLong
JarrydLong / my_pmprowc_free_shipping.php
Last active January 18, 2023 13:49 — forked from strangerstudios/my_pmprowc_free_shipping.php
Give members of specific level IDs Free Shipping in your WooCommerce store.
/*
* Give members of level 1 or 2 Free Shipping when free shipping is available (must set free shipping as an option in store settings).
* Change $pmprowc_free_shipping_levels = array(1,2); to include level IDs that receive free shipping
*/
function my_pmprowc_free_shipping( $rates, $package ) {
$pmprowc_free_shipping_levels = array( '1', '2' );
$free_shipping_key = "";
foreach( $rates as $key => $val ){
if( strpos( $key, 'free_shipping' ) !== false ){