Skip to content

Instantly share code, notes, and snippets.

View JarrydLong's full-sized avatar

Jarryd Long JarrydLong

  • Paid Memberships Pro
  • South Africa
  • 04:34 (UTC +02:00)
  • X @jarrydlong
View GitHub Profile
@JarrydLong
JarrydLong / add-tax-pmpro-emails.php
Last active March 13, 2024 10:00 — forked from kimwhite/add-tax-pmpro-emails.php
Email Variable Add !!tax!! and !!subtotal!! variable for Paid Memberships Pro email templates
<?php
/**
* Adds an email variable !!tax!! to Paid Memberships Pro emails.
* Only works for email templates that has the !!invoice_id!! variable available.
* Use the Email Templates Admin Editor to add !!tax!! to your email templates.
* Follow this guide to add this code to your site: https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*
* Difficulty: Easy
*/
function my_pmpro_email_variable( $data, $email ) {
@JarrydLong
JarrydLong / my_pmpro_not_logged_in_text_filter.php
Last active January 22, 2024 11:48 — forked from strangerstudios/my_pmpro_not_logged_in_text_filter.php
Filter the teaser message text for a not logged in site visitor
<?php //do not copy
function my_pmpro_not_logged_in_text_filter($text){
$text = '<h4>Account Information</h4><p>Enter account details or, if you’re already a user, <a href="/login?redirect_to=' . urlencode($_SERVER['REQUEST_URI']) . '">login here.</a></p>';
return $text;
}
add_filter("pmpro_not_logged_in_text_filter", "my_pmpro_not_logged_in_text_filter", 5);
@JarrydLong
JarrydLong / pmpro-approvals-login-example.php
Last active January 17, 2024 04:46 — forked from andrewlimaza/pmpro-approvals-login-example.php
Stop non-approved users from logging in.
<?php
/**
* This is an example to stop non-approved user's from logging in using the Approvals Add On For Paid Memberships Pro.
* Add this code below to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmpro_stop_users_logging_in( $user, $password ) {
$user_id = $user->ID;
<?php
/**
* This recipe logs out non-approved members after checkout.
*
* Requires PMPro Approvals - pmpro-approvals
* https://www.paidmembershipspro.com/add-ons/approval-process-membership/
*
* 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.
<?php
/**
* Enables the Multiselect page MMPU provides.
* Add this code to your site by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
add_filter( 'pmprommpu_disable_levels_multiselect_page', '__return_false' );
@JarrydLong
JarrydLong / pmpro-user-fields-default-value.php
Last active December 19, 2023 08:51 — forked from ipokkel/pmpro-user-fields-default-value.php
Set default field values for PMPro User Fields.
<?php
/**
* Set default values for PMPro user fields.
*
* Supported field types: text, textarea, checkbox, radio, select, select2, multiselect, number, and date.
* Can support readonly and hidden fields, however, they will not be editable by the user.
*
* 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.
@JarrydLong
JarrydLong / my_pmpro_prevent_renewal.php
Created November 28, 2023 10:28 — forked from kerijacoby/my_pmpro_prevent_renewal.php
Remove 'Renew' link and prevent checkout if user already has membership level
<?php
// Copy from below here.
add_action('pmpro_is_level_expiring_soon', '__return_false', 10, 2);
// Check if they have a specific level, and prevent them from signing up for a specific level
function my_pmpro_prevent_renewal( $continue ) {
global $pmpro_level;
@JarrydLong
JarrydLong / logout_url_redirect_pmpro.php
Created September 14, 2023 19:01 — forked from dparker1005/logout_url_redirect_pmpro.php
Redirect logout to PMPro login page.
<?php
// Copy from below here...
/*
* Redirect logout to PMPro login page.
*/
function my_logout_url_redirect_pmpro( $logout_url ) {
global $pmpro_pages;
if ( ! empty( $pmpro_pages['login'] ) ) {
@JarrydLong
JarrydLong / my-pmpro-confirmation-message.php
Created August 21, 2023 13:27 — forked from ipokkel/my-pmpro-confirmation-message.php
Create a custom confirmation with a custom message
<?php
/**
* This recipe changes the default confirmation message when a user checks out.
*
*
* 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 / change-email-for-pmpro-locales.php
Created August 1, 2023 14:55 — forked from andrewlimaza/change-email-for-pmpro-locales.php
Translate Email / Change email content based on different locale for PMPro.
<?php
/**
* Adjust email content based on locale used on checkout. Works with WPML plugin.
* This requires a couple of steps to get working.
* 1. Inside your PMPro Customizations Plugin, create a folder called email_fr_FR
* (You may change fr_FR to the locale your site will be serving besides the default locale - create as many folders that you need).
* 2. Copy the email templates from 'wp-content/plugins/paid-memberships-pro/email' and paste them into your email_fr_FR folder created above.
* 3. Manually edit each template with the translation of the emails or adjust the email template to your liking.
* 4. Repeat these steps for each email folder you created depending on the number of locales your site is using.