Skip to content

Instantly share code, notes, and snippets.

Kim Coleman kimcoleman

Block or report user

Report or block kimcoleman

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@kimcoleman
kimcoleman / my_pmprosl_custom_shortcode.php
Last active Dec 4, 2019 — forked from LMNTL/my_pmprosl_custom_shortcode.php
Use a custom social login shortcode with PMPro Social Login (Requires v.3 or above)
View my_pmprosl_custom_shortcode.php
<?php
/**
* Use a custom shortcode with the Social Login Add On for Paid Memberships Pro (Requires v.3 or above)
*
*/
function my_pmprosl_custom_shortcode( $shortcode ) {
// Edit this line to change the shortcode displayed on the checkout page.
return '[TheChamp-Login title="Use your Social Account to Login"]';
}
add_filter( 'pmprosl_login_shortcode', 'my_pmprosl_custom_shortcode' );
@kimcoleman
kimcoleman / twenty_twenty_pmpro.css
Created Nov 22, 2019
Custom CSS for using Paid Memberships Pro with the Twenty Twenty WordPress 5.3+ Theme
View twenty_twenty_pmpro.css
/* General Table Styles Adjustments */
.pmpro_table {
border: none;
}
.pmpro_table th,
.pmpro_table td {
border: none;
padding: 10px 0;
}
.pmpro_table td {
@kimcoleman
kimcoleman / custom_pmprodlm_shortcode_download_content_filter.php
Created Nov 11, 2019
Hide the "Membership Required:" and level names from the [download] shortcode output when using Download Monitor and the Download Monitor Integration for Paid Memberships Pro Add On.
View custom_pmprodlm_shortcode_download_content_filter.php
<?php
/**
* Hide the "Membership Required:" and level names from the [download] shortcode output
* when using Download Monitor and the Download Monitor Integration for Paid Memberships Pro Add On.
*
*/
add_filter( 'pmprodlm_shortcode_download_show_membership_required_filter', '__return_false' );
@kimcoleman
kimcoleman / add_new_cpts_pmproap_supported_post_types.php
Created Nov 4, 2019
Filter to add additional post types for protection and individual sale using Addon Packages for Paid Memberships Pro.
View add_new_cpts_pmproap_supported_post_types.php
<?php
/**
* Filter to add additional post types for protection and individual sale using Addon Packages for Paid Memberships Pro.
* You should also install the Custom Post Type (CPT) Membership Access Add On so that your CPT can be properly restricted.
* https://www.paidmembershipspro.com/add-ons/custom-post-type-membership-access/
*
*/
function add_new_cpts_pmproap_supported_post_types( $post_types ) {
$post_types[] = 'custom_courses';
return $post_types;
@kimcoleman
kimcoleman / add_my_cred_to_pmpro_checkout.php
Created Oct 31, 2019
Add myCred points at checkout based on membership level ID.
View add_my_cred_to_pmpro_checkout.php
<?php
/**
* Add myCred points at checkout based on membership level ID.
* Optionally apply points only to members that select a recurring membership.
*
*/
function add_my_cred_to_pmpro_checkout( $user_id, $morder ) {
// Bail if myCred doesn't exist.
if ( ! function_exists( 'mycred_add' ) ) {
@kimcoleman
kimcoleman / my_woocommerce_get_price_html.php
Created Oct 28, 2019 — forked from messica/my_woocommerce_get_price_html.php
Display membership pricing along with regular pricing.
View my_woocommerce_get_price_html.php
<?php
// Display membership pricing along with regular pricing.
function my_woocommerce_get_price_html($price, $product) {
// Get all levels.
$all_levels = pmpro_getAllLevels(true, true);
// Get original price.
$reg_price = wc_price($product->get_regular_price());
@kimcoleman
kimcoleman / aatherapy_pmprorh_init.php
Created Sep 24, 2019
Register Helper Custom Fields for aatherapy.org
View aatherapy_pmprorh_init.php
<?php
// Register Helper Custom Fields for PMPro
function aatherapy_pmprorh_init() {
//don't break if Register Helper is not loaded
if ( ! function_exists( 'pmprorh_add_registration_field' ) ) {
return false;
}
//define the fields
$fields = array();
@kimcoleman
kimcoleman / my_pmpro_checkout_level_extend_memberships.php By default PMPro will only "extend" a membership level if you checkout for the same level. This code will make it so PMPro extends any expiring level with any new expiring level. E.g. if you change from a annual plan to a monthly plan it will add 30 days to the end of your existing membership.
View my_pmpro_checkout_level_extend_memberships.php
<?php
/*
If checking out for ANY level with an expiration, add remaining days to the enddate.
Pulled in from: https://gist.github.com/3678054
*/
function my_pmpro_checkout_level_extend_memberships($level)
{
global $pmpro_msg, $pmpro_msgt, $current_user;
//does this level expire? are they an existing members with an expiration date?
@kimcoleman
kimcoleman / teae_duplicate_usermeta_to_xprofile.php
Created Sep 9, 2019
Duplicate TEAE usermeta fields to xProfile Fields
View teae_duplicate_usermeta_to_xprofile.php
<?php
/**
* Duplicate TEAE usermeta fields to xProfile Fields
*
*/
function teae_duplicate_usermeta_to_xprofile( ) {
global $wpdb;
$fields = array(
'alternate_phone'=>'261',
'body_number_(jal/sal)_1'=>'205',
@kimcoleman
kimcoleman / my_restricted_pages_require_user_login.php
Last active Sep 9, 2019
Restrict specific pages in your WordPress site for logged in users only.
View my_restricted_pages_require_user_login.php
<?php
/**
* Restrict specific pages in your WordPress site for logged in users only.
*
*/
function my_restricted_pages_require_user_login() {
global $current_user;
// Allow logged in users.
if ( is_user_logged_in() ) {
You can’t perform that action at this time.