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_payment_method.css
Last active October 12, 2023 19:48 — forked from strangerstudios/my_pmpro_payment_method.css
Adds credit card logos and a PayPal logo to the "Select Payment Method" box on membership checkout.
/* CSS Document */
#pmpro_payment_method span a {
background-position: left bottom;
background-size: contain;
background-repeat: no-repeat;
display: inline-block;
margin-left: 1%;
max-width: 300px;
padding-bottom: 60px;
text-align: left;
@kimcoleman
kimcoleman / remove_my_pmprobb_auth_reply_view_filter.php
Created February 12, 2018 11:17
Removes the replies filter in the bbPress Add On for Paid Memberships Pro.
<?php
//Removes the replies filter in the bbPress Add On for Paid Memberships Pro.
function remove_my_pmprobb_auth_reply_view_filter()
{
remove_filter( 'bbp_get_reply_content', 'pmprobb_auth_reply_view');
}
add_action('init', 'remove_my_pmprobb_auth_reply_view_filter');
@kimcoleman
kimcoleman / insert_pmpro_member_profile_shortcode.php
Created February 15, 2018 20:05
Use this recipe to add the [pmpro_member_profile] to your bbPress user profile page.
<?php
/*
Use this recipe to add the [pmpro_member_profile] to your bbPress user profile page.
*/
function insert_pmpro_member_profile_shortcode() {
$user_id = bbp_get_user_id( 0, true, false );
echo do_shortcode( '[pmpro_member_profile user_id="' . $user_id . '"]' );
}
add_action( 'bbp_template_before_user_profile', 'insert_pmpro_member_profile_shortcode', 15, 0 );
@kimcoleman
kimcoleman / redirect_profile_page_to_bbpress_user_profile.php
Last active March 27, 2019 17:19
Redirect the Member's Profile page to the bbPress User Profile when using the Member Directory and Profile Pages Add On for Paid Memberships Pro
<?php
/**
* Use this recipe to redirect the Profile page as defined under Memberships > Page Settings to the member's
* bbPress User Profile when using the Member Directory and Profile Pages Add On in conjunction with bbPress.
*
* You must set a placeholder page under Memberships > Page Settings > Profile in order for this redirect to work.
*/
function redirect_profile_page_to_bbpress_user_profile() {
global $pmpro_pages;
if ( ! empty( $pmpro_pages ) && ! empty( $pmpro_pages['profile'] ) && is_page( $pmpro_pages['profile'] ) ) {
@kimcoleman
kimcoleman / add_notification_bar_for_limit_post_view_alt.php
Last active April 12, 2021 20:27
Notification bar when post views are being tracked and restricted by the Limit Post Views Add On
<?php
/**
* Notification bar when post views are being tracked and restricted by the Limit Post Views Add On
* Requires: https://www.paidmembershipspro.com/add-ons/pmpro-limit-post-views/
*/
function add_notification_bar_for_limit_post_view_alt() {
// check for past views and if we are on a single page. needs to check if the post is locked at all by default.
if ( ! empty( $_COOKIE['pmpro_lpv_count'] ) && is_single() ) {
global $current_user;
@kimcoleman
kimcoleman / add_notification_bar_for_limit_post_view.php
Last active July 3, 2023 17:32
Notification bar when post views are being tracked and restricted by the Limit Post Views Add On
<?php
/**
* Notification bar when post views are being tracked and restricted by the Limit Post Views Add On
*/
function add_notification_bar_for_limit_post_view() {
// check for past views and if we are on a single page. needs to check if the post is locked at all by default.
if ( ! empty( $_COOKIE['pmpro_lpv_count'] ) && is_single() ) {
global $current_user;
// Check cookie for views value.
@kimcoleman
kimcoleman / trigger_popup_maker_with_limit_post_views.php
Last active March 9, 2023 07:08
Trigger a Popup Maker to display on the redirected page once the post views limit is reached.
<?php
/**
* Trigger a Popup Maker to display on the redirected page once the post views limit is reached.
* Requires: https://www.paidmembershipspro.com/add-ons/pmpro-limit-post-views/ and https://wordpress.org/plugins/popup-maker/
*/
function trigger_popup_maker_with_limit_post_views() {
// Check cookie for views value and compare to limit based on visitor/user.
if ( ! empty( $_COOKIE['pmpro_lpv_count'] ) ) {
global $current_user;
@kimcoleman
kimcoleman / hide_pmpro_shipping_level_1.php
Last active February 20, 2018 19:33
Add Shipping Address to membership checkout only if Addon Package is included.
<?php
/**
* Add Shipping Address to membership checkout only if Addon Package is included.
*/
function hide_pmpro_shipping_level_1( $level_id ) {
if ( ! empty( $_REQUEST['ap'] ) ) {
$hideshipping = false;
} else {
$hideshipping = true;
}
@kimcoleman
kimcoleman / hide_pmpro_shipping_level_ID.php
Last active February 20, 2018 19:32
Add Shipping Address to membership checkout only if Addon Package is included for levels 4, 5, and 9 (for mono618).
<?php
/**
* Add Shipping Address to membership checkout only if Addon Package is included for levels 4, 5, and 9.
*/
function hide_pmpro_shipping_level_4( $level_id ) {
if ( ! empty( $_REQUEST['ap'] ) ) {
$hideshipping = false;
} else {
$hideshipping = true;
}
@kimcoleman
kimcoleman / my_pmpro_gettext_membership.php
Last active February 21, 2018 12:10
Change term "membership" to "subscription" for plugin generated text
<?php
/**
* Change term "membership" to "subscription" for plugin generated text
*/
function my_pmpro_gettext_membership( $translated_text, $text, $domain ) {
if ( $domain == 'paid-memberships-pro' ) {
$translated_text = str_replace( 'Membership', 'Subscription', $translated_text );
$translated_text = str_replace( 'membership', 'Subscription', $translated_text );
}
return $translated_text;