Skip to content

Instantly share code, notes, and snippets.

View JarrydLong's full-sized avatar

Jarryd Long JarrydLong

  • Paid Memberships Pro
  • South Africa
  • 14:46 (UTC +02:00)
  • X @jarrydlong
View GitHub Profile
<?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 August 27, 2024 08:46 — 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() ) {
@JarrydLong
JarrydLong / my_pmpro_report_login_wp_visits.php
Created July 26, 2024 08:59 — forked from ideadude/my_pmpro_report_login_wp_visits_only_for_users.php
Change PMPro to only track visits for logged in users.
/**
* Change PMPro to not track visits at all
* Add this code into a custom plugin or code snippet.
*/
function my_pmpro_report_login_wp_visits_only_for_users() {
remove_action( 'wp', 'pmpro_report_login_wp_visits' );
}
add_action( 'init', 'my_pmpro_report_login_wp_visits_only_for_users' );
@JarrydLong
JarrydLong / move-pass-bemail-pmpro.php
Last active July 22, 2024 12:13 — forked from andrewlimaza/move-pass-bemail-pmpro.php
Move Password div below email div jQuery
<?php
/**
* PMPro 3.1+ compatible
* Small jQuery snippet to move password field below email field for Paid Memberships Pro.
* Please note this will affect all instances such as Signup Shortcode, checkout page.
* To only load this on a specific page, please use the 'is_page' WordPress function in a condition.
*/
function my_move_password_below_bemail() {
?>
<script>
<?php //do not copy
/**
* Translates to No Access message strings.
*
* Follow this guide to add this code to your site: https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*
*/
function pmpro_customizations_gettext($translated, $original, $domain) {
@JarrydLong
JarrydLong / my_pmpro_always_show_renew_levels.php
Created July 5, 2024 12:20 — forked from MaryOJob/my_pmpro_always_show_renew_levels.php
Always show renew links for certain PMPro levels if the member already has that level.
<?php // do not copy this line
/*
* This recipe would always show the renew link on the membership account page for the specified levels on line 13
* Add the below code to your PMPro Customizations Plugin:
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
// always show renew links for certain levels if the member already has that level.
//Changes default content
function mypmpro_change_user_pages_content($postdata, $user, $level){
$postdata['post_content'] = 'My Content Here';
return $postdata;
}
add_filter('pmpro_user_page_postdata', 'mypmpro_change_user_pages_content', 10, 3);
@JarrydLong
JarrydLong / pmpro-payment-plan-select-plan-query-param.php
Last active June 28, 2024 13:49 — forked from andrewlimaza/pmpro-payment-plan-select-plan-query-param.php
Select Paid Memberships Pro Payment Plan via query parameter
<?php
/**
* Add &pmpropp_chosen_plan=<<plan_id>> in the URL to preselect the payment plan option.
* Add this code to your site by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmpro_payment_plan_select_url() {
// Only load this on the checkout page.
if ( function_exists('pmpro_is_checkout') && !pmpro_is_checkout() ) {
return;
}