Skip to content

Instantly share code, notes, and snippets.

View JarrydLong's full-sized avatar

Jarryd Long JarrydLong

  • Paid Memberships Pro
  • South Africa
  • 06:22 (UTC +02:00)
  • X @jarrydlong
View GitHub Profile
@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>
@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;
}
@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' );