Skip to content

Instantly share code, notes, and snippets.

Andrew Lima andrewlimaza

Block or report user

Report or block andrewlimaza

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
@andrewlimaza
andrewlimaza / automatically-approve-previously-approved.php
Created Feb 24, 2020
Automatically approve, previously approved members. [Paid Memberships Pro]
View automatically-approve-previously-approved.php
<?php
/**
* Automatically approve any previously approved member.
* Add this code to your site following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmpro_automatically_approve_previously_approved( $level_id, $user_id, $cancelled_level ) {
if ( ! class_exists( 'PMPro_Approvals' ) ) {
return;
@andrewlimaza
andrewlimaza / pmpro-change-admin-to-email.php
Created Feb 14, 2020
Change Admin "To" address for admin emails [Paid Memberships Pro]
View pmpro-change-admin-to-email.php
<?php
/**
* Change the "To:" header for admin emails for Paid Memberships Pro.
* Follow this guide to add custom code to your site - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmpro_change_admin_to_email( $headers, $email ){
if( strpos( $email->template, "_admin" ) !== false ) {
//add different email for admin emails.
$headers[] = "To: " . "otheremail@domain.com";
@andrewlimaza
andrewlimaza / rh-webinar-example.php
Created Feb 12, 2020
Register Helper Webinar Example.
View rh-webinar-example.php
<?php
/**
* Comments to be updated.
*
*/
function my_pmpro_rh_fields() {
// Don't break if Register Helper is not loaded.
if ( ! function_exists( 'pmprorh_add_registration_field' ) ) {
return false;
@andrewlimaza
andrewlimaza / remove-custom-trial-for-existing-members.php
Created Feb 6, 2020
Remove trial limit for existing members. [Paid Memberships Pro]
View remove-custom-trial-for-existing-members.php
<?php
/**
* Remove custom trial for existing members (when existing member changes levels/renews)
* Adjust the level ID on line 16 to match your needs.
* Add this code to your WordPress site by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmpro_level_adjustment( $level ) {
// Bail if the user currently doesn't have a membership level.
@andrewlimaza
andrewlimaza / adjust-eu-currency-pmpro.php
Last active Jan 23, 2020
Adjust currency for Paid Memberships Pro
View adjust-eu-currency-pmpro.php
<?php
/**
* Adjust Euros for Paid Memberships Pro. Add correct thousands and decimal separator. (i.e. 1.500,99)
* Add this code to your site by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmpro_eu_format( $pmpro_currencies ) {
$pmpro_currencies['EUR'] = array(
'decimals' => '2',
'thousands_separator' => '.',
@andrewlimaza
andrewlimaza / immediate-access-series.php
Created Jan 20, 2020
Immediate access for PMPro Series Dripfeed
View immediate-access-series.php
<?php
/**
* Adds settings to Advanced Settings wheree you can set levels by comma separated list. E.G. 1,2,4,5
* Users with defined levels will gain immediate access to dripfeed content. Other member's won't and will have to wait according to dripfeed settings.
* ****Currently requires pre-release of Series Add On V0.4.2+
*/
/**
* Overrides series delays if a membership level has been added
*/
@andrewlimaza
andrewlimaza / shortcode-example.php
Created Jan 13, 2020
Show list of users that purchased a post
View shortcode-example.php
<?php
/**
* Use shortcode [posts_users_example post_id='12']
* Tweak code to your liking, this is a starter example.
* Add code via this method - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_shortcode_example( $atts ) {
if ( empty( $atts['post_id'] ) ) {
return 'no post ID supplied';
@andrewlimaza
andrewlimaza / adjust-confirmation-message-pmpro.php
Created Jan 13, 2020
Adjust Confirmation Message When Purchasing Addon Packages Item [Paid Memberships Pro]
View adjust-confirmation-message-pmpro.php
<?php
/**
* Adjust the confirmation message when someone purchases an item from Addon Packages.
* Remove default message and create own messaage on lines 18-19.
* Add code following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
// Remove default Addon Packages Message.
remove_filter( 'pmpro_confirmation_message', 'pmproap_pmpro_confirmation_message' );
@andrewlimaza
andrewlimaza / free-downloadable-members-product.php
Created Jan 8, 2020
Give members a free WooCommerce downloadable Product [Paid Memberships Pro Snippet]
View free-downloadable-members-product.php
<?php
/**
* Give certain downloadable products to Paid Memberships Pro members for free.
* Adjust the code to your needs and to match your WooCommerce Product IDs and Membership Level IDs.
* Follow this guide to add the code to your WordPress website - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function free_download_product_for_members( $discount_price, $level_id, $original_price, $product ) {
$allowed_free_products = array( 58, 59, 100, 300, 501); // Adjust this with the WooCommerce Product ID's that are allowed to be discounted.
@andrewlimaza
andrewlimaza / remove-shipping-phone-field-pmpro.php
Created Jan 6, 2020
Remove shipping phone field from PMPro checkout
View remove-shipping-phone-field-pmpro.php
<?php
/**
* Make phone field optional for shipping details.
* Add this code to your site by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function pmpro_remove_phone_shipping( $fields ) {
unset( $fields['sphone'] );
return $fields;
}
You can’t perform that action at this time.