Skip to content

Instantly share code, notes, and snippets.

Avatar

Theuns Coetzee ipokkel

View GitHub Profile
@dparker1005
dparker1005 / my_pmpro_confirmation_message_not_success.php
Last active Mar 18, 2021
Remove the text "Your %s membership is now active" from confirmation message if order does not have "success" status.
View my_pmpro_confirmation_message_not_success.php
<?php
// Copy from below here...
/*
* Remove the text "Your %s membership is now active" from confirmation message
* if order does not have "success" status.
*
* 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.
@ipokkel
ipokkel / make-pot.sh
Last active Apr 4, 2021
Create .pot language template file with WP-CLI. Additionally creates text-domain.po and text-domain.mo files. If previous language files exists gives the user the option to update with --merge option as well as to update all per locale language packs. #translations #localization #i18n #l10n #wordpress
View make-pot.sh
#!/bin/bash -e
# ==============================================================
# Plugin Language File Creator
# Author: Theunis Coetzee (ipokkel)
#
# This file must be placed inside the /plugin-folder/language/ folder
#
# Excecute from plugin root folder with ". languages/make-pot.sh"
# Check if executed from root, if not moves up one folder and
@dparker1005
dparker1005 / my_pmpro_after_change_membership_level_log.php
Created Dec 28, 2020
Creates a log at /paid-memberships-pro/logs/level-change.txt for whenever a membership level is changed.
View my_pmpro_after_change_membership_level_log.php
<?php
// Copy from below here...
/*
* Creates a log at /paid-memberships-pro/logs/level-change.txt for whenever a membership
* level is changed.
*/
function my_pmpro_after_change_membership_level_log( $level_id, $user_id, $cancel_level ) {
$logstr = "Logged On: " . date_i18n("m/d/Y H:i:s") . "\n";
@dparker1005
dparker1005 / pmprorh_required_date.php
Created Dec 17, 2020
A workaround for requiring that users fill out the RH Date field. Fails checkout if date is still the same as today's date.
View pmprorh_required_date.php
<?php
// Copy from below here...
/**
* Add a "Birthday" field via Register Helper.
*/
function my_pmprorh_init() {
//don't break if Register Helper is not loaded
if(!function_exists( 'pmprorh_add_registration_field' )) {
@ipokkel
ipokkel / custom-checkout-box-location.php
Created Dec 17, 2020
Examples of how to create custom Register Helper checkout box locations, add a description to be deisplayed below the title, and set the order in which these checkout boxes are arranged, and create custom registration fields that are published in these custom checkout boxes on the membership registration form. #pmpo-register-helper #location
View custom-checkout-box-location.php
<?php
/**
* This recipe is an example of how to create custom Register Helper checkout boxes,
* add a description to be displayed below the title, and
* set the order in which these checkout boxes are arranged,
* and create custom registration fields that are published in these custom checkout boxes
* on the membership registration form.
*
* @requires Register Helper Add On
* @link https://www.paidmembershipspro.com/add-ons/pmpro-register-helper-add-checkout-and-profile-fields/
View mypmpro-discount-code-description.php
<?php
/**
* This recipe will add a Description field to each discount code. This is then visible on the
* Discount Codes page for admin reference.
*
* 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 / show-password-login-toggle.php
Created Dec 10, 2020
Add a 'Show Password' on Paid Memberships Pro login page.
View show-password-login-toggle.php
<?php
/**
* Add a checkbox to frontend login page of WordPress to toggle the password text visible/hidden.
*
* Add this code to a custom plugin or Code Snippets Add On: https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
* Source: https://www.w3schools.com/howto/howto_js_toggle_password.asp
*/
function my_pmpro_show_password_login_toggle( $items, $args ) {
View mypmpro-hide-discount-field-not-available.php
<?php
/**
* This recipe will hide the discount code field on the checkout page if no discount codes
* have been created for that specific level.
*
* 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/
*/
@dparker1005
dparker1005 / pmproec_overwrite_message.php
Created Nov 27, 2020
Overwrite the modified email confirmation message from PMPro Email Confirmation Add On.
View pmproec_overwrite_message.php
<?php
// Copy from below here...
/*
* Overwrite the modified email confirmation message from PMPro Email Confirmation Add On.
*/
function my_pmproec_pmpro_confirmation_message( $message ) {
remove_filter( 'pmpro_confirmation_message', 'pmproec_pmpro_confirmation_message' );
//must be an email confirmation level
@andrewlimaza
andrewlimaza / change-2co-locale.php
Created Nov 18, 2020
Set 2Checkout hosted checkout page language for Paid Memberships Pro.
View change-2co-locale.php
<?php
/**
* Change the 2Checkout hosted checkout default language for Paid Memberships Pro WordPress Plugin.
* Please see https://www.2checkout.com/documentation/checkout/parameter-sets/pass-through-products/ (Additional Parameters) for available languages.
*
* 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/
*/