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 / pmpro-customizations.php
Created March 30, 2021 18:19 — forked from gausam/pmpro-customizations.php
List an account's sponsored members on the Membership Account page.
<?php
/**
* This recipe lists an account's sponsored members on the Membership Account page.
*
* It is intended for use with the Sponsord Members Add On:
* https://www.paidmembershipspro.com/add-ons/pmpro-sponsored-members/
*
* 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
/**
* This recipe will restrict someone with level 1 changing to level 2.
* change line 25 for other level numbers
* 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/
*/
@MaryOJob
MaryOJob / sponsored-members-example.php
Last active April 21, 2021 01:31 — forked from andrewlimaza/sponsored-members-example.php
Sponsored Members Example Preventing Users From Checking out on Child Level without a Sponsored Code from a Parent Account
<?php // Do not copy this line.
// Please add this code to your site following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
/**
* Parent/Child setup.
* Parent = Level ID 1. Child = Level ID 2.
* Automatically create 10 uses for the discount code to be shared with parent/child accounts.
*/
global $pmprosm_sponsored_account_levels;
@MaryOJob
MaryOJob / pmpro-qr-code-sponsored-member.php
Created May 20, 2021 03:27 — forked from andrewlimaza/pmpro-qr-code-sponsored-member.php
Sponsored members checkout URL when scanning QR code [Paid Memberships Pro]
<?php
/**
* If a user is a parent/sponsor member, set the QR code to the child checkout URL.
* This will get the first sponsored level checkout URL and discount code.
* Only set the QR code to the checkout URL if there are available seats.
* Add this code to your site by visiting - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmpro_membership_card_sponsored_members( $card_user, $option ) {
@MaryOJob
MaryOJob / only-set-default-membership-level-on-expiration.php
Last active May 26, 2021 15:01 — forked from andrewlimaza/only-set-default-membership-level-on-expiration.php
Change membership level when a user expires only - Paid Memberships Pro
<?php // Do not copy this line
/**
* Set a default membership level when a user expires (only).
* This does not set the default level when a user cancels.
* Add this code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function pmpro_set_default_level_only_when_expiring( $user_id, $level_id ) {
@MaryOJob
MaryOJob / pmpro-rh-dob-check.php
Created June 15, 2021 10:50 — forked from greathmaster/pmpro-rh-dob-check.php
Checks birthday on checkout to confirm member is over 21 years.
function my_pmprorh_init()
{
//don't break if Register Helper is not loaded
if(!function_exists( 'pmprorh_add_registration_field' )) {
return false;
}
//define the fields
$fields = array();
$fields[] = new PMProRH_Field(
<?php
/**
* This recipe will add a widget to the member directory where users can filter
* members based on location and distance.
* Requires PMPro Membership Directory > v1.0 + PMPro Membership Maps Add Ons
*
* 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/
@MaryOJob
MaryOJob / pmpro-customizations.php
Created June 17, 2021 06:44 — forked from gausam/pmpro-customizations.php
Adds extra checkout data to the Zapier Add On's after_checkout_data trigger payload.
<?php
/**
* This recipe adds extra checkout data to the Zapier Add On's after_checkout_data trigger payload.
*
* It is intended for use with the Zapier Integration Add On:
* https://www.paidmembershipspro.com/add-ons/pmpro-zapier/
*
* 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.
@MaryOJob
MaryOJob / my_pmpro_bp_profile.php
Last active July 5, 2021 19:28 — forked from greathmaster/gist:49c5d81e87b1acd084fd590bee47a3e8
Remove "Membership Level" on the BuddyPress profile page, and instead only show the membership level name
<?php // Do not copy this line
/*
* Remove "Membership Level" on the BuddyPress profile page, and instead only show the membership level name
* Add the code below to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-* * * customizations/
*/
function my_pmpro_bp_show_level_on_bp_profile() {
if ( !function_exists('pmpro_getMembershipLevelForUser') ) {
@MaryOJob
MaryOJob / my_logout_go_home.php
Last active January 6, 2023 23:43 — forked from andrewlimaza/my_logout_go_home.php
Redirect users to a specified page when logging out of your WordPress PMPro site
<?php // DO NOT COPY THIS LINE
//copy lines 5 onwards into your active theme's function.php or custom plugin for code snippets.
function mypmpro_redirect_logout(){
// wp_safe_redirect( '/contact/' ); // use this line to redirect to a specific page on your site
wp_safe_redirect( home_url() ); // use this to redirect to your website home page
exit();
}
add_action('wp_logout','mypmpro_redirect_logout');