Skip to content

Instantly share code, notes, and snippets.

View dwanjuki's full-sized avatar

David Wanjuki dwanjuki

  • Nairobi, Kenya
  • 07:28 (UTC +03:00)
View GitHub Profile
@dwanjuki
dwanjuki / my_pmproza_change_level.php
Last active October 4, 2023 09:56 — forked from dparker1005/my_pmproza_change_level.php
Add an expiration date for members added to a level via Zapier
<?php
/**
* Add an enddate for members added to level 5 via Zapier
*
* You can add this recipe to your site by creating a PMPro customizations plugin.
* Read this companion article for step-by-step instructions:
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmproza_change_level( $level, $user_id, $old_level_status, $cancel_level ) {
if ( empty( $_REQUEST['pmpro_zapier_webhook'] ) ) {
@dwanjuki
dwanjuki / my_pmpros_customize_series_delay.php
Last active October 5, 2023 08:08 — forked from dparker1005/my_pmpros_customize_series_delay.php
Unlock PMPro Series content at 5:00AM each day
<?php
// Copy from below here...
/**
* Changes startdates that are retrieved for members. Useful for implementing custom
* content drip schedules when using the PMPro Series Add On.
*
* @param string $startdate in a timestamp format.
* @param int $user_id to get startdate for.
@dwanjuki
dwanjuki / my_pmpro_stop_non_approved_members_logging_in.php
Last active February 22, 2024 22:20 — forked from andrewlimaza/pmpro-approvals-login-example.php
Stop non-approved members from logging in and display a message when using the Approvals Add On
<?php
/**
* Stop non-approved members from logging in and display a message when using the Approvals 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 / mypmpro-change-price-based-on-gateway-percentage.php
Last active October 9, 2023 08:42 — forked from JarrydLong/mypmpro-change-price-based-on-gateway-percentage.php
Add a percentage based fee to the initial and recurring value when using PayPal Express
<?php
/**
* This recipe will add a percentage based fee to the initial and recurring value when using PayPal Express
*
* 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_increase_level_cost_by_percentage_for_gateway( $level ) {
@dwanjuki
dwanjuki / restrict-page-cat-pmpro.php
Last active October 16, 2023 15:40 — forked from andrewlimaza/restrict-cpt-cat-pmpro.php
Restrict pages by category
<?php
/**
* Restricts pages based on category.
* Add categories to pages via a plugin: https://wordpress.org/plugins/pages-with-category-and-tag/
* Add this code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_restrict_page_categories( $hasaccess, $post, $user, $post_membership_levels ) {
global $wpdb;
@dwanjuki
dwanjuki / change-default-checkout-button-pmpro.php
Last active October 27, 2023 08:25 — forked from michaelbeil/change-default-checkout-button-pmpro.php
Change default checkout button text for Paid Memberships Pro
<?php
/**
* Change default checkout button
* Simply change the text value to 'Submit' or whatever you like
* Added pmpro_btn-submit ID for reCAPTCHA compatibility
*
* 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-remove-members-list-csv-headings.php
Last active November 10, 2023 15:20 — forked from ipokkel/pmpro-remove-members-list-csv-headings.php
Remove columns from the PMPro Memberslist CSV export.
<?php
/**
* Remove columns from the Members Export CSV
*
* 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/
*/
/*
Tell PMPro to filter the_content a bit later.
This will sometimes fix issues where theme or plugin elements (e.g. videos)
are not being filtered by PMPro. Note that this sometimes will cause
some things (e.g. share links) to be filtered that you don't want to be
filtered... and sometimes edits to the theme or a child theme are
required to get the desired effect.
Add this to your active theme's fucntions.php or a custom plugin.
@dwanjuki
dwanjuki / pmpro-show-password-toggle-reset-password.php
Last active November 13, 2023 09:08 — forked from ipokkel/pmpro-show-password-toggle-reset-password.php
Show passwords on the Member Profile reset password page.
<?php // copy from below here
/**
* Password visibility toggle on the Member Profile reset password 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/
*/
function my_pmpro_show_password_toggle_member_profile() {
@dwanjuki
dwanjuki / my-pmpro-adjust-trial-ending-email.php
Last active November 21, 2023 14:25 — forked from andrewlimaza/my-pmpro-adjust-trial-ending-email.php
Adjust trial ending email to be closer to the time [Paid Memberships Pro]
<?php
/**
* Send trial ending soon emails 3 days before trial ends.
* Add this code to your Code Snippet/Custom Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmpro_adjust_trial_ending_email( $days ) {
return 3;
}
add_filter( 'pmpro_email_days_before_trial_end', 'my_pmpro_adjust_trial_ending_email', 10, 1 );