Skip to content

Instantly share code, notes, and snippets.

View kimcoleman's full-sized avatar

Kim Coleman kimcoleman

View GitHub Profile
@kimcoleman
kimcoleman / add_billing_shipping_fields_to_profile_and_add_member.php
Created September 8, 2020 19:03
Adds Billing Address and Shipping Address (via the Shipping Add On) to the Edit User profile, frontend Member Profile Edit, and the Add Member Admin page.
<?php
/*
* Adds Billing Address and Shipping Address (via the Shipping Add On) to the Edit User profile,
* frontend Member Profile Edit, and the 'Add Member' page in the WordPress admin.
*
* 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/
*
@kimcoleman
kimcoleman / w3_total_cache_no_cache.html
Last active June 11, 2024 17:47
Add these pages/directories to the "Never cache the following pages:" setting in W3 Total Cache
/membership-account*
/membership-checkout*
/membership-levels*
/login/
@kimcoleman
kimcoleman / pmpro_member_homepage_id.php
Created August 13, 2020 21:08
Redirect members of level ID 1 to the post_id '232' on login.
<?php
/**
* Redirect members of level ID 1 to the CPT with ID '232' on login.
*
* 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/
*
*/
<?php
/**
* Set the member homepage for members of Level 3 to the post ID 232.
*
* 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/
*
*/
@kimcoleman
kimcoleman / add_nickname_pmprorh_user_table_fields.php
Created August 11, 2020 14:58
Add nickname to the Member Profile Edit frontend page.
<?php
/**
* Add nickname to the Member Profile Edit frontend 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/
*
*/
@kimcoleman
kimcoleman / my_pmpro_email_template_header_footer.php
Created August 9, 2020 16:51
Apply the Email Header and Email Footer as set in the Memberships > Email Templates admin page to the WP New User Notification.
@kimcoleman
kimcoleman / my_pmpro_membership_level_exactmetrics_frontend_tracking_options_analytics_end.php
Last active April 8, 2021 18:27
Update to the GADWP / ExactMetrics Lite tracking code for custom dimension for Membership Level
<?php
/**
* Update to the GADWP / ExactMetrics Lite tracking code for custom dimension for Membership Level
*
*/
function my_pmpro_membership_level_exactmetrics_frontend_tracking_options_analytics_end( $options ) {
// Get the value to track for the current user.
if ( is_user_logged_in() && function_exists( 'pmpro_getMembershipLevelForUser' ) ) {
// Get the current users's membership level ID.
$current_user_membership_level = pmpro_getMembershipLevelForUser( get_current_user_id() );
@kimcoleman
kimcoleman / pmpro_sample_advanced_levels_compare_table.html
Last active August 9, 2020 14:15
pmpro_sample_advanced_levels_compare_table.html
[pmpro_advanced_levels layout='compare_table' compare='<a href="/item-1/">Item 1</a>,1,1;<a href="/item-2/">Item 2</a>,0,1']
@kimcoleman
kimcoleman / show_today_date_before_pmpro_tos_content.php
Last active March 28, 2021 00:27
Show today's date before the content of the Terms of Service page at Membership Checkout.
<?php
/**
* Show today's date before the content of the Terms of Service page at Membership 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.
* Read this companion article for step-by-step directions on either method.
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*
*/
@kimcoleman
kimcoleman / login_redirect_to_referrer.php
Created July 30, 2020 13:39
Always redirect user to referrer after log in if no other redirects are set.
<?php
/**
* Always redirect user to referrer after log in if no other redirects are set.
*
*/
function login_redirect_to_referrer( $redirect_to, $request, $user ) {
// If already redirecting, do that.
if ( ! empty( $redirect_to ) ) {
return $redirect_to;