Skip to content

Instantly share code, notes, and snippets.

View dwanjuki's full-sized avatar

David Wanjuki dwanjuki

  • Nairobi, Kenya
  • 09:02 (UTC +03:00)
View GitHub Profile
@dwanjuki
dwanjuki / my_tribe_events_archive_require_membership.php
Created April 4, 2025 11:55
Redirect visitors without membership access form the The Events Calendar archive page
<?php
/**
* Redirect visitors without membership access form the The Events Calendar archive page
*
* 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 / change-text-for-addon-package-checkout.php
Created April 4, 2025 08:14 — forked from ipokkel/change-text-for-addon-package-checkout.php
Change the text for the addon package checkout page to only show the post title and exclude the level name.
<?php
/**
* Change the text for the addon package checkout page.
*
* 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/
*/
// Swap the pmproap_pmpro_checkout_level filter with our custom one.
<?php
/**
* This recipe will hide the discount code field on the checkout page if no discount codes
* have been created for that specific level, or if the current date is not between the
* exisiting discount codes' Start and Expiration dates
*
* 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_tiered_levels_prevent_downgrade.php
Last active March 25, 2025 11:05
Create level hierarchy / tiers. Prevent downgrade to lower levels
<?php // copy from below
/**
* This recipe will prevent users from downgrading to a "lower" level
*
* Not compatible with multiple memberships per user
*
* 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_no_access_message_html.php
Created March 14, 2025 11:14
Remove PMPro Protected Content Messages sitewide
<?php
/**
* Remove PMPro Protected Content Messages sitewide
*
* 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_order_details_to_email.php
Last active May 2, 2025 16:38 — forked from andrewlimaza/add-invoice-details-to-email-pmpro.php
Add subtotal (!!invoice_subtotal!!) and tax (!!invoice_tax!!) variables to email templates
<?php // copy from below
/**
* Add !!invoice_subtotal!! and !!invoice_tax!! variables to email templates where an Order ID is available.
*
* 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_add_order_details_to_email( $data, $email ) {
@dwanjuki
dwanjuki / my-pmpro-series-shortcode.php
Created March 7, 2025 14:54 — forked from ipokkel/my-pmpro-series-shortcode.php
Shortcode to display a series' list of articles with their available date. #pmpro_series #shortcode
<?php
/**
* This recipe creates a shortcode that shows the list of articles for a specific series.
* Use [pmpro_series id="n"] on any page/post to display a list of posts that belong to a series.
* The attribute "id" is the post ID of the series and is required, e.g [pmpro_series id="123"]
*
* This recipe assumes the site has the PMPro Series: Drip Feed Add On active.
* @link https://www.paidmembershipspro.com/add-ons/pmpro-series-for-drip-feed-content/
*
* You can add this recipe to your site by creating a custom plugin
@dwanjuki
dwanjuki / my_pmpromm_marker_content.php
Created March 4, 2025 10:15
Remove the Display Name from the Membership Maps infowindow
<?php
/**
* Remove the Display Name from the Membership Maps infowindow
*
* 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_grant_users_free_post_access.php
Last active March 3, 2025 10:31
Grant specific users free access to specific restricted posts
<?php // copy from below
/**
* Grant specific users free access to specific 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 my_pmpro_grant_users_free_post_access( $hasaccess, $mypost, $myuser, $post_membership_levels ) {
@dwanjuki
dwanjuki / my_pmpro_show_hide_discount_code.php
Last active February 28, 2025 09:05 — forked from JarrydLong/mypmpro-hide-discount-field-specific-level.php
Show the discount code field on checkout for specified levels, hide on others
<?php
/**
* Show the discount code field on checkout for specific levels only
*
* 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/
*
*/