Skip to content

Instantly share code, notes, and snippets.

View ipokkel's full-sized avatar

Theuns Coetzee ipokkel

View GitHub Profile
@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-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.
/**
* 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 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/
*/
@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 / remove-shipping-phone-field-pmpro.php
Last active June 25, 2020 15:37 — forked from andrewlimaza/remove-shipping-phone-field-pmpro.php
Remove shipping phone field from PMPro checkout
<?php
/**
* This recipe makes the shipping phone field, sphone, optional and hides the field on the checkout form.
* default user account email on renewal.
*
* 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 / disable-recurring-payment-reminder.php
Last active June 17, 2020 23:30 — forked from andrewlimaza/change-recurring-payment-reminder.php
Disable a recurring payment reminder email preventing it from being sent for Paid Memberships Pro.
<?php
/**
* This recipe removes a specific recurring payment reminder.
*
* 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/
*/
function my_pmpro_disable_recurring_emails( $emails ) {
@ipokkel
ipokkel / make_old_posts_free.php
Last active May 28, 2020 10:56 — forked from strangerstudios/make_old_posts_free.php
Make any post older than 18 months available for free with Paid Memberships Pro.
<?php
/**
* This recipe allows non-members to view specific restricted posts
* if they are older than the amount of days specified per post.
*
* To set which posts to unlock and their individual period (days)
* set the post id's as the array key and the period as the
* value of the array key of the $posts_to_unlock variable.
*
@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 / ConvertArrayOfObjectSample.php
Created May 23, 2020 06:49 — forked from esilvajr/ConvertArrayOfObjectSample.php
This is a basic solution when we need to convert a array of objects into a multidimensional array in PHP.
<?php
/**
* This is just a class for our tests
*/
class Foo
{
/**
* @var foo
*/
public $foo = 'foo';