Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working remotely 😈

Mary Job MaryOJob

🏠
Working remotely 😈
View GitHub Profile
@andrewlimaza
andrewlimaza / rh-file-upload-members-csv.php
Created Jul 31, 2020
Add Register Helper File Upload Field to Member's CSV Export
View rh-file-upload-members-csv.php
<?php
/**
* Add the full URL of a file upload field to member export CSV.
* Adjust the 'my_image' value with the relevant Register Helper field key.
* You can add this code snippet to your WordPress site following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
// Add a custom column to the CSV export.
function my_pmpro_members_list_csv_extra_columns ( $columns ) {
$columns["uploaded"] = "my_pmpro_members_list_uploaded";
@kimcoleman
kimcoleman / remove_the_pmpro_actions_nav_separator.php
Last active Aug 5, 2020
Remove the vertical bar | in the various action nav groups on Membership Account, Log In widget, and more.
View remove_the_pmpro_actions_nav_separator.php
<?php
/**
* Remove the vertical bar | in the various action nav groups on Membership Account, Log In widget, and more.
*
* 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 / my-pmprorh-read-only.php
Created Jul 29, 2020
Set Register Helper field to read only for members but not administrators or membership managers with the readonly field option.
View my-pmprorh-read-only.php
<?php
/**
* This recipe creates a custom fields for membership registration
* that is readonly on the user edit profile for members and
* editable by administrators or users with the membership manager role.
*
* This recipe assumes that the registration field is required during checkout.
*
* @requires Register Helper Add On
* @link https://www.paidmembershipspro.com/add-ons/pmpro-register-helper-add-checkout-and-profile-fields/
@andrewlimaza
andrewlimaza / generate-username-from-email-pmpro.php
Created Jul 15, 2020
Generate a username during checkout for user [Paid Memberships Pro]
View generate-username-from-email-pmpro.php
<?php
/**
* Generate a username at PMPro checkout from email for users.
* Hide your 'username' field using custom CSS.
* Add this code to your site by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_generate_username_at_checkout() {
//check for level as well to make sure we're on checkout page
@MaryOJob
MaryOJob / strike-pmpro-woo.php
Created Jun 12, 2020 — forked from andrewlimaza/strike-pmpro-woo.php
Strike pricing for WooCommerce and Paid Memberships Pro pricing.
View strike-pmpro-woo.php
<?php
/**
* This will add strike through pricing if the membership pricing is available for currrent user viewing Woo store.
* Add this code (Line 8 onwards) to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmprowoo_strike_prices( $price, $product ) {
global $pmprowoo_member_discounts, $current_user;
$level_id = $current_user->membership_level->id;
@ipokkel
ipokkel / my-pmpromd-custom-profile-shortcode.php
Created Jun 5, 2020
Custom shortcode that applies wpautop to the user bio to automatically create paragraphs from double line breaks.
View my-pmpromd-custom-profile-shortcode.php
<?php
/**
* This recipe replaces the function for the shortcode [pmpro_member_profile]
* with a custom shortcode function that applies wpautop to the user bio,
* which creates paragraphs from double line breaks.
* @link https://developer.wordpress.org/reference/functions/wpautop/
*
* 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.
@andrewlimaza
andrewlimaza / example-pmpro-login-redirect.php
Created Jun 2, 2020
Example of pmpro_login_redirect_url filter
View example-pmpro-login-redirect.php
<?php
/**
* Example to redirect all user's to a specific page when logging in via Paid Memberships Pro site.
*/
function my_login_redirect( $redirect_to, $request, $user ) {
return home_url(); // redirect to home page on login.
}
add_filter( 'pmpro_login_redirect_url', 'my_login_redirect', 10, 3 );
@dparker1005
dparker1005 / my_pmpro_is_order_renewal.php
Last active May 22, 2020
Adds a "Renewal" column to the Orders list and order CSV export to show if the order is a membership renewal.
View my_pmpro_is_order_renewal.php
<?php
// Copy from below here...
/*
* Adds a "Renewal" column to the Orders list and order CSV export
* to show if the order is a membership renewal.
*/
function my_pmpro_is_order_renewal( $order ) {
global $wpdb;
@MaryOJob
MaryOJob / pmpro_isOrderRecurring.php
Last active May 15, 2020 — forked from strangerstudios/pmpro_isOrderRecurring.php
Perform an action on Paid Memberships Pro (PMPro) recurring orders only.
View pmpro_isOrderRecurring.php
/*
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,
@andrewlimaza
andrewlimaza / adjust-my-vat.php
Created Mar 30, 2020
Adjust VAT amount for VAT Add On PMPro
View adjust-my-vat.php
<?php
/**
* Adjust VAT amount charged from VAT Tax Add On Paid Memberships Pro.
* Adjust the code to your liking/needs.
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function adjust_my_pmpro_vat( $vat ) {
$vat['DE'] = 0.25; //Change VAT to 25% for Germany.
You can’t perform that action at this time.