Skip to content

Instantly share code, notes, and snippets.

Avatar

Theuns Coetzee ipokkel

View GitHub Profile
@ipokkel
ipokkel / restrict-all-pages-non-members.php
Last active May 26, 2021 — forked from andrewlimaza/restrict-all-pages-non-members.php
Restrict all pages except home, Paid Memberships Pro pages, and specific pages for non-members.
View restrict-all-pages-non-members.php
<?php
/**
* This recipe will restrict all pages except Paid Memberships Pro pages,
* or the home page of your website, the search results page, the 404 page, or defined post/pages to non-members,
* non-approved members, or logged-out users.
*
* This won't affect administrators.
*
* 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 / my_first_last_display_name.php
Last active Apr 16, 2021 — forked from kimcoleman/my_first_last_display_name.php
Set Display Name on Membership Checkout and for BuddyPress Name field.
View my_first_last_display_name.php
<?php
/**
* Set Display Name on Membership Checkout and for BuddyPress Name field.
*/
function my_first_last_display_name( $user_id, $morder ) {
// Get user's first and last name.
$first_name = get_user_meta( $user_id, 'first_name', true );
$last_name = get_user_meta( $user_id, 'last_name', true );
@ipokkel
ipokkel / my_pmprorh_init_user_avatar.php
Last active Mar 10, 2021 — forked from kimcoleman/my_pmprorh_init_user_avatar.php
Allow members to upload their avatar using a Register Helper field during checkout or on the Member Profile Edit page.
View my_pmprorh_init_user_avatar.php
<?php
/*
* Allow members to upload their avatar using a Register Helper field during checkout or on the Member Profile Edit page.
*
* Requires: Paid Memberships Pro, Register Helper Add On.
*
* 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_pmpro_replace_mail_emailandusername.php
Last active Dec 8, 2020 — forked from MaryOJob/my_pmpro_replace_mail_emailandusername.php
Replace "Email Address" with "Username or Email Address" on PMPro Login Form
View my_pmpro_replace_mail_emailandusername.php
<?php
/**
* This recipe will search your codebase for
* translatable strings and replace when an exact match is found.
*
* 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-show-user-enddate.php
Last active Nov 16, 2020 — forked from kimwhite/my-show-user-enddate.php
Custom shortcode to show member expiration dates or recurring. [show_enddate]
View my-show-user-enddate.php
<?php
/**
* Show the user's expiration date, or their next payment date.
* [show_enddate] ( show end date, show enddate, show_endate )
* Show the user's previously expired date if they were cancelled, expired or cancelled by an admin.
* If none of thhe above is found, the string 'nothing found' will be returned.
*
* 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.
@ipokkel
ipokkel / my-show-user-start.php
Last active Nov 16, 2020 — forked from femiyb/my-show-user-start.php
Show the user's start date.
View my-show-user-start.php
<?php
/**
* Show the user's start date.
* Show the user's previously membership start date if they were cancelled, expired or cancelled by an admin.
* If none of thhe above is found, the string 'nothing found' will be returned.
*/
function my_show_user_startdate() {
if ( is_user_logged_in() && function_exists( 'pmpro_hasMembershipLevel' ) && pmpro_hasMembershipLevel() ) {
View pmpro-add-custom-fields-to-email.php
<?php
/**
* This recipe Adds !!company!! as an available variable for use in Paid Memberships Pro emails.
* When the variable is empty it will display nothing instead of the !!company!! email variable
*
* Notice the array key does not include the !!s
*
* 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.
View Change Text on Membership Levels
/**
* This filter will search your codebase for translatable strings and replace when an exact match is found.
*
* Here we're changing 'Membership' to 'Subscription' for Paid Memberships Pro.
*
* Add this code to your PMPro Customizations Plugin
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
* Note: When adding to your Customizations Plugin, be careful not to include the opening php tag on line 1 above.
*
* @param string $output_text this represents the end result
@ipokkel
ipokkel / pmpro-one-time-signup-fee.php
Last active Sep 25, 2020 — forked from kimwhite/pmpro-one-time-signup-fee.php
This recipe will allow you to charge additional extras on the user's fee. #pmpro #checkout
View pmpro-one-time-signup-fee.php
<?php
/**
* This recipe will allow you to charge additional extras on the user's fee.
*
* 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 / pmpro-redirect-to-user-page.php
Last active Nov 9, 2020 — forked from strangerstudios/pmpro-redirect-to-user-page.php
Plugin to work with PMPro and PMPro User Pages to redirect someone to their latest user page on login.
View pmpro-redirect-to-user-page.php
<?php
/**
* This recipe redirects members to their User Page on login
* and non-members to the PMPro membership levels page.
*
* This recipe assumes the User Pages Add On is installed and configured.
* @link https://www.paidmembershipspro.com/add-ons/pmpro-user-pages/
*
* 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.