Skip to content

Instantly share code, notes, and snippets.

View ipokkel's full-sized avatar

Theuns Coetzee ipokkel

View GitHub Profile
@ipokkel
ipokkel / change_text_example.php
Last active December 7, 2023 21:35 — forked from andrewlimaza/change_text_example.php
gettext change confirmation message
<?php
// Add this code below to your PMPro Customizations plugin - http://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
add_filter( 'gettext', 'change_my_cost_example', 20, 3 );
/**
* @link http://codex.wordpress.org/Plugin_API/Filter_Reference/gettext
*/
add_filter( 'gettext', 'change_my_cost_example', 20, 3 );
/**
@ipokkel
ipokkel / pmpro-file-upload-avatar-register-helper.php
Last active October 11, 2019 13:36 — forked from LMNTL/pmpro-file-upload-avatar-register-helper.php
Upload avatar image from the checkout using the PMPro Register Helper Add On. No other plugins required.
<?php
/*
* Add WP User Avatar from Register Helper field during checkout.
*/
function my_updated_user_meta( $meta_id, $user_id, $meta_key, $meta_value ) {
// Change user_avatar to your Register Helper file upload name.
if ( 'user_avatar' == $meta_key ) {
$filename = $meta_value['fullpath'];
$filetype = wp_check_filetype( basename( $filename ), null );
@ipokkel
ipokkel / my-pmpro-invoice-address.php
Last active October 18, 2019 08:43 — forked from strangerstudios/my_pmpro_invoice_address.php
Add and translate your business address and VAT number to the Membership Invoice and Membership Confirmation pages.
<?php // Do NOT copy this line
// Add this code below to your PMPro Customizations plugin - http://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
add_action( 'pmpro_invoice_bullets_bottom', 'my_pmpro_invoice_address' );
function my_pmpro_invoice_address() {
?>
<li><strong><?php _e( 'Paid To', 'pmpro-customizations' ); ?>:</strong><br />My Business<br />123 The Street<br />City, XX 12345 USA</li>
<li><strong><?php _e( 'VAT Number', 'pmpro-customizations' ); ?>:</strong> BG999999999</li>
<?php
@ipokkel
ipokkel / pmpro_gettext_membership_options.php
Last active November 7, 2019 10:40 — forked from LMNTL/pmpro_gettext_membership_options.php
Hide "View all Membership Options" link on PMPro Account page
<?php //Do NOT copy this line
/* Hide "View all Membership Options" link */
add_filter( 'gettext', 'my_gettext_pmpro_hide_view_membership_options', 10, 3 );
function my_gettext_pmpro_hide_view_membership_options( $translated_text, $text, $domain ) {
if ( $pmpro_pages['account'] && 'paid-memberships-pro' == $domain && 'View all Membership Options' == $text ) {
$translated_text = '';
}
return $translated_text;
}
@ipokkel
ipokkel / pmproseries_shortcode.php
Last active August 4, 2020 06:51 — forked from messica/pmproseries_shortcode.php
Adds a [my_pmpro_series] shortcode to display a specific series post list.
<?php
/**
* This recipe creates a [my_pmpro_series] shortcode
* to display a specific series post list.
*
* This shortcode requires that a Series (Post) ID is provided.
*
* To obtain the Post ID for a series, from the
* WordPress dashboard navigate to Series > Series,
* click on the series name, in the edit page URL
@ipokkel
ipokkel / my_pmpro_applydiscountcode_return_js.php
Last active November 21, 2019 08:22 — forked from messica/my_pmpro_applydiscountcode_return_js.php
Display original price and discount when a discount code is applied. Modified to display original price on discount code error
<?php
/**
* Display messages of the Original Price, Discounted Price and Amount Saved when discount code is applied to PMPro order.
* Add this code recipe to a PMPro Customization Plugin - Display messages of the Original Price, Discounted Price and Amount Saved when discount code is applied to PMPro order
* Various classes added to strings to allow for styling - ".pmpro-discorig-message", ".pmpro-orginal-price", ".pmpro-discount-price", ".pmpro-save-price"
*
* [my_pmpro_applydiscountcode_return_js] Display original price and discount when a discount code is applied.
* @param string $discount_code [description]
* @param integer $discount_code_id [description]
@ipokkel
ipokkel / pmpro_format_my_phone.php
Last active November 25, 2019 07:18 — forked from travislima/pmpro_format_my_phone.php
Format the Phone number of Paid Memberships Pro - Customized Example
<?php
/**
* This code gist illustrates a way to customize the format of your members phone number.
*
* In this example, we will change the PMPro phone number from
*
* (123)456-7890
* to 1234567890
*
* Adjust this code gist to suit your needs for phone number.
@ipokkel
ipokkel / display-custom-register-helper-fields-in-signup-shortcode.php
Last active January 8, 2020 10:15 — forked from MaryOJob/my_pmpro_custom_select_and_text_fields_to_register_helper.php
Create custom Register Helper fields and hook them into a different location to display in Signup Shortcode #pmpro #signup #shortcode
<?php
/*
This code example serves as an experimental example.
The preferred method of showing custom fields in the signup shortcode is to use the shortcode attribute custom_fields
[pmpro_signup submit_button="Unlock this Post Now!" level="1" login="1" redirect="referrer" custom_fields="true"]
See - https://www.paidmembershipspro.com/add-ons/pmpro-signup-shortcode/
*/
@ipokkel
ipokkel / my_template_redirect_require_membership_access.php
Last active January 17, 2020 02:36 — forked from kimcoleman/my_template_redirect_require_membership_access.php
Redirects members-only content to the Membership Levels page if a user is logged out or not a member in a multisite network using the PMPro Multisite Membership Add On.
<?php
/*
* Redirects members-only content to the Membership Levels page if a user is logged out or not a member.
*/
function my_template_redirect_require_membership_access() {
if ( function_exists( 'pmpro_has_membership_access' ) && ! pmpro_has_membership_access() ) {
if ( ! is_multisite() && ! function_exists( 'pmpro_multisite_membership_init' ) ) {
wp_safe_redirect( pmpro_url( 'levels' ) );
exit;
@ipokkel
ipokkel / redirect_users_to_a_new_page.php
Last active January 28, 2020 05:09 — forked from andrewlimaza/redirect_users_to_a_new_page.php
Redirect users away from 'account' page in PMPro if they do not have a membership/logged-in #pmpro #account #redirect #slug
<?php
/**
* Redirect user's to a new URL instead of the 'levels' page in PMPro.
* Add this code to your PMPro Customizations plugin - http://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function redirect_users_to_a_new_page( $url ){
return home_url('my-landing-page-slug'); //change this to the page slug you would like to redirect your user's to.