Skip to content

Instantly share code, notes, and snippets.

View JarrydLong's full-sized avatar

Jarryd Long JarrydLong

  • Paid Memberships Pro
  • South Africa
  • 14:41 (UTC +02:00)
  • X @jarrydlong
View GitHub Profile
<?php //do not copy
/**
* This recipe adds a !!next_payment_date!! variable to your email templates.
* Note that this will only work with recurring levels and not for levels that expire or are once off.
*
* 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/
@JarrydLong
JarrydLong / minh-my_login_change_text_with_gettext.php
Last active December 6, 2024 09:37 — forked from dwanjuki/my_login_change_text_with_gettext.php
Change / Translate login page text strings with the gettext filter
<?php // do not copy this line
/**
* This recipe changes login page text strings with the gettext filter
*
* 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/
*/
@JarrydLong
JarrydLong / pmpro-addon-package-confirmation-url.php
Created November 27, 2024 12:18 — forked from ipokkel/pmpro-addon-package-confirmation-url.php
Redirect membr back to Addon Package purchased after checkout.
<?php
/**
* Redirect member back to Addon Packages page after 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/
*/
<?php //do not copy
/**
* Send a welcome email to the member when creating a new user from the admin dashboard
*
* 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/
*/
<?php //do not copy
function mypmpro_enroll_on_new_course( $course_id, $post, $update ) {
global $wpdb;
if ( ! current_user_can( 'manage_options' ) ) {
return;
}
<?php //do not copy
function mypmpro_remove_map_from_directory_page(){
if( ! empty( $_REQUEST['ps'] ) ){
remove_action( 'pmpro_member_directory_before', 'pmpromm_load_map_directory_page', 10, 2 );
}
}
add_action( 'init', 'mypmpro_remove_map_from_directory_page' );
<?php //do not copy
function mypmpro_ignore_discount_on_specific_products( $discount_price, $lowest_price_level, $price, $product ) {
//check if the product is in the array of product ids to ignore discount
$ignore_discount_on_products = array( 189 );
if ( in_array( $product->get_id(), $ignore_discount_on_products ) ) {
return $price;
} else {
return $discount_price;
@JarrydLong
JarrydLong / generate-username-from-email-pmpro.php
Last active December 2, 2024 14:00 — forked from andrewlimaza/generate-username-from-email-pmpro.php
Generate a username during checkout for user [Paid Memberships Pro]
<?php
/**
* Generate a username at PMPro checkout from email for users.
* Hide your 'username' field using custom CSS.
* Add this code to your site by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmpro_generate_username_at_checkout() {
// Make sure PMPro is installed and the function to get the level at checkout exists.
<?php //do not copy
//add tax info to cost text. this is enabled if the danish checkbox is checked.
function customtax_pmpro_tax($tax, $values, $order){
$tax = round( (float)$values['price'] * 0.20, 2 );
return $tax;
}
<?php //do not copy
function my_pmprorh_init_pause_access() {
// Don't break if Register Helper is not loaded.
if ( ! function_exists( 'pmprorh_add_registration_field' ) ) {
return false;
}
// Bail if not in administrative area.
if ( ! is_admin() ) {