Skip to content

Instantly share code, notes, and snippets.

View ipokkel's full-sized avatar

Theuns Coetzee ipokkel

View GitHub Profile
@ipokkel
ipokkel / open_specific_new_posts_to_non_members.php
Last active April 12, 2021 22:37 — forked from strangerstudios/open_new_posts_to_non_members.php
PMPro Customizations to allow non-members to view specified restricted posts if they are less than 30 days old.
<?php
/**
* This recipe allows non-members to view specific restricted posts
* if they are less than 30 days old.
*
* To set which posts to unlock set the post id's in the array of
* the $posts_to_unlock variable
* Change the '-30 Days' below if you'd like to allow access for longer or shorter.
*
* You can add this recipe to your site by creating a custom plugin
@ipokkel
ipokkel / my-default-wp-user-checkout-fields.php
Last active March 18, 2021 06:18 — forked from strangerstudios/my_default_wp_user_checkout_fields.php
Collect the default WordPress Website URL and Biographical description during Membership Checkout with Register Helper fields and save with custom callback using save_function for RH
<?php
/**
* This recipe adds Website and Biographical Info to the Membership Checkout.
*
* 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_init_user_avatar.php
Last active March 10, 2021 22:48 — 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.
<?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 December 8, 2020 07:55 — forked from MaryOJob/my_pmpro_replace_mail_emailandusername.php
Replace "Email Address" with "Username or Email Address" on PMPro Login Form
<?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 November 16, 2020 06:03 — forked from kimwhite/my-show-user-enddate.php
Custom shortcode to show member expiration dates or recurring. [show_enddate]
<?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 November 16, 2020 05:55 — forked from femiyb/my-show-user-start.php
Show the user's start date.
<?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() ) {
@ipokkel
ipokkel / pmpro-redirect-to-user-page.php
Last active November 9, 2020 08:40 — 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.
<?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.
@ipokkel
ipokkel / pmpro-add-custom-fields-to-email.php
Last active November 4, 2020 14:52 — forked from travislima/pmpro-add-custom-fields-to-email.php
PMPro add custom fields to email
<?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.
@ipokkel
ipokkel / pmpro-one-time-signup-fee.php
Last active September 25, 2020 13:59 — 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
<?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/
*/
/**
* 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