Skip to content

Instantly share code, notes, and snippets.

Avatar

Jarryd Long JarrydLong

  • Paid Memberships Pro
  • South Africa
  • Twitter @jarrydlong
View GitHub Profile
View mypmpro-remove-approvals-query-directory.php
<?php //do not copy
/**
* This recipe will remove the query that filters users from the directory when using
* the Approvals Add On.
*
* 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/
View mypmpro-remove-sm-pbc.php
<?php //do not copy
/**
* This recipe will remove the confirmation messages from Sponsored Members on checkout and email
* when a member pays by check. Only once payment has been received will the codes show.
*
* 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/
View mypmpro_register_helper_user_fields.php
<?php //do not copy
/**
* This recipe provides backwards support for Register Helper and PMPro v2.9, allowing you
* to still use Register Helper fields with PMPro 2.9
*
* We encourage you to move your custom RH fields into User Fields found under Memberships > Settings > User Fields.
*
*
* You can add this recipe to your site by creating a custom plugin
View my-pmpro-send-discount-code-for-expired-members.php
<?php
/**
* This generates an unique discount code with one use whenever a user expires, for their current level.
* Add the variable !!expired_code!! to the Membership Expired email, to show the code to users.
* Add this code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function pmpro_create_discount_code_on_expiry( $user_id, $level_id ) {
if( $level_id === 2 ) { // change 2 to your trial level
View mypmpro-redirect-after-confirmation.php
<?php //do not copy
/**
* Redirect to your chosen page after checking out when a member purchases a specific level.
*
* 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/
*/
View mypmpro-search-query.php
<?php //do not copy
function mypmpro_member_directory_sql_search_where( $query, $s ) {
$sql_search_where = "
AND (
u.display_name LIKE '%" . esc_sql( $s ) . "%'
)
";
View mypmpro-restrict-user-emails-partially.php
<?php //do not copy
/**
* This recipe allows you to restrict partial user email addresses during checkout.
* You will be able to specify that all @paidmembershipspro.com email addresses are allowed to sign up, without
* having to enter each user's full email address.
*
* 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 / append_profile_page_with_cf7.php
Last active Jun 9, 2022 — forked from kimcoleman/append_profile_page_with_cf7.php
Add Contact Form 7 to the Profile page when using the Member Directory and Profiles Add On for Paid Memberships Pro.
View append_profile_page_with_cf7.php
<?php
/**
* Add Contact Form 7 to the Profile page when using the Member Directory and Profiles Add On for Paid Memberships Pro.
* Update line 36 with the correct CF7 shortcode for your desired form to display.
* Add a hidden field to your form: "[hidden send-to-email default:shortcode_attr]".
* Set the "To" field of the Contact Form to "[send-to-email]".
*
*/
// Allow custom shortcode attribute for "send-to-email".
View mypmpro-membership-numbers-padded-zeros.php
<?php
/**
* This recipe create sequential membership numbers based off of a user ID with 5 leading 0's.
* The membership number is then displayed on the membership card.
*
* 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/
*/
View mypmpro-affiliate-earnings-shortcode.php
<?php //do not copy
/**
* This recipe will display the earnings value of an affiliate via shortcode.
* Add [affiliate_earnings] to a page to display the current users earnings.
*
* The default roles that we're looking for are subscribers. You can change this on line 18
* The number of days a cookie will remain active before expiring is 30 days (Line 49)
*
* Add this code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/