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
@JarrydLong
JarrydLong / pmpro-payment-plan-select-plan-query-param.php
Last active June 28, 2024 13:49 — forked from andrewlimaza/pmpro-payment-plan-select-plan-query-param.php
Select Paid Memberships Pro Payment Plan via query parameter
<?php
/**
* Add &pmpropp_chosen_plan=<<plan_id>> in the URL to preselect the payment plan option.
* Add this code to your site by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmpro_payment_plan_select_url() {
// Only load this on the checkout page.
if ( function_exists('pmpro_is_checkout') && !pmpro_is_checkout() ) {
return;
}
<?php //do not copy
function mypmpro_redirect_away_from_wc_endpoint(){
$current_endpoint = WC()->query->get_current_endpoint();
if($current_endpoint == "downloads" ) {
$user = wp_get_current_user();
<?php
/**
* Verify that the user is at least 18 years old before registering.
*
* 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/
*/
function my_pmpro_min_required_age( $okay ) {
@dparker1005
dparker1005 / memberslist_billing_address.php
Created February 28, 2024 16:12
Add the "billing address" column back to the members list and CSV export.
<?php
/**
* Add the "billing address" column back to the members list and CSV export.
*
* Note: This will add the most recent billing address for the user and level
* by looking at the user's order history, not user meta.
*
* 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.
@kimwhite
kimwhite / my-pmpro-change-seat-text.php
Last active April 24, 2024 17:46
Group Add On Change seat or seats to something else
<?php // do not copy this line.
/**
* This recipe will change the working Seat to what ever you choose
*
* use with Group Account Add On. https://www.paidmembershipspro.com/add-ons/group-accounts/
*
* 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_pmpromd_add_target_blank_to_url_fields.php
Last active May 1, 2024 13:43
Make website links on Member directory/profile pages open in new tab
<?php
/**
* Make user-submitted website links on Member directory/profile pages open in new tab
* Add names of fields with URLs to line 13
*
* 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/
*/
<?php
/**
* Toggle user field readonly based on user meta value or user capabilities.
* This should allow members to fill in a field at checkout but set to readonly
* on their profile edit page if they are not an admin or do not have a value.
*
* This assumes a field's readonly property is set to true.
*
* 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.
@dwanjuki
dwanjuki / restrict-page-cat-pmpro.php
Last active October 16, 2023 15:40 — forked from andrewlimaza/restrict-cpt-cat-pmpro.php
Restrict pages by category
<?php
/**
* Restricts pages based on category.
* Add categories to pages via a plugin: https://wordpress.org/plugins/pages-with-category-and-tag/
* Add this code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_restrict_page_categories( $hasaccess, $post, $user, $post_membership_levels ) {
global $wpdb;
@kimwhite
kimwhite / my-pmpro-link-phone-on-directory-profile.php
Last active May 1, 2024 13:43
Display members phone number as a tel: link on your directory profile page.
@dwanjuki
dwanjuki / my_pmpro_live_price.php
Last active January 11, 2024 15:01
Show live price after sponsored seats section at checkout
<?php
/*
* Show live price after sponsored seats section at checkout
*
* You can add this recipe to your site by creating a custom plugin
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmpro_live_price( $param ) {
$sponsor_levels = array( 7, 9, 11 ); // live price shown for these level IDs only
if( ! in_array( $_REQUEST['level'], $sponsor_levels ) ) {