Skip to content

Instantly share code, notes, and snippets.

View kimcoleman's full-sized avatar

Kim Coleman kimcoleman

View GitHub Profile
@kimcoleman
kimcoleman / siteorigin_compatibility_for_pmpro.php
Last active April 14, 2020 17:22
Ensure Paid Memberships Pro compatibility when using Page Builder by SiteOrigin.
<?php
/**
* Ensure Paid Memberships Pro compatibility when using Page Builder by SiteOrigin:
* https://wordpress.org/plugins/siteorigin-panels/
*
* Your administrator-level account must have a Membership Level in order to edit all of the pages assigned
* under Memberships > Pages.
*
* You must also set a Custom Field on the Membership Checkout page with the key 'pmpro_default_level' and
* value of a level ID in order to properly edit your Membership Checkout page using the builder.
@kimcoleman
kimcoleman / my_pmpro_bbg_register_member_types.php
Last active April 14, 2021 03:23
Register BuddyPress member types to be assigned based on Membership Level when using the BuddyPress Add On for Paid Memberships Pro
<?php
/*
* Register BuddyPress member types to be assigned based on Membership Level when using the
* BuddyPress Add On for Paid Memberships Pro (https://www.paidmembershipspro.com/add-ons/buddypress-integration/).
*
* If you are using BuddyPress v2.3+ and would like to use the Member Specific Directory option,
* update this function to use the bp_register_member_types hook.
* See: https://codex.buddypress.org/developer/member-types/
*/
function my_pmpro_bbg_register_member_types() {
@kimcoleman
kimcoleman / custom_memberlite_menus.php
Last active April 9, 2018 18:57
Allows all users to see the 'Member Menu' not only those with a level via Paid Memberships Pro.
<?php
/**
* Remove Memberlite's wp_nav_menu_items filter.
*/
function remove_memberlite_wp_nav_menu_items_filter() {
remove_filter( 'wp_nav_menu_items', 'memberlite_menus', 10, 2 );
}
add_action( 'after_setup_theme', 'remove_memberlite_wp_nav_menu_items_filter' );
/**
@kimcoleman
kimcoleman / pmpro_membership_buddypress_tab.php
Last active September 17, 2022 08:16
Add a new tab to your BuddyPress Profile page to show a user's Membership Account information.
<?php
/**
* Add a new tab to your BuddyPress Profile page to show a user's Membership Account information.
*
*/
function pmpro_membership_buddypress_tab() {
global $bp;
if ( function_exists( 'pmpro_hasMembershipLevel' ) && pmpro_hasMembershipLevel() ) {
bp_core_new_nav_item( array(
@kimcoleman
kimcoleman / my_pmpro_buddypress_profile_template_redirect.php
Created April 12, 2018 17:32
Redirect the Membership Account page to the user's BuddyPress Profile.
<?php
/**
* Redirect the Membership Account page to the user's BuddyPress Profile.
*
*/
function my_pmpro_buddypress_profile_template_redirect() {
global $pmpro_pages;
// Make sure PMPro is active.
if ( empty( $pmpro_pages ) ) {
@kimcoleman
kimcoleman / my_membership_account_memberlite_after_masthead_inner.php
Created April 12, 2018 18:20
Add member's name and avatar to the masthead on the membership account page using the Memberlite theme.
<?php
/**
* Add member's name and avatar to the masthead on the membership account page using the Memberlite theme.
*/
function my_membership_account_memberlite_after_masthead_inner( ) {
global $pmpro_pages, $current_user;
if ( ! empty( $pmpro_pages ) && is_page( $pmpro_pages['account'] ) ) {
echo '<div class="text-center">' . get_avatar( $current_user->ID, 128 ) . '</div>';
echo '<h1 class="text-center">Welcome, ' . $current_user->display_name . '</h1>';
}
@kimcoleman
kimcoleman / my_memberlite_wp_footer.php
Created May 8, 2018 14:56
Add custom script to the footer to load a modal.
@kimcoleman
kimcoleman / memberlite_testimonials_widget.txt
Created May 8, 2018 15:17
Create a nice testimonials page using the Testimonials Widget plugin with the Memberlite theme.
[row]
[col large="8" large_offset="2"]
[testimonials char_limit=0 limit=-1 orderby="date"]
[/col]
[/row]
@kimcoleman
kimcoleman / pmpro-expire-soon-banner.php
Last active March 11, 2025 21:31 — forked from travislima/pmpro-expire-soon-banner.php
Create a banner that will display a message to soon to be expiring members
<?php
/**
* This code will display a renewal reminder notification banner at the top of your website for members whose membership
* level will expire within 7 days of the date they visit your site.
* Add this code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
* Note: When adding to your Customizations Plugin, be careful not to include the opening php tag on line 1 above.
*/
function pmpro_show_banner_renewal_message() {
global $pmpro_pages;
@kimcoleman
kimcoleman / memberlite-banner-expiration-notification.php
Last active July 17, 2023 13:20 — forked from travislima/memberlite-banner-expiration-notification.php
Display a banner that notifies users about their upcoming expiration - Memberlite method.
<?php
/**
* This code will display a renewal reminder notification banner at the top of your website for members whose membership
* level will expire within 7 days of the date they visit your site.
* Add this code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
* Note: When adding to your Customizations Plugin, be careful not to include the opening php tag on line 1 above.
*/
function memberlite_show_banner_renewal_message(){
global $pmpro_pages;