Skip to content

Instantly share code, notes, and snippets.

Avatar

Jason Coleman ideadude

View GitHub Profile
@ideadude
ideadude / my_original_sub_order_col.php
Created Oct 26, 2020
Add a column to the PMPro orders table that shows the original subscription order.
View my_original_sub_order_col.php
<?php
/**
* Add a column to the PMPro orders table that shows the original subscription order.
* Requires PMPro 2.5+
* Add this code to a Code Snippet or custom plugin.
*/
function my_original_sub_order_col_header($order_ids) {
?>
<th>Original Order</th>
<?php
@ideadude
ideadude / my_redirect_away_from_docs.php
Last active Oct 27, 2020
Hide BuddyPress docs from members of some levels when using Paid Memberships Pro.
View my_redirect_away_from_docs.php
/**
* Hide docs from some levels.
* Make sure to adjust the pmpro_hasMembershipLevel check below
* to use the IDs of your levels which SHOULD have access to view members.
* Everyone else will be redirected to the restricted access or levels page.
*
* Copy this code into a custom plugin or Code Snippet.
*/
function my_redirect_away_from_docs() {
// Bail if PMPro and BuddyPress aren't active.
@ideadude
ideadude / my_redirect_away_from_member_pages.php
Created Oct 12, 2020
Hide individual BuddyPress member pages from members of some levels when using Paid Memberships Pro.
View my_redirect_away_from_member_pages.php
/**
* Hide individual member pages from some levels.
* Make sure to adjust the pmpro_hasMembershipLevel check below
* to use the IDs of your levels which SHOULD have access to view members.
* Everyone else will be redirected to the restricted access or levels page.
*
* Copy this code into a custom plugin or Code Snippet.
*/
function my_redirect_away_from_member_pages() {
// Bail if PMPro and BuddyPress aren't active.
@ideadude
ideadude / my_bp_activity_filter.php
Created Oct 12, 2020
Only let certain members post BuddyPress activity when using PMPro and PMPro BuddyPress.
View my_bp_activity_filter.php
/**
* Only let certain members post BuddyPress activity.
* This code works with BuddyPress and BuddyBoss.
* This code only filters the main activity page.
* Posting to groups you are a member of still works.
*
* Make sure BuddyPress (or BuddyBoss), PMPro, and PMPro BuddyPress are all active.
* Copy this code into a custom plugin or Code Snippet.
*/
@ideadude
ideadude / pmpro_ad_code.php
Created Oct 2, 2020
Some examples of showing AdSense code for certain members only.
View pmpro_ad_code.php
<?php
// show ads to non-members and level 3
if( pmpro_hasMembershipLevel( array(0,3) ) ) {
?>
<script>//...</script>
<?php
}
// use the pmpro_displayAds function
// https://www.paidmembershipspro.com/documentation/content-controls/hide-ads/
@ideadude
ideadude / my_update_pmpro_stripe_statement_descriptor.php
Last active Aug 4, 2020
Change the statement descriptor for Stripe charges and subscriptions.
View my_update_pmpro_stripe_statement_descriptor.php
<?php
/**
* Change the statement descriptor for Stripe charges and subscriptions.
* This is the message shown on the customer's credit card statement.
* Must contain at least one letter, 22 characters max.
*
* Requires PMPro 2.4.1+
*
* Note: If your descriptor includes invalid characters or
* more than 22 chacters, checkout will fail.
@ideadude
ideadude / my_pmpro_show_cvv.php
Created Jul 13, 2020
Remove CVV from the checkout page and don't require it.
View my_pmpro_show_cvv.php
<?php
/**
* Remove CVV from the checkout page and don't require it.
*/
// Removes the field from the checkout page.
function my_pmpro_show_cvv( $show ) {
return false;
}
add_filter( 'pmpro_show_cvv', 'my_pmpro_show_cvv' );
@ideadude
ideadude / my_pmpro_member_number_field.php
Last active Jul 13, 2020
Add a "member_number" field that only admins can edit using PMPro and Register Helper.
View my_pmpro_member_number_field.php
<?php
/**
* Add a "member_number" field that only admins can edit.
* Make sure PMPro and the Register Helper Add On are active.
* Copy this code into a Code Snippet or custom plugin.
*/
function my_pmpro_member_number_field() {
// Don't break if Register Helper is not loaded.
if ( ! function_exists( 'pmprorh_add_registration_field' ) ) {
return false;
@ideadude
ideadude / shareasale_pmpro_affiliates.html
Created Jul 13, 2020
Share a Sale Tracking Code to use with PMPro Affiliates.
View shareasale_pmpro_affiliates.html
<img id='_SHRSL_img_1' src='https://www.shareasale.com/sale.cfm?tracking=!!ORDER_ID!!&amount=!!ORDER_AMOUNT!!&merchantID=XXXXX&transtype=sale' width='1' height='1'>
<script src='https://www.dwin1.com/19038.js' type='text/javascript' defer='defer'></script>
@ideadude
ideadude / pmprorh-init-buddypress-fields.php
Created Jul 2, 2020 — forked from pbrocks/pmprorh-init-buddypress-fields.php
Example of defining PMPro Register Helper Fields Synchronized to BuddyPress XProfile Fields
View pmprorh-init-buddypress-fields.php
<?php
/**
* Based on the Register Helper example.
* We've added a "buddypress" option for each field
* set to the XProfile name we used when setting up
* the fields in the BuddyPress extended profile.
* If the PMPro BuddyPress Add On is activated
* then the fields will be synchronized.
* Register Helper: https://www.paidmembershipspro.com/add-ons/pmpro-register-helper-add-checkout-and-profile-fields/
* PMPro BuddyPress: https://www.paidmembershipspro.com/add-ons/buddypress-integration/
You can’t perform that action at this time.