Skip to content

Instantly share code, notes, and snippets.

View ipokkel's full-sized avatar

Theuns Coetzee ipokkel

View GitHub Profile
@ipokkel
ipokkel / user-name-descriptive-text-example.php
Created April 22, 2019 09:37
Add descriptive text below username text field on checkout page.
<?php
/*
Plugin Name: PMPro Customizations
Plugin URI: https://www.paidmembershipspro.com/wp/pmpro-customizations/
Description: Customizations for my Paid Memberships Pro Setup
Version: .1
Author: Paid Memberships Pro
Author URI: https://www.paidmembershipspro.com
*/
@ipokkel
ipokkel / logo-printonly-confirmation.php
Last active May 27, 2019 03:59
Sample custom confirmation page template that hides welcome message from print and displays logo only on print.
<?php
global $wpdb, $current_user, $pmpro_invoice, $pmpro_msg, $pmpro_msgt;
if($pmpro_msg)
{
?>
<div class="pmpro_message <?php echo $pmpro_msgt?> printhide"><?php echo $pmpro_msg?></div>
<?php
}
@ipokkel
ipokkel / account.php
Created May 9, 2019 08:52
Custom Paid Memberships Pro Accounts template with "Edit Profile" and "Change Password" links pointing to relevant BuddyPress pages.
<?php
/*
Custom shortcode to show membership account information
This file should be place in your theme/child-theme directory inside the folder
/your/site/wp-content/themes/your-theme/paid-memberships-pro/pages/
If using a customization plugin to replace template files instead of overriding through theme files
follow the directions on here -
https://www.paidmembershipspro.com/documentation/templates/customizing-via-a-custom-plugin/
@ipokkel
ipokkel / my_pmprosm_multiple_string_replacement.php
Last active August 10, 2023 09:36
Example showing how to replace multiple strings in the PMPro Sponsored Members Add On.
<?php
/**
* Change or translage some text strings for PMPro Sponsored Members
*
* 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_profile_redirect.php
Last active March 20, 2020 04:06
Redirect wp-admin profile to BuddyPress Profile
<?php
/**
* Redirect wp-admin profile to BuddyPress Profile
*/
function my_profile_redirect() {
global $current_user;
if(defined('IS_PROFILE_PAGE') && !current_user_can('manage_options')) {
wp_redirect( bp_loggedin_user_domain() );
exit;
@ipokkel
ipokkel / report-csv.php
Created May 14, 2019 07:36
Custom PMPro Affiliate add on report and csv with referred user's email address included.
<?php
global $wpdb, $pmpro_currency_symbol, $current_user;
if(isset($_REQUEST['report']))
$report = $_REQUEST['report'];
else
$report = false;
if($report && $report != "all")
{
@ipokkel
ipokkel / .htaccess
Created May 15, 2019 07:39
Do not cache
# DISABLE CACHING
<IfModule mod_headers.c>
Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
Header set Pragma "no-cache"
Header set Expires 0
</IfModule>
# You can customize the list of file types to suit your specific needs.
<FilesMatch "\.(css|flv|gif|htm|html|ico|jpe|jpeg|jpg|js|php|png|pdf|swf|txt)$">
<IfModule mod_expires.c>
@ipokkel
ipokkel / checkout-page-javascript-per-level-sample.php
Created May 17, 2019 09:10
Load custom javascript according to the level on the PMPro checkout page
<?php
/*
* Load custom javascript according to the level a user is subscribing to
* on the Paid Memberships Pro checkout page.
* for additional info on loading javascript in WordPress see
* https://developer.wordpress.org/reference/functions/wp_enqueue_script/
*
*/
@ipokkel
ipokkel / event-manager-usermeta-to-admin-order-sample.php
Last active May 20, 2019 07:36
Default PMPro fields based on user meta from Events Manger
<?php // do not copy this line
/**
* Use PMPro Register Helper to add PMPro Billing Address fields to the edit user page for admins.
*/
/**
* show_pmpro_address_fields_on_edit_profile Grabs the values from the billing fields which get filled in during checkout and displays on User Profile.
*
* @return array Array of Register Helper field objects
*/
@ipokkel
ipokkel / force-required-billing-address-fields.php
Last active May 26, 2019 07:19
Force address fields as required even for free levels
<?php
/*
* This method has been replaced.
* See: https://gist.github.com/ipokkel/83f4812390c3647374ac790faaa000ba
*
*/