Skip to content

Instantly share code, notes, and snippets.

View kimcoleman's full-sized avatar

Kim Coleman kimcoleman

View GitHub Profile
@kimcoleman
kimcoleman / my_pmpro_show_time_on_expiration_date.php
Last active August 6, 2021 23:26
Show the expiration time for a member's level on the Membership Account page.
<?php
/**
* Show the expiration time for a member's level on the Membership Account page.
* Useful for sites that offer hourly membership.
* Requires PMPro v2.6+
*
* 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.
*
*/
@kimcoleman
kimcoleman / include_pmpro_courses_lessons_in_search.php
Created July 5, 2021 21:36
Include Lessons in search results using the default module in the Courses for Membership Add On for Paid Memberships Pro.
<?php
/**
* Include Lessons in search results using the default module in the Courses for Membership Add On for Paid Memberships Pro.
*
* 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.
*
*/
function include_pmpro_courses_lessons_in_search($args, $post_type) {
if ( $post_type == 'pmpro_lesson' ){
<?php
/*
* Remove tags for previously held levels after all level changes are made.
* Note that this will make a call to the ConvertKit API for each tag to remove and can be a slow process.
* Requires ConvertKit Integation for Paid Memberships Pro.
*
* 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.
*
*/
@kimcoleman
kimcoleman / pmpro_membership_card_shortcode.html
Created June 4, 2021 14:24
Example of the Membership Card Shortcode for Paid Memberships Pro
<!-- Example of the Membership Card Shortcode for Paid Memberships Pro -->
[pmpro_membership_card print_size="small,medium"]
@kimcoleman
kimcoleman / set_display_name_to_username_new_user_array.php
Created May 19, 2021 15:31
Set the display name as the entered username for all users created through a Paid Memberships Pro checkout.
<?php
/*
* Set the display name as the entered username for all users created through a Paid Memberships Pro 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.
*
*/
function set_display_name_to_username_new_user_array( $new_user_array ) {
$new_user_array['display_name'] = $new_user_array['user_login'];
@kimcoleman
kimcoleman / my_ffl_display_name_just_first.php
Created May 18, 2021 13:41
Change the display name to default to just the first name using the Force First Last WordPress plugin.
<?php
/*
* Change the display name to default to just the first name using the Force First Last WordPress plugin.
* https://wordpress.org/plugins/force-first-last/
*
* 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.
*/
function my_ffl_display_name_just_first( $display_name_order, $first_name, $last_name ) {
$display_name_order = array( $first_name ,'' );
@kimcoleman
kimcoleman / dynamic_pmpro_levels_array.php
Created May 12, 2021 20:37 — forked from ipokkel/dynamic_pmpro_levels_array.php
Dynamically display certain levels on the Membership Levels page based on the current user's active level
<?php
/**
* Dynamically display certain levels on the Membership Levels page based on the current user's active level
* This example allows you to show/hide specific levels on the Membership Levels page.
*/
/**
* Dynamically display certain levels on the Membership Levels page based on the current user's active level
* This example allows you to show/hide specific levels on the Membership Levels page.
*/
function dynamic_pmpro_levels_array( $levels ) {
@kimcoleman
kimcoleman / hide-confirm-email-password.php
Last active August 11, 2026 10:40 — forked from strangerstudios/gist:4027538
Hide the confirm email and confirm password fields from the Paid Memberships Pro checkout page.
<?php
/*
* Don't show confirm password or email fields on the checkout page.
*
* 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/
*/
add_filter( 'pmpro_checkout_confirm_password', '__return_false' );
@kimcoleman
kimcoleman / my_template_redirect_member_profile_permissions.php
Last active April 16, 2021 19:03
Redirect member away from the Member Profile page if they do not have access to view this member's profile.
<?php
/*
* Redirect member away from the Member Profile page if they do not have access to view this member's profile.
*
*/
function my_template_redirect_member_profile_permissions() {
global $pmpro_pages;
if ( empty( $pmpro_pages ) || empty( $pmpro_pages['profile'] ) || ! is_page( $pmpro_pages['profile'] ) ){
return;
@kimcoleman
kimcoleman / custom_pmpro_membership_card_qr_code_size.php
Created April 9, 2021 11:08
Adjust the size of the QR code on Membership Card.
<?php
/*
* Adjust the size of the QR code on 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/
*/
function custom_pmpro_membership_card_qr_code_size( $size ) {