Skip to content

Instantly share code, notes, and snippets.

View dwanjuki's full-sized avatar

David Wanjuki dwanjuki

  • Nairobi, Kenya
  • 14:21 (UTC +03:00)
View GitHub Profile
@dwanjuki
dwanjuki / conpd-immediately-if-trial.php
Last active November 7, 2024 12:54 — forked from andrewlimaza/conpd-immediately-if-trial.php
Cancel Members Immediately if they cancel during the trial period (Subscription Delays)
<?php
/**
* Cancel members immediately if they are cancelling within the Subscription Delay Limit of their level
*
* Works on PMPro v3.0+
*
* 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/
@dwanjuki
dwanjuki / pmpro-open-comments-non-members.php
Last active October 15, 2024 07:37 — forked from andrewlimaza/pmpro-open-comments-non-members.php
Allows non-members to view comments and comment on restricted posts
<?php
/**
* Allows non-members to view comments and comment on restricted posts
*
* 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 make_pmpro_comments_open(){
@dwanjuki
dwanjuki / pmpro-prevent-checkout-for-current-levels.php
Last active October 1, 2024 07:41 — forked from ipokkel/pmpro-prevent-checkout-for-current-levels.php
Prevent users from checking out for a level they already have, unless the level is expiring soon and the user can renew.
<?php
/**
* Prevent users from checking out for a level they already have,
* unless the level is expiring soon and the user can renew.
*
* 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/
*/
@dwanjuki
dwanjuki / my-pmpro-add-required-attribute-to-input.php
Last active August 21, 2024 15:03 — forked from ipokkel/my-pmpro-add-required-attribute-to-input.php
Add the HTML5 required attribute to all checkout fields that has the pmpro_required class for front-end validation that checks that a required field is not empty before processing the form submit.
<?php
/**
* This recipe adds the HTML5 attribute "required" to all required
* fields on the checkout page that has the class "pmpro_form_input-required"
* to check that a required field is not empty before submitting.
*
* @link https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/required
*
* 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.
@dwanjuki
dwanjuki / my_pmpro_group_accounts_gettext_seat.php
Last active July 29, 2024 09:30 — forked from andrewlimaza/my-pmpro-change-seat-to-member.php
Change the word "Seat(s)" to "Membership(s)" for the Group Accounts Add On
<?php
/**
* This will change all instances of seat(s) to membership(s) for the Group Accounts 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/
*/
@dwanjuki
dwanjuki / my_pmpro_buddypress_profile_template_redirect.php
Last active July 4, 2024 08:19 — forked from kimwhite/my_pmpro_buddypress_profile_template_redirect.php
Redirect the PMPro Profile Edit and Password Reset pages to the user's BuddyPress Profile and Settings pages respectively
<?php
/**
* Redirect the PMPro Profile Edit and Password Reset pages
* to the user's BuddyPress Profile and Settings 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.
* Read this companion article for step-by-step directions on either method.
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
@dwanjuki
dwanjuki / pmpro-add-welcome-name-to-menu.php
Last active June 24, 2024 12:17 — forked from kimwhite/pmpro-add-welcome-name-to-menu.php
Add member's name to Top Bar Nav menu location (OceanWP theme)
<?php
/**
* Add "Welcome, User Display Name" to the OceanWP Top Bar menu location
*
* 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/
*/
@dwanjuki
dwanjuki / remove-sub-delay-pmpro.php
Last active June 18, 2024 06:51 — forked from andrewlimaza/remove-sub-delay-pmpro.php
Remove Subscription Delay for members and past members and set the initial price to the billing amount.
<?php
/**
* Remove the Subscription Delay for members and past members
*
* This will change the price of the initial amount to the billing amount
* for past members of the level being checked out for
*
* This is an advanced customization recipe that may require further development
* to suit specific needs and/or setups. For more details, please see:
* https://www.paidmembershipspro.com/developers/
@dwanjuki
dwanjuki / sell-courses-addon-packages.php
Last active June 6, 2024 07:43 — forked from kimwhite/sell-courses-addon-packages.php
Sell PMPro Courses through AddOn Packages
<?php
/**
* Adds the AddOn Package post meta to 'pmpro_course' post type.
* Give access if they purchased "Courses" parent container.
* Add this code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function add_pmpro_courses_to_AP( $types ) {
$types[] = 'pmpro_course';
<?php
/**
* This recipe logs out non-approved members after checkout.
*
* Requires PMPro Approvals - pmpro-approvals
* https://www.paidmembershipspro.com/add-ons/approval-process-membership/
*
* 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.