Skip to content

Instantly share code, notes, and snippets.

View MaryOJob's full-sized avatar
🏠
Working remotely 😈

Mary Job MaryOJob

🏠
Working remotely 😈
View GitHub Profile
@MaryOJob
MaryOJob / my_pmpro_email_headers_admin_emails.php
Last active December 12, 2019 08:11 — forked from femiyb/my_pmpro_email_headers_admin_emails.php
BCC all PMPro Register/Checkout Emails to a Certain Address
<?php
/*
Add bcc for checkout emails
*/
function my_pmpro_email_headers_admin_emails($headers, $email) {
//bcc checkout emails
if(strpos($email->template, "checkout_") !== false) {
//add bcc
$headers[] = "Bcc:" . "otheremail@domain.com";
}
@MaryOJob
MaryOJob / my_pmpro_login_redirect_url.php
Created January 15, 2020 11:41 — forked from travislima/my_pmpro_login_redirect_url.php
Redirect on login if user has any failed payments. (Requires Paid Memberships Pro Failed Payment Limit Add On)
<?php
/*
* Redirect on login if user has any failed payments. (Requires Paid Memberships Pro Failed Payment Limit Add On)
* Adjust the code on the line the line "site_url( ' payment-failed')" to redirect to page of your prefereance.
* Add this code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmpro_login_redirect_url( $url, $request, $user ) {
<?php // do not copy this line
/**
* When registering, add the member to a specific membership level
* @param integer $user_id
* Add this to a PMPro customizations or Code Snippets Plugin: https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
**/
//Disables the pmpro redirect to levels page when user tries to register
add_filter("pmpro_login_redirect", "__return_false");
<?php // do not copy this line please
/* PMPro Gift Levels Example */
global $pmprogl_gift_levels;
$pmprogl_gift_levels = array(
// Set level 11 as a "Purchase Gift" membership level to create a gift code for a free level 16 gift.
11 => array( // "Purchase Gift" level ID
@MaryOJob
MaryOJob / my_pmproz_after_checkout_data1.php
Last active February 27, 2020 13:52 — forked from dparker1005/my_pmproz_after_change_membership_level_data.php
Adds a custom field created via RH to zap 'pmpro_after_checkout_data'.
<?php // do not copy this line
// Copy from below here
function my_pmproz_after_checkout_data( $data, $user_id, $level, $order ) {
$data['my_usermeta'] = get_user_meta($user_id, 'my_usermeta', true); // add your custom usermeta key in place of my_usermeta
return $data;
}
add_filter( 'pmproz_after_checkout_data', 'my_pmproz_after_checkout_data', 10, 4 );
@MaryOJob
MaryOJob / my_pmpro_email_headers_cc_admin_emails.php
Last active September 28, 2021 09:57 — forked from strangerstudios/my_pmpro_email_headers_admin_emails.php
CC two additional emails on PMPro admin emails.
<?php // do not copy this line
/* Add CC for PMPro admin emails
* Add this snippet to your PMPro Customization Plugin: https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmpro_email_headers_admin_emails($headers, $email) {
//cc emails already going to admin_email
if(strpos($email->template, '_admin') !== false)
{
@MaryOJob
MaryOJob / my_pmproal_before_level_member_badge.php
Last active April 7, 2020 09:51 — forked from strangerstudios/my_pmproal_before_level_member_badge.php
Show the Member Badge for each level on the 3 column layout Membership Levels page
<?php
/*
Sample method to show a level's Member Badge on the three column layout of the
Membership Levels page when using the Advanced Levels Page Shortcode Add On.
*/
function my_pmproal_before_level_member_badge( $level_id, $layout ) {
if( function_exists( 'pmpromb_getBadgeForLevel' ) ) {
$image = pmpromb_getBadgeForLevel($level_id);
if( ! empty( $image ) && $layout == '3col' ) {
echo '<img class="pmpro_member_badge" src="' . esc_url($image) . '" border="0" />';
@MaryOJob
MaryOJob / update_currency_per_level_to_rand.php
Last active April 27, 2020 09:21 — forked from strangerstudios/update_currency_per_level.php
Change currencies depending on Paid Memberships Pro level from your default to Rand
<?php // DO NOT COPY THIS LINE PLEASE
/*
Change currencies depending on Paid Memberships Pro level.
Add this code to your active theme's functions.php or a custom plugin.
This changes currency for a membership level from the default currency on your site to Rand.
Other places to look into swapping currencies:
* Levels page.
* Invoices page.
@MaryOJob
MaryOJob / pmpro_isOrderRecurring.php
Last active May 15, 2020 20:25 — forked from strangerstudios/pmpro_isOrderRecurring.php
Perform an action on Paid Memberships Pro (PMPro) recurring orders only.
/*
Perform an action on PMPro recurring orders only.
A recurring order here is one that
(1) Has an earlier order with the same subscription_transaction_id.
(2) Is not created at PMPro checkout.
Note that we are checking if function_exists for pmpro_isOrderRecurring incase
we add this to PMPro core. Also note that the $test_checkout param there is used
here to avoid #2 above. So this parameter will check if the currently running PHP
script is being fired at checkout, not necessarily if the order was created at checkout,
//Enables comments for User Pages
function enable_comments_for_user_pages($postdata, $user, $level)
{
$postdata['comment_status'] = 'open';
return $postdata;
}
add_filter('pmpro_user_page_postdata', 'enable_comments_for_user_pages', 10, 3);