Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working remotely 😈

Mary Job MaryOJob

🏠
Working remotely 😈
View GitHub Profile
@MaryOJob
MaryOJob / adjust_pmpro_email_according_to_level.php
Created Nov 3, 2020 — forked from andrewlimaza/adjust_pmpro_email_according_to_level.php
Change confirmation email contents in Paid Memberships Pro according to user level checkout.
View adjust_pmpro_email_according_to_level.php
<?php
/**
* Adjust email template according to user's level that they are checking out for.
* Add this code to your PMPro Customizations plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
* For more information in customizing emails in Paid Memberships Pro visit - https://www.paidmembershipspro.com/documentation/member-communications/customizing-email-templates/
* List of available email templates - https://www.paidmembershipspro.com/documentation/member-communications/list-of-pmpro-email-templates/
*/
function adjust_pmpro_email_according_to_level( $email ){
@dparker1005
dparker1005 / user_pages_login_redirect.php
Created Oct 9, 2020
Redirects users to their user pages on login.
View user_pages_login_redirect.php
<?php
// Copy from below here...
/*
* Redirects users to their user pages on login.
*/
function my_pmpro_login_redirect_user_pages( $redirect, $requested_redirect_to, $user ) {
if ( isset( $user->ID ) ) {
$user_page_id = get_user_meta( $user->ID, "pmproup_user_page", true );
@gausam
gausam / myupcoming-expirations-report.php
Created Aug 28, 2020
Add an upcoming expirations report
View myupcoming-expirations-report.php
<?php
/**
* This recipe adds a custom report which shows all memberships expiring within the next month.
*
* 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/
*/
@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
@ideadude
ideadude / my_pmprowoo_is_purchasable.php
Created Jul 1, 2020
Change the default PMPro WooCommerce bahavior and make membership products not purchasable if a user already has any other membership level.
View my_pmprowoo_is_purchasable.php
<?php
/**
* Change the default PMPro WooCommerce bahavior
* and make membership products not purchasable
* if a user already has any other membership level.
*/
// First disable the core PMPro WC callaback and set up our own.
function my_pmprowoo_init() {
remove_filter( 'woocommerce_is_purchasable', 'pmprowoo_is_purchasable', 10, 2 );
add_filter( 'woocommerce_is_purchasable', 'my_pmprowoo_is_purchasable', 5, 2 );
@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.
You can’t perform that action at this time.