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
@ipokkel
ipokkel / pmpro-sponsor-child.php
Created May 5, 2023 05:54
Display the sponsored users of a sponsor with a shortcode for PMPro Sponosored Members. [pmpro_sponsored_children]
<?php
/**
* Add a shortcode to display a list of sponsored children.
*
* @param array $atts {
* Attributes for the shortcode.
*
* @type int $user_id The user ID of the sponsor.
* }
*
<?php
/**
* Allow users with set custom roles access to the WordPress dashboard when users
* that also has a "Subscriber" role is being blocked if the Restrict Dashboard Access
* has been set on the Memberships > Settings > Advanced page.
*
* This should be helpful if users have multiple roles.
*
* You can add this recipe to your site by creating a custom plugin
* or using the Code Snippets plugin available for free in the WordPress repository.
<?php
/**
* Example of changing the group (location ) to add a user field to.
*
* "$where" locations available on the checkout page are:
* - after_pricing_fields
* - after_username
* - after_password
* - after_email
* - checkout_boxes
@ipokkel
ipokkel / toggle-payment-type-field-visibility-for-check.php
Created March 21, 2023 09:39
Show or hide (toggle) your check payment type user field group if the check payment option is selected. #pmpropbc #pmpro-pay-by-check
<?php
/**
* Toggle the Payment Type user field on the checkout page when using the Pay by Check gateway.
* The Payment Type field is moved to below the Choose Your Payment Method part on the checkout page.
*
* This is a partner recipe for the guide
* Let Users Select Offline Payment Methods Using the “Pay by Check” Gateway
* @link https://www.paidmembershipspro.com/let-users-select-offline-payment-methods-using-the-pay-by-check-gateway/
*
* This recipe assumes the following:
@dparker1005
dparker1005 / redirect_cancel_to_stripe.php
Created March 9, 2023 18:54
Redirect users from the cancellation page to the Stripe Customer Portal.
<?php
// Copy from below here...
/**
* Prevent users from cancelling their membership or checking out for a new one.
*/
function my_pmpro_redirect_cancel_to_stripe() {
global $pmpro_pages;
if ( ! empty( $pmpro_pages['cancel'] ) && is_page( $pmpro_pages['cancel'] ) ) {
@dparker1005
dparker1005 / my_pmpro_prevent_name_save_at_checkout.php
Created March 8, 2023 15:14
Do not update user's first and last name while on the PMPro Checkout page. Useful if you do not want the user's billing name to be the name on the account.
<?php
// Copy from below here.
/**
* Do not update user's first and last name while on the PMPro Checkout page.
* Useful if you do not want the user's billing name to be the name on the account.
*/
function my_pmpro_prevent_name_save_at_checkout( $check, $object_id, $meta_key ) {
if ( $meta_key === 'first_name' || $meta_key === 'last_name' ) {
<?php //do not copy
/**
* This recipe adds the pmpro_pending_approval class to the pmpro_content_message
* element if the current user is pending approval.
*
* You can add this recipe to your site by creating a custom plugin
* or using the Code Snippets plugin available for free in the WordPress repository.
* Read this companion article for step-by-step directions on either method.
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
@ipokkel
ipokkel / remove-gift-aid-text-from-checkout-page.php
Created February 8, 2023 12:55
Remove PMPro Gift Aid text from checkout page for specified levels in the $no_gift_aid_level_ids variable.
<?php
/**
* Remove the gift aid text from the checkout page for specified membership levels.
*
* You can add this recipe to your site by creating a custom plugin
* or using the Code Snippets plugin available for free in the WordPress repository.
* Read this companion article for step-by-step directions on either method.
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
@dwanjuki
dwanjuki / my_pmpro_email_renewaldate_data.php
Created February 1, 2023 15:44
This recipe makes the !!renewaldate!! variable available for use in all Paid Memberships Pro emails.
<?php
/**
* This recipe makes the !!renewaldate!! variable available for use in all Paid Memberships Pro emails.
* When the variable is empty it will display nothing instead of the !!renewaldate!! email variable
*
* Notice the array key does not include the !!s
*
* You can add this recipe to your site by creating a custom plugin
* or using the Code Snippets plugin available for free in the WordPress repository.
* Read this companion article for step-by-step directions on either method.
<?php
/**
* Example of extending a user field to add a depends
*
* This recipe assumes a checkbox field with the name my_checkbox was created.
* This recipe assumes a textarea field with the name my_textarea was created.
*
* You can add this recipe to your site by creating a custom plugin
* or using the Code Snippets plugin available for free in the WordPress repository.
* Read this companion article for step-by-step directions on either method.